Changeset: 95a8ad1fef6a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=95a8ad1fef6a
Modified Files:
monetdb5/scheduler/mut_transforms.c
Branch: mutation
Log Message:
code indentation and documentation
diffs (truncated from 605 to 300 lines):
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
@@ -646,34 +646,6 @@ removeMatPack(Mutant m, Client cntxt, In
}
-
-
- // Case 2
- //
- // A1 := algebra.subselect(....);
- // A2 := algebra.subselect(....);
- // A3 := algebra.subselect(....);
- // M := mat.pack(A1, A2, A3);
- //
- // 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);
-
- // Morphed into new plan
- //
- // A1 := algebra.subselect(....);
- // A2 := algebra.subselect(....);
- // A3 := algebra.subselect(....);
- //
- // S1 := mat.pack(A2,A3);
- //
- // J1 := algebra.join(A1,b);
- // J2 := algebra.join(S1,b);
- // M_ := mat.pack(J1, J2);
-
// Case 1
//
// A1 := algebra.subselect(....);
@@ -690,6 +662,9 @@ removeMatPack(Mutant m, Client cntxt, In
// J2 := algebra.join(A2,b);
// M := mat.pack(J1, J2);
+// 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)
{
@@ -791,256 +766,8 @@ mutateNonPartitionedOperators(Mutant m,
//getInstrPtr(m->src,matPackRefInstr)->token =
NOOPsymbol;
}
}
-
-//end of the function
}
-
-
-//mutatePartitionedOperators(Mutant m, int stmtLoop, int matPackRefInstr, int
matPackRefInstrArg, int batPartitionRefInstr, int batPartitionRefRefInstr, int
batPartitionRefInstrArg, InstrPtr instrMatPack, int profiler)
-static void
-mutatePartitionedOperators(Mutant m, Client cntxt, int
batPartitionRefRefInstr, int batPartitionRefInstr, int batPartitionRefInstrArg,
InstrPtr instrMatPack, int profiler)
-{
- int j;//,pc;
- InstrPtr q, depInstrMatPack, depInstr;
- int beginLifePC, beginLifeBatPartition, mat_pack_to_combine;
- int i,k, mat_pack_partitions, dep_mat_pack_partitions;
- Lifespan span;
-
- span = setLifespan(m->src);
-// pc = m->target;
- depInstrMatPack = getInstrPtr(m->src, batPartitionRefRefInstr);
// The second mat.pack on dependency operator
-
- mat_pack_partitions = instrMatPack->argc - instrMatPack->retc;
- dep_mat_pack_partitions = depInstrMatPack->argc - depInstrMatPack->retc;
-
- depInstr = getInstrPtr(m->src, batPartitionRefInstr);
-
- if(getModuleId(depInstr) == algebraRef && getFunctionId(depInstr) !=
joinRef) // case 2
- {
- if(mat_pack_partitions > dep_mat_pack_partitions)
- {
- // replace the algebra.join(Bat_Partition,...)
with algebra.join(algebra.select.partition)
- //
- // A1 := algebra.subselect(....);
- // A2 := algebra.subselect(....);
- // A3 := algebra.subselect(....);
- // M := mat.pack(A1, A2, A3);
- //
- // S1 := bat.partion(M,2,0);
- // S2 := bat.partition(M,2,1);
- //
- // J1,T1 := algebra.join(S1,b);
- // J2,T2 := algebra.join(S2,b);
- // M_ := mat.pack(J1, J2);
- // T_ := mat.pack(T1, T2);
-
- // Morphed into new plan
- //
- // A1 := algebra.subselect(....);
- // A2 := algebra.subselect(....);
- // A3 := algebra.subselect(....);
- //
- // S1 := mat.pack(A2,A3);
- //
- // J1,T1 := algebra.join(A1,b);
- // J2,T2 := algebra.join(S1,b);
- // M_ := mat.pack(J1, J2);
- // T_ := mat.pack(T1, T2);
-
- // propogate from dependent operator (total_partition -
1) to base operator all the mapping partitions
- for(i=0; i<dep_mat_pack_partitions-1; i++)
- {
- beginLifePC = getBeginLifespan(span,
getArg(depInstrMatPack, depInstrMatPack->retc + i));
-
- // match the partitions of instrMatPack
- getArg(getInstrPtr(m->src,beginLifePC),
batPartitionRefInstrArg) = getArg(instrMatPack, instrMatPack->retc + i);
-
- // remove the bat.partition instructions by
assigning a NOOPsymbol
- beginLifeBatPartition = getBeginLifespan(span,
getArg(getInstrPtr(m->src,beginLifePC),batPartitionRefInstrArg));
- getInstrPtr(m->src,
beginLifeBatPartition)->token = NOOPsymbol;
- }
-
- // the last argument adjustment instruction in
depInstrMatPack =
- beginLifePC = getBeginLifespan(span,
getArg(depInstrMatPack, depInstrMatPack->retc + i));
-
- // remove the last bat.partition instructions
corresponding to the last join instruction by assigning a NOOPsymbol
- beginLifeBatPartition = getBeginLifespan(span,
getArg(getInstrPtr(m->src,beginLifePC),batPartitionRefInstrArg));
- getInstrPtr(m->src, beginLifeBatPartition)->token =
NOOPsymbol;
-
- //create S1= mat.pack(A2,A3) instruction
- mat_pack_to_combine = mat_pack_partitions -
(dep_mat_pack_partitions - 1);
- q= newStmt(m->src,matRef,packRef);
- // getArg(q,0)=
getArg(getInstrPtr(m->src,matPackRefInstr),0);
-
- for(k=0; k<mat_pack_to_combine; k++)
- q= pushArgument(m->src,q,getArg(instrMatPack,
instrMatPack->retc + (dep_mat_pack_partitions - 1) + k ));
- m->src->profiler[m->src->stop-1].trace = profiler;
-
- // Adjusted the value of J2 := algebra.join(S1, b);
- getArg(getInstrPtr(m->src,beginLifePC),
batPartitionRefInstrArg) = getArg(q,0);
-
- removeMatPack(m, cntxt, instrMatPack);
-
-
-
- // The case when base operator partitions are less than the
dependent operator partitions
- //
- }else if(mat_pack_partitions < dep_mat_pack_partitions)
- {
- // replace the algebra.join(Bat_Partition,...)
with algebra.join(algebra.select.partition)
- // A1 := algebra.subselect(....);
- // A2 := algebra.subselect(....);
- // M := mat.pack(A1, A2);
- //
- // S1 := bat.partition(M,2,0);
- // S2 := bat.partition(M,2,1);
- // S3 := bat.partition(M,2,2);
- //
- // J1 := algebra.join(S1,b);
- // J2 := algebra.join(S2,b);
- // J3 := algebra.join(S3,b);
- // M_ := mat.pack(J1, J2, J3);
-
- // Morphed into new plan
- //
- // A1 := algebra.subselect(....);
- // A2 := algebra.subselect(....);
- //
- // S1 := bat.partition(A2,2,0);
- // S2 := bat.partition(A2,2,1);
- //
- // J1 := algebra.join(A1,b);
- // J2 := algebra.join(S1,b);
- // J3 := algebra.join(S2,b);
- // M_ := mat.pack(J1, J2, J3);
-
- // propogate from base operator (total_partition - 1)
to dependent operator all the mapping partitions
- for(i=0; i<mat_pack_partitions-1; i++)
- {
- beginLifePC = getBeginLifespan(span,
getArg(depInstrMatPack, depInstrMatPack->retc + i));
-
- // match the partitions of instrMatPack
- getArg(getInstrPtr(m->src,beginLifePC),
batPartitionRefInstrArg) = getArg(instrMatPack, instrMatPack->retc + i);
-
- // remove the bat.partition instructions by
assigning a NOOPsymbol
- beginLifeBatPartition = getBeginLifespan(span,
getArg(getInstrPtr(m->src,beginLifePC),batPartitionRefInstrArg));
- getInstrPtr(m->src,
beginLifeBatPartition)->token = NOOPsymbol;
- }
-
- // replace the remaining bat.partitions instructions
with appropriate parameters to suit new bat.partitions requirements
- for(j=0; i< dep_mat_pack_partitions; i++,j++)
- {
- beginLifePC = getBeginLifespan(span,
getArg(depInstrMatPack, depInstrMatPack->retc + i));
- beginLifeBatPartition = getBeginLifespan(span,
getArg(getInstrPtr(m->src,beginLifePC),batPartitionRefInstrArg));
-
- // reset the s1 := bat.partition(A2,2,0) in the
original s2 := bat.partition(M,2,1);
- getArg(getInstrPtr(m->src,
beginLifeBatPartition), 1) = getArg(instrMatPack, mat_pack_partitions);
- getArg(getInstrPtr(m->src,
beginLifeBatPartition), 2) = dep_mat_pack_partitions - (mat_pack_partitions
-1);
- getArg(getInstrPtr(m->src,
beginLifeBatPartition), 3) = j;
-
- // set the J2 := algebra.join(S1,b) the S1
argument to corresponding bat.partition output
- getArg(getInstrPtr(m->src, beginLifePC),
batPartitionRefInstrArg) = getArg(getInstrPtr(m->src, beginLifeBatPartition),
0);
- }
- //instrMatPack->token = NOOPsymbol;
- removeMatPack(m, cntxt, instrMatPack);
-
- }else // both base and dependent operator partitions
are equal
- { // A1 := algebra.subselect(....);
- // A2 := algebra.subselect(....);
- // M := mat.pack(A1, A2);
- //
- // S1 := bat.partition(M,2,0);
- // S2 := bat.partition(M,2,1);
- //
- // J1 := algebra.join(S1,b);
- // J2 := algebra.join(S2,b);
- // M_ := mat.pack(J1, J2);
-
- // 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);
-
-
- for(i=0; i<mat_pack_partitions; i++)
- {
- beginLifePC = getBeginLifespan(span,
getArg(depInstrMatPack, depInstrMatPack->retc + i));
-
- // match the partitions of instrMatPack
- getArg(getInstrPtr(m->src,beginLifePC),
batPartitionRefInstrArg) = getArg(instrMatPack, instrMatPack->retc + i);
-
- // remove the bat.partition instructions by
assigning a NOOPsymbol
- beginLifeBatPartition = getBeginLifespan(span,
getArg(getInstrPtr(m->src,beginLifePC),batPartitionRefInstrArg));
- getInstrPtr(m->src,
beginLifeBatPartition)->token = NOOPsymbol;
- }
- //instrMatPack->token = NOOPsymbol;
- removeMatPack(m, cntxt, instrMatPack);
- }
- }else if(getModuleId(depInstr) == algebraRef && getFunctionId(depInstr)
!= joinRef) // case 2
- {
-
-
-
-
-
- }else
- {
-
-
- }
-}
-
-void
-mutationMatPack(Client cntxt, Mutant m) {
- int pc = m->target, i, j, limit, profiler;
- InstrPtr p=0, *old= m->src->stmt, instrMatPack, instrBatPartition,
instrBatPartitionRef;
-
- int stmtLoop; // Loop that goes through the entire instruction
statements
- int matPackRefInstr; // first instruction referring the mat.pack
result
- int matPackRefInstrArg; // The argument number in the first instruction
referring mat.pack result.
- int batPartitionRefInstr;
- int batPartitionRefInstrArg;
- int batPartitionRefRefInstr;
-// int batPartitionRefRefInstrArg;
-
-
-
-
- // search for the mat.pack outuput variable
- // check in which instruction this mat.pack output appears in the
dependency instructions.
-
- // If the referenced instruction is a non-bat-ref instruction, and its
cost is relatively
- // comparable to the cost of mat.pack operator, then count the number
of partitions in the
- // mat.pack instruction and introduce those many partitions for the new
dependency operator
- // which we just found. That is partition the input of the dependency
operator (This dependency operator could be
- // any for time being consider it to be a join operator and mat.pack
combines a select operator
- // Then we have join(A,x) propagate to
- // join(s1,x), join(s2,x), join(s3,x) that is propagate the input to
mat.pack to the newly introduced join operator
- // and remove the old join operator. also remove the old mat.pack
operator from the select output, and introduce a new
- // mat.pack operator to combine the join output
-
- // Case 1
- //
- // A1 := algebra.subselect(....);
- // A2 := algebra.subselect(....);
- // M1 := mat.pack(A1, A2);
- // J := 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);
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list