Fixed read/write dependencies for the insn scheduler
authorBenjamin Segovia <bsegovia@bsegovia-i70.sc.intel.com>
Thu, 4 Oct 2012 21:12:53 +0000 (21:12 +0000)
committerBenjamin Segovia <bsegovia@bsegovia-i70.sc.intel.com>
Thu, 4 Oct 2012 21:12:53 +0000 (21:12 +0000)
backend/src/backend/gen_context.cpp
backend/src/backend/gen_insn_scheduling.cpp
backend/src/backend/gen_reg_allocation.cpp

index 4b28baf..48e7fdc 100644 (file)
@@ -386,7 +386,6 @@ namespace gbe
     if (OCL_OUTPUT_ASM)
       for (uint32_t insnID = 0; insnID < genKernel->insnNum; ++insnID)
         gen_disasm(stdout, &p->store[insnID]);
-    exit(0);
   }
 
   Kernel *GenContext::allocateKernel(void) {
index ab2eb94..a7832a2 100644 (file)
@@ -228,7 +228,8 @@ namespace gbe
   }
 
   uint32_t DependencyTracker::getIndex(uint32_t bti) const {
-    return bti == 0xfe ? LOCAL_MEMORY : GLOBAL_MEMORY;
+    const uint32_t memDelta = virtualNum + MAX_FLAG_REGISTER + MAX_ACC_REGISTER;
+    return bti == 0xfe ? memDelta + LOCAL_MEMORY : memDelta + GLOBAL_MEMORY;
   }
 
   void DependencyTracker::updateWrites(ScheduleNode *node) {
@@ -298,8 +299,8 @@ namespace gbe
   }
 
   int32_t SelectionScheduler::buildDAG(SelectionBlock &bb) {
-    nodePool.rewind();
-    listPool.rewind();
+    //nodePool.rewind();
+    //listPool.rewind();
     tracker.clear();
     this->clearLists();
 
@@ -348,7 +349,7 @@ namespace gbe
       ScheduleNode *node = tracker.insnNodes[insnID];
       const SelectionInstruction &insn = node->insn;
 
-      // write-after-reads in registers
+      // write-after-read in registers
       for (uint32_t srcID = 0; srcID < insn.srcNum; ++srcID)
         tracker.addDependency(insn.src(srcID), node);
 
index 5d9a9d8..273dad4 100644 (file)
@@ -485,8 +485,8 @@ namespace gbe
     GBE_ASSERT(fn.getProfile() == PROFILE_OCL);
 
     // Allocate all the vectors first since they need to be contiguous
-    // schedulePreRegAllocation(ctx, selection);
     this->allocateVector(selection);
+    // schedulePreRegAllocation(ctx, selection);
 
     // Now start the linear scan allocation
     for (uint32_t regID = 0; regID < ctx.sel->getRegNum(); ++regID)