Changeset: 5aae7f0640f3 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5aae7f0640f3
Modified Files:
monetdb5/scheduler/mut_policy.c
monetdb5/scheduler/mut_transforms.c
monetdb5/scheduler/run_multicore.c
monetdb5/scheduler/run_multicore.h
Branch: mutation
Log Message:
mdb.start instruction added in the plan for debugging
diffs (truncated from 682 to 300 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
@@ -47,6 +47,11 @@ mutationCandidate(MalBlkPtr mb, InstrPtr
if (getFunctionId(p) == leftfetchjoinRef)
return 1;
}
+ if ( getModuleId(p) == matRef) {
+ if (getFunctionId(p) == packRef)
+ return 1;
+ }
+
/*
@@ -117,6 +122,9 @@ MUTpolicy(Client cntxt, Mutant m)
}
if ( getModuleId(p) && strncmp(getModuleId(p), "aggr",4)== 0)
mutationSum(cntxt,m);
+ if ( getModuleId(p) && strncmp(getModuleId(p), "mat",3)== 0)
+ if(getFunctionId(p) == packRef)
+ mutationMatPack(cntxt,m);
/* reset/expand the profiler */
if (ssize < src->ssize){
diff --git a/monetdb5/scheduler/mut_transforms.c
b/monetdb5/scheduler/mut_transforms.c
--- a/monetdb5/scheduler/mut_transforms.c
+++ b/monetdb5/scheduler/mut_transforms.c
@@ -519,7 +519,6 @@ mutationLeftFetchJoin(Client cntxt, Muta
InstrPtr p=0, *old= m->src->stmt, q;
int matpc = 0, profiler;
-
(void) cntxt;
limit= m->src->stop;
if ( newMalBlkStmt(m->src, m->src->ssize) < 0)
@@ -594,7 +593,7 @@ mutationLeftFetchJoin(Client cntxt, Muta
//remove all of them.
static void
-removeMatPack(Mutant m, Client cntxt, InstrPtr instrMatPack)
+removeMatPack(Mutant m, Client cntxt, InstrPtr *old, InstrPtr instrMatPack)
{
InstrPtr p, instrJoin;
int i, beginLifeJoin, eofLifeJoin;
@@ -605,7 +604,8 @@ removeMatPack(Mutant m, Client cntxt, In
span = setLifespan(m->src);
//Handle the case when the base operator is a join, and hence has two
mat.pck operators to take care of
beginLifeJoin = getBeginLifespan(span, getArg(instrMatPack,
instrMatPack->retc + 1));
- instrJoin = getInstrPtr(m->src, beginLifeJoin);
+ //instrJoin = getInstrPtr(m->src, beginLifeJoin);
+ instrJoin = old[beginLifeJoin];
if(getModuleId(instrJoin) == algebraRef && getFunctionId(instrJoin) ==
joinRef)
{
eofLifeJoin = getEndLifespan(span, getArg(instrJoin,
instrJoin->retc -1));
@@ -615,7 +615,8 @@ removeMatPack(Mutant m, Client cntxt, In
// for the first time in a mat.pack, in the above case its
mat.pack(t1,t2)
for(i=pc+1; i<=eofLifeJoin; i++)
{
- p = getInstrPtr(m->src, i);
+ //p = getInstrPtr(m->src, i);
+ p = old[i];
for (j = p->retc; j < p->argc; j++)
{
if(getArg(p,j) == getArg(instrJoin,
instrJoin->retc-1) && getModuleId(p) == matRef && getFunctionId(p)== packRef)
@@ -630,7 +631,8 @@ removeMatPack(Mutant m, Client cntxt, In
if(joinRefInstr != -1)
{
// second mat.pack is rendered useless
- getInstrPtr(m->src, joinRefInstr)->token = NOOPsymbol;
+ //getInstrPtr(m->src, joinRefInstr)->token =
NOOPsymbol;
+ old[joinRefInstr]->token = NOOPsymbol;
}else
{
DEBUG_MULTICORE
@@ -651,52 +653,65 @@ removeMatPack(Mutant m, Client cntxt, In
// A1 := algebra.subselect(....);
// A2 := algebra.subselect(....);
// M1 := mat.pack(A1, A2);
- // J := algebra.join(M1, b);
+ // J,T := algebra.join(M1, b);
//
//
// Morphed into new plan
//
// A1 := algebra.subselect(....);
// A2 := algebra.subselect(....);
- // J1 := algebra.join(A1,b);
- // J2 := algebra.join(A2,b);
- // M := mat.pack(J1, J2);
+ // J1,T1 := algebra.join(A1,b);
+ // J2,T2 := algebra.join(A2,b);
+ // J := mat.pack(J1, J2);
+ // T := mat.pack(T1, T2);
// Handles the case when the base operator is partitioned, but the dependent
operator is non-partitioned. This function introduced partitions on the
dependent
// operator equal to base operator partitions. It adds mat.pack for combining
these partitions
static void
-mutateNonPartitionedOperators(Mutant m, Client cntxt, int stmtLoop, int
matPackRefInstr, int matPackRefInstrArg, InstrPtr instrMatPack, int profiler)
+mutateNonPartitionedOperators(Mutant m, Client cntxt, InstrPtr *old, int
stmtLoop, int matPackRefInstr, int matPackRefInstrArg, InstrPtr instrMatPack,
int profiler)
{
int n, j, l, limit, v1[MAX_PARTITIONS], z1[MAX_PARTITIONS];
- InstrPtr *old= m->src->stmt, q;
+ // InstrPtr *old= m->src->stmt, q;
+ InstrPtr q;
int matpc = 0, k, mat_pack_partitions;
limit= m->src->stop;
- if(getModuleId(getInstrPtr(m->src, matPackRefInstr)) == algebraRef)
- {
- if(getFunctionId(getInstrPtr(m->src, matPackRefInstr)) ==
joinRef)
- {
+// if(getModuleId(getInstrPtr(m->src, matPackRefInstr)) == algebraRef)
+// {
+// if(getFunctionId(getInstrPtr(m->src, matPackRefInstr)) ==
joinRef)
+// {
// number_of_partitions = Get number of partitions from
mat.pack
mat_pack_partitions = instrMatPack->argc -
instrMatPack->retc;
for (k=0; k<mat_pack_partitions; k++)
{
- q= copyInstruction(getInstrPtr(m->src,
matPackRefInstr)); // matPackRefInstr = join
-
- getArg(q,matPackRefInstrArg) =
getArg(instrMatPack, instrMatPack->retc + k);
-
- v1[k] = getArg(q,0)=
newTmpVariable(m->src,TYPE_any);
-
- z1[k] = getArg(q,1)=
newTmpVariable(m->src,TYPE_any);
-
- pushInstruction(m->src,q);
-
- // inherit profiling
- m->src->profiler[m->src->stop-1].trace = profiler;
- }
-
+ //q= copyInstruction(getInstrPtr(m->src,
matPackRefInstr)); // matPackRefInstr = join
+ q= copyInstruction(old[matPackRefInstr]); //
matPackRefInstr = join
+
+ getArg(q,matPackRefInstrArg) =
getArg(instrMatPack, instrMatPack->retc + k);
+
+ v1[k] = getArg(q,0)=
newTmpVariable(m->src,TYPE_any);
+
+ // Handle the special case of join operator's
second return arguemtn
+ //if(getModuleId(getInstrPtr(m->src,
matPackRefInstr)) == algebraRef)
+ if(getModuleId(old[matPackRefInstr]) ==
algebraRef)
+ {
+ //if(getFunctionId(getInstrPtr(m->src,
matPackRefInstr)) == joinRef)
+ if(getFunctionId(old[matPackRefInstr])
== joinRef)
+ {
+
+ z1[k] = getArg(q,1)=
newTmpVariable(m->src,TYPE_any);
+ }
+ }
+
+ pushInstruction(m->src,q);
+
+ // inherit profiling
+ m->src->profiler[m->src->stop-1].trace =
profiler;
+ }
+
// replace its use in other mat packs
for (j = stmtLoop+1; j < limit; j++)
{
@@ -705,7 +720,8 @@ mutateNonPartitionedOperators(Mutant m,
{
for( n= old[j]->retc; n < old[j]->argc;
n++)
{
- if ( getArg(q,n) ==
getArg(getInstrPtr(m->src, matPackRefInstr),0))
+ //if ( getArg(q,n) ==
getArg(getInstrPtr(m->src, matPackRefInstr),0))
+ if ( getArg(q,n) ==
getArg(old[matPackRefInstr],0))
{
// replace this
argument
matpc++;
@@ -715,24 +731,33 @@ mutateNonPartitionedOperators(Mutant m,
break;
}
}
- }
- if(matpc>0 && j+1<limit)
+ } // if first mat.pack exists and this is
algebra.join instruction
+ //if(getModuleId(getInstrPtr(m->src,
matPackRefInstr)) == algebraRef)
+ if(getModuleId(old[matPackRefInstr]) ==
algebraRef)
{
- j++;
- q= old[j];
- if ( getModuleId(q) == matRef &&
getFunctionId(q) == packRef)
+ //if(getFunctionId(getInstrPtr(m->src,
matPackRefInstr)) == joinRef)
+ if(getFunctionId(old[matPackRefInstr])
== joinRef)
{
- for( n= old[j]->retc; n <
old[j]->argc; n++)
- {
- if ( getArg(q,n) ==
getArg(getInstrPtr(m->src,matPackRefInstr),1))
+ if(matpc>0 && j+1<limit)
+ {
+ j++;
+ q= old[j];
+ if ( getModuleId(q) ==
matRef && getFunctionId(q) == packRef)
{
- // replace this
argument
- matpc++;
-
delArgument(old[j],n);
+ for( n=
old[j]->retc; n < old[j]->argc; n++)
+ {
+ //if (
getArg(q,n) == getArg(getInstrPtr(m->src,matPackRefInstr),1))
+ if (
getArg(q,n) == getArg(old[matPackRefInstr],1))
+ {
+
// replace this argument
+
matpc++;
+
delArgument(old[j],n);
-
for(l=mat_pack_partitions-1; l>=0; l--)
- old[j]
= setArgument(m->src,old[j],n, z1[l]);
- break;
+
for(l=mat_pack_partitions-1; l>=0; l--)
+
old[j] = setArgument(m->src,old[j],n, z1[l]);
+
break;
+ }
+ }
}
}
}
@@ -740,32 +765,42 @@ mutateNonPartitionedOperators(Mutant m,
}
if (matpc == 0)
{
-
- q= newStmt(m->src,matRef,packRef);
- getArg(q,0)=
getArg(getInstrPtr(m->src,matPackRefInstr),0);
-
- for(k=0; k<mat_pack_partitions; k++)
- q= pushArgument(m->src,q,v1[k]);
- m->src->profiler[m->src->stop-1].trace
= profiler;
+ q= newStmt(m->src,matRef,packRef);
+ //getArg(q,0)=
getArg(getInstrPtr(m->src,matPackRefInstr),0);
+ getArg(q,0)= getArg(old[matPackRefInstr],0);
+
+ for(k=0; k<mat_pack_partitions; k++)
+ q= pushArgument(m->src,q,v1[k]);
+ m->src->profiler[m->src->stop-1].trace =
profiler;
- q= newStmt(m->src,matRef,packRef);
- getArg(q,0)=
getArg(getInstrPtr(m->src,matPackRefInstr),1);
-
- for(k=0; k<mat_pack_partitions; k++)
- q= pushArgument(m->src,q,z1[k]);
- m->src->profiler[m->src->stop-1].trace
= profiler;
+ //if(getModuleId(getInstrPtr(m->src,
matPackRefInstr)) == algebraRef)
+ if(getModuleId(old[matPackRefInstr]) ==
algebraRef)
+ {
+ //if(getFunctionId(getInstrPtr(m->src,
matPackRefInstr)) == joinRef)
+ if(getFunctionId(old[matPackRefInstr])
== joinRef)
+ {
+ q=
newStmt(m->src,matRef,packRef);
+ //getArg(q,0)=
getArg(getInstrPtr(m->src,matPackRefInstr),1);
+ getArg(q,0)=
getArg(old[matPackRefInstr],1);
+
+ for(k=0; k<mat_pack_partitions;
k++)
+ q=
pushArgument(m->src,q,z1[k]);
+
m->src->profiler[m->src->stop-1].trace = profiler;
+ }
+ }
- q= newStmt(m->src, languageRef,
passRef); // The instruction below should be remembered if done correct
- q = pushArgument(m->src,q,
getArg(getInstrPtr(m->src,matPackRefInstr),getInstrPtr(m->src,matPackRefInstr)->retc+1));
+ q= newStmt(m->src, languageRef, passRef); //
The instruction below should be remembered if done correct
+ //q = pushArgument(m->src,q,
getArg(getInstrPtr(m->src,matPackRefInstr),getInstrPtr(m->src,matPackRefInstr)->retc+1));
+ q = pushArgument(m->src,q,
getArg(old[matPackRefInstr],old[matPackRefInstr]->retc+1));
- // inherit profiling
- m->src->profiler[m->src->stop-1].trace
= profiler;
+ // inherit profiling
+ m->src->profiler[m->src->stop-1].trace =
profiler;
}
// mask the original algebra.join instruction
- removeMatPack(m, cntxt, instrMatPack);
+ removeMatPack(m, cntxt, old, instrMatPack);
//getInstrPtr(m->src,matPackRefInstr)->token =
NOOPsymbol;
- }
- }
+ // }
+ //}
}
// Case 2
@@ -778,9 +813,10 @@ mutateNonPartitionedOperators(Mutant m,
// S1 := bat.partion(M,2,0);
// S2 := bat.partition(M,2,1);
//
- // J1 := algebra.join(S1,b);
- // J2 := algebra.join(S2,b);
- // M_ := mat.pack(J1, J2);
+ // J1,T1 := algebra.join(S1,b);
+ // J2,T2 := algebra.join(S2,b);
+ // J := mat.pack(J1, J2);
+ // T := mat.pack(T1, T2);
// Morphed into new plan
//
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list