Changeset: 9681304a15e9 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9681304a15e9 Modified Files: monetdb5/scheduler/mut_policy.c Branch: mutation Log Message:
Better administer the cost of an instruction Packs are still considered expensive bottlenecks, to be removed as early as possible diffs (110 lines): diff --git a/monetdb5/scheduler/mut_policy.c b/monetdb5/scheduler/mut_policy.c --- a/monetdb5/scheduler/mut_policy.c +++ b/monetdb5/scheduler/mut_policy.c @@ -63,28 +63,34 @@ MUTfindtarget(Client cntxt, Mutant m, ln MalBlkPtr src = m->src; int i,target = -1; InstrPtr p; + lng cost=0; + DEBUG_MULTICORE + mnstr_printf(cntxt->fdout,"#mutation findtarget "LLFMT" " LLFMT"\n", threshold,upperbound); // The mutation call is known to be the second instruction. for ( i = 2; i < src->stop ; i++) { p = getInstrPtr(src,i); if ( !mutationCandidate(p)) continue; - - if (src->calls && (src->profiler[i].ticks/src->calls <= threshold || - (upperbound && src->profiler[i].ticks/src->calls >= upperbound)) ) - continue; - // mat.pack are blocking, they weight more in the comparison - if ( getModuleId(p) == sqlRef && ( getFunctionId(p) == packRef || getFunctionId(p)== mergepackRef) ){ - if (src->calls && target >= 0 && src->profiler[i].ticks * p->argc <= src->profiler[target].ticks) - continue; - } else - if (src->calls && target >= 0 && src->profiler[i].ticks/src->calls <= src->profiler[target].ticks/src->calls) - continue; DEBUG_MULTICORE{ - mnstr_printf(cntxt->fdout,"#mutation candidate %d calls %d cost "LLFMT"\n", - i, src->calls, (src->calls?src->profiler[i].ticks/src->calls:0)); + mnstr_printf(cntxt->fdout,"#mutation candidate %d cost "LLFMT" target %d\n", i, src->profiler[i].ticks,target); printInstruction(cntxt->fdout,src,0,getInstrPtr(src,i),LIST_MAL_DEBUG); } else (void) cntxt; + + // mat.pack are blocking, they weight more in the comparison + if ( getModuleId(p) == matRef && ( getFunctionId(p) == packRef || getFunctionId(p)== mergepackRef) && i != m->target){ + if (target >= 0 && src->profiler[i].ticks * p->argc > cost){ + cost= src->profiler[i].ticks * p->argc; + src->profiler[i].ticks = cost; + target = i; // remember new cost + continue; + } + } + if ((src->profiler[i].ticks <= threshold || (upperbound && src->profiler[i].ticks>= upperbound)) ) + continue; + if (src->profiler[i].ticks <= cost) + continue; + cost= src->profiler[i].ticks; target = i; } return target; @@ -143,8 +149,8 @@ MUTpolicyBaseline(Client cntxt, Mutant m modified = mutationPack(cntxt,m); DEBUG_MULTICORE{ - mnstr_printf(cntxt->fdout, "#MODIFIED %s modified %d threshold "LLFMT" cost"LLFMT" %d %s\n", - (modified>0? getFunctionId(p):""),modified, threshold, mb->profiler[m->target].ticks,mb->calls, m->comment); + mnstr_printf(cntxt->fdout, "#MODIFIED %s modified %d threshold "LLFMT" cost"LLFMT" %s\n", + (modified>0? getFunctionId(p):""),modified, threshold, mb->profiler[m->target].ticks,m->comment); if( !modified){ mnstr_printf(cntxt->fdout, "#MODIFIED FAILED\n"); //printFunction(cntxt->fdout, m->src,0,LIST_MAL_DEBUG); @@ -191,14 +197,14 @@ MUTpolicy(Client cntxt, Mutant m) target = MUTfindtarget(cntxt,m,m->threshold,threshold); if ( target < 0 ) break; + m->target = target; DEBUG_MULTICORE{ if ( m->src->profiler && m->target) { - mnstr_printf(cntxt->fdout,"#MUTATION WINNER %s %d calls %d cost "LLFMT" %d\n", - getFunctionId(getInstrPtr(m->src,m->target)),m->target, m->src->calls, m->src->profiler[m->target].ticks,m->src->calls); + mnstr_printf(cntxt->fdout,"#MUTATION WINNER %s %d cost "LLFMT"\n", + getFunctionId(getInstrPtr(m->src,m->target)),m->target, m->src->profiler[m->target].ticks); } } - threshold= m->src->profiler[target].ticks/m->src->calls; - m->target = target; + threshold= m->src->profiler[target].ticks; r = MUTpolicyBaseline(cntxt, m); } while( !r); DEBUG_MULTICORE @@ -207,24 +213,23 @@ MUTpolicy(Client cntxt, Mutant m) if ( r < 0 || m->src->errors) throw(MAL,"run_multicore","Baseline error"); while(0 && r > 0 && m->src->errors == 0){ - target = MUTfindpack(m, target-1); + target = MUTfindpack(m, target); if ( target < 0 ) break; m->target = target; DEBUG_MULTICORE{ if ( m->src->profiler && m->target) { - mnstr_printf(cntxt->fdout,"#MUTATION TARGET %s %d calls %d cost "LLFMT" %d\n", - getFunctionId(getInstrPtr(m->src,m->target)),m->target, m->src->calls, m->src->profiler[m->target].ticks,m->src->calls); + mnstr_printf(cntxt->fdout,"#MUTATION TARGET %s %d cost "LLFMT"\n", + getFunctionId(getInstrPtr(m->src,m->target)),m->target, m->src->profiler[m->target].ticks); } } r = MUTpolicyBaseline(cntxt, m); target++; } - m->src->calls = 0; OPTgarbageCollectorImplementation(cntxt,m->src,0,0); OPTdataflowImplementation(cntxt,m->src,0,0); DEBUG_MULTICORE{ - mnstr_printf(cntxt->fdout,"Final plan to execute, errors %d\n",m->src->errors); + mnstr_printf(cntxt->fdout,"Final plan to execute, errors %d MAL statemetns %d\n",m->src->errors, m->src->stop); //if( mb->errors) printFunction(cntxt->fdout, m->src,0,LIST_MAL_DEBUG); mnstr_printf(cntxt->fdout,"\n\n\n"); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list