Changeset: 615df8fc3844 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=615df8fc3844
Modified Files:
        monetdb5/scheduler/mut_transforms.c
Branch: mutation
Log Message:

mat.pack propogation when base operator partitions are less than the dependent 
operator partitions


diffs (152 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
@@ -743,7 +743,7 @@ static void
 //mutatePartitionedOperators(Mutant m, int stmtLoop, int matPackRefInstr, int 
matPackRefInstrArg, int batPartitionRefInstr, int batPartitionRefRefInstr, int 
batPartitionRefInstrArg, InstrPtr instrMatPack, int profiler)
 mutatePartitionedOperators(Mutant m,  int batPartitionRefRefInstr, int 
batPartitionRefInstrArg, InstrPtr instrMatPack, int profiler)
 {
-    int i, k;
+    int i, j, k;
     InstrPtr  q, depInstrMatPack;      
     int mat_pack_partitions, dep_mat_pack_partitions, beginLifePC, 
beginLifeBatPartition, mat_pack_to_combine; 
     Lifespan span;
@@ -758,10 +758,8 @@ mutatePartitionedOperators(Mutant m,  in
 
     if(mat_pack_partitions > dep_mat_pack_partitions)
     {
-       for(i=0; i<dep_mat_pack_partitions-1; i++)
-       {
-               beginLifePC = getBeginLifespan(span, getArg(depInstrMatPack, 
depInstrMatPack->retc + i)); 
-               // replace the algebra.join(Bat_Partition,...) with 
algebra.join(algebra.select.partition)i
+               // replace the algebra.join(Bat_Partition,...) with 
algebra.join(algebra.select.partition)
+               //
                // A1 := algebra.subselect(....);
                // A2 := algebra.subselect(....);
                // A3 := algebra.subselect(....);
@@ -785,6 +783,11 @@ mutatePartitionedOperators(Mutant m,  in
                // J1 := algebra.join(A1,b);
                // J2 := algebra.join(S1,b);
                // M_ := mat.pack(J1, J2);
+       
+       // 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);
@@ -817,7 +820,62 @@ mutatePartitionedOperators(Mutant m,  in
 
     }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;       
+       
     }else
     {  
        
@@ -937,20 +995,19 @@ mutationMatPack(Client cntxt, Mutant m) 
                                if(matPackRefInstr != -1)
                                        break;
                        }
-       // Case 2
+                       // 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);
-
+                       // 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);
 
                        // Find what kind of case this is (case 1, or case 2)
                        if(matPackRefInstr != -1)
@@ -1024,9 +1081,8 @@ mutationMatPack(Client cntxt, Mutant m) 
                                                        DEBUG_MULTICORE
                                                                
mnstr_printf(cntxt->fdout, "# No reference to bat.partitioned output in 
instruction found\n");
                                                }
-
                                        }                                       
-                               }else   // case 1 
+                               }else    
                                {
                                        // Case 1
                                        // 
@@ -1036,7 +1092,6 @@ mutationMatPack(Client cntxt, Mutant m) 
                                        // J := algebra.join(M1, b);
                                                                                
                //   instruction referring mat.pack results
                                        mutateNonPartitionedOperators(m, 
stmtLoop, matPackRefInstr, matPackRefInstrArg, instrMatPack, profiler);
-
                                }
                                //pushInstruction(m->src,p);
                                m->target = pc;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to