[Beignet] [PATCH 07/10 OpenCL-2.0] Add forward message function for gen encoder.

junyan.he at inbox.com junyan.he at inbox.com
Wed Apr 22 20:26:23 PDT 2015


From: Junyan He <junyan.he at linux.intel.com>

Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 backend/src/backend/gen_encoder.cpp |   16 ++++++++++++++--
 backend/src/backend/gen_encoder.hpp |    4 +++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/backend/src/backend/gen_encoder.cpp b/backend/src/backend/gen_encoder.cpp
index 5bf7df6..aaac063 100644
--- a/backend/src/backend/gen_encoder.cpp
+++ b/backend/src/backend/gen_encoder.cpp
@@ -863,6 +863,18 @@ namespace gbe
      insn->bits3.msg_gateway.sub_function_id = GEN_BARRIER_MSG;
      insn->bits3.msg_gateway.notify = 0x1;
   }
+
+  void GenEncoder::FWD_GATEWAY_MSG(GenRegister src, uint32_t notifyN) {
+     GenNativeInstruction *insn = this->next(GEN_OPCODE_SEND);
+     this->setHeader(insn);
+     this->setDst(insn, GenRegister::null());
+     this->setSrc0(insn, src);
+     setMessageDescriptor(insn, GEN_SFID_MESSAGE_GATEWAY, 1, 0);
+     insn->bits3.msg_gateway.sub_function_id = GEN_FORWARD_MSG;
+     GBE_ASSERT(notifyN <= 2);
+     insn->bits3.msg_gateway.notify = notifyN;
+  }
+
   void GenEncoder::FENCE(GenRegister dst) {
     GenNativeInstruction *insn = this->next(GEN_OPCODE_SEND);
     this->setHeader(insn);
@@ -1006,9 +1018,9 @@ namespace gbe
     this->setSrc1(insn, src1);
   }
 
-  void GenEncoder::WAIT(void) {
+  void GenEncoder::WAIT(uint32_t subnr) {
      GenNativeInstruction *insn = this->next(GEN_OPCODE_WAIT);
-     GenRegister src = GenRegister::notification1();
+     GenRegister src = GenRegister::notification(subnr);
      this->setDst(insn, GenRegister::null());
      this->setSrc0(insn, src);
      this->setSrc1(insn, GenRegister::null());
diff --git a/backend/src/backend/gen_encoder.hpp b/backend/src/backend/gen_encoder.hpp
index 21faabc..8cc3350 100644
--- a/backend/src/backend/gen_encoder.hpp
+++ b/backend/src/backend/gen_encoder.hpp
@@ -142,6 +142,8 @@ namespace gbe
     virtual void LOAD_INT64_IMM(GenRegister dest, GenRegister value);
     /*! Barrier message (to synchronize threads of a workgroup) */
     void BARRIER(GenRegister src);
+    /*! Forward the gateway message. */
+    void FWD_GATEWAY_MSG(GenRegister src, uint32_t notifyN = 0);
     /*! Memory fence message (to order loads and stores between threads) */
     void FENCE(GenRegister dst);
     /*! Jump indexed instruction */
@@ -167,7 +169,7 @@ namespace gbe
     /*! No-op */
     void NOP(void);
     /*! Wait instruction (used for the barrier) */
-    void WAIT(void);
+    void WAIT(uint32_t subnr = 0);
     /*! Atomic instructions */
     virtual void ATOMIC(GenRegister dst, uint32_t function, GenRegister src, uint32_t bti, uint32_t srcNum);
     /*! Untyped read (upto 4 channels) */
-- 
1.7.9.5





More information about the Beignet mailing list