[Beignet] [PATCH] GBE: fix one scheduling bug for ATOMIC instruction.

Zhigang Gong zhigang.gong at intel.com
Tue May 27 19:28:59 PDT 2014


Atomic instruction is both read/write instruction, we need
to take care of it in the instruction scheduling.

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

diff --git a/backend/src/backend/gen_insn_scheduling.cpp b/backend/src/backend/gen_insn_scheduling.cpp
index 6f37ed4..578db58 100644
--- a/backend/src/backend/gen_insn_scheduling.cpp
+++ b/backend/src/backend/gen_insn_scheduling.cpp
@@ -486,6 +486,10 @@ namespace gbe
         const uint32_t index = tracker.getIndex(insn.extra.function);
         tracker.addDependency(node, index, READ_AFTER_WRITE);
       }
+      if (insn.opcode == SEL_OP_ATOMIC) {
+        const uint32_t index = tracker.getIndex(insn.extra.elem);
+        tracker.addDependency(node, index, READ_AFTER_WRITE);
+      }
       //read-after-write of scratch memory
       if (insn.opcode == SEL_OP_UNSPILL_REG) {
         const uint32_t index = tracker.getIndex(0xff);
@@ -519,6 +523,10 @@ namespace gbe
         const uint32_t index = tracker.getIndex(insn.extra.function);
         tracker.addDependency(node, index, WRITE_AFTER_WRITE);
       }
+      if (insn.opcode == SEL_OP_ATOMIC) {
+        const uint32_t index = tracker.getIndex(insn.extra.elem);
+        tracker.addDependency(node, index, WRITE_AFTER_WRITE);
+      }
 
       // write-after-write in scratch memory
       if (insn.opcode == SEL_OP_SPILL_REG) {
@@ -549,6 +557,10 @@ namespace gbe
         const uint32_t index = tracker.getIndex(insn.extra.function);
         tracker.addDependency(index, node, WRITE_AFTER_READ);
       }
+      if (insn.opcode == SEL_OP_ATOMIC) {
+        const uint32_t index = tracker.getIndex(insn.extra.elem);
+        tracker.addDependency(index, node, WRITE_AFTER_READ);
+      }
 
       // write-after-read in scratch memory
       if (insn.opcode == SEL_OP_UNSPILL_REG) {
-- 
1.8.3.2



More information about the Beignet mailing list