[Beignet] [PATCH 2/2] GBE: Fix one bug in instruction scheduling.

Zhigang Gong zhigang.gong at gmail.com
Thu Aug 8 00:15:44 PDT 2013


As now we may use 8 byte registers (long and double), then one
register may take two(SIMD8) or four(SIMD16) physical registers.
Thus if we met a register with long or double type, we need to
handle the immediately next index at the same time.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 backend/src/backend/gen_insn_scheduling.cpp |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/backend/src/backend/gen_insn_scheduling.cpp b/backend/src/backend/gen_insn_scheduling.cpp
index 0b720b7..94221d7 100644
--- a/backend/src/backend/gen_insn_scheduling.cpp
+++ b/backend/src/backend/gen_insn_scheduling.cpp
@@ -165,11 +165,15 @@ namespace gbe
       }
       return false;
     }
+    /*! Owns the tracker */
+    SelectionScheduler &scheduler;
     /*! Add a new dependency "node0 depends on node set for register reg" */
-    INLINE void addDependency(ScheduleDAGNode *node0, GenRegister reg) {
+    INLINE  void addDependency(ScheduleDAGNode *node0, GenRegister reg) {
       if (this->ignoreDependency(reg) == false) {
         const uint32_t index = this->getIndex(reg);
         this->addDependency(node0, index);
+        if (reg.isdf() || reg.isint64())
+          this->addDependency(node0, index + 1);
       }
     }
     /*! Add a new dependency "node set for register reg depends on node0" */
@@ -177,6 +181,8 @@ namespace gbe
       if (this->ignoreDependency(reg) == false) {
         const uint32_t index = this->getIndex(reg);
         this->addDependency(index, node0);
+        if (reg.isdf() || reg.isint64())
+          this->addDependency(index + 1, node0);
       }
     }
     /*! Make the node located at insnID a barrier */
@@ -187,8 +193,6 @@ namespace gbe
     static const uint32_t MAX_FLAG_REGISTER = 8u;
     /*! Maximum number of *physical* accumulators registers */
     static const uint32_t MAX_ACC_REGISTER = 1u;
-    /*! Owns the tracker */
-    SelectionScheduler &scheduler;
     /*! Stores the last node that wrote to a register / memory ... */
     vector<ScheduleDAGNode*> nodes;
     /*! Stores the nodes per instruction */
@@ -328,6 +332,8 @@ namespace gbe
       if (this->ignoreDependency(dst) == false) {
         const uint32_t index = this->getIndex(dst);
         this->nodes[index] = node;
+        if (dst.isdf() || dst.isint64())
+          this->nodes[index + 1] = node;
       }
     }
 
-- 
1.7.9.5



More information about the Beignet mailing list