[Beignet] [PATCH 1/2] move function setDPByteScatterGather into class GenEncoder

Guo, Yejun yejun.guo at intel.com
Tue Nov 29 06:27:59 UTC 2016


setDPByteScatterGather will be reused by gen9 sends. As for the
same function in gen8encoder, just leave it untill the reuse case
appears (now, just change the function name to pass build)

Signed-off-by: Guo, Yejun <yejun.guo at intel.com>
---
 backend/src/backend/gen8_encoder.cpp |  6 +++---
 backend/src/backend/gen_encoder.cpp  | 15 ++++++---------
 backend/src/backend/gen_encoder.hpp  |  2 ++
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/backend/src/backend/gen8_encoder.cpp b/backend/src/backend/gen8_encoder.cpp
index 4239e84..8f73346 100644
--- a/backend/src/backend/gen8_encoder.cpp
+++ b/backend/src/backend/gen8_encoder.cpp
@@ -84,7 +84,7 @@ namespace gbe
       NOT_SUPPORTED;
   }
 
-  static void setDPByteScatterGather(GenEncoder *p,
+  static void setDPByteScatterGatherA64(GenEncoder *p,
                                      GenNativeInstruction *insn,
                                      uint32_t bti,
                                      uint32_t block_size,
@@ -350,7 +350,7 @@ namespace gbe
     GBE_ASSERT(this->curr.execWidth == 8);
     const uint32_t msg_length = 2;
     const uint32_t response_length = 1;
-    setDPByteScatterGather(this,
+    setDPByteScatterGatherA64(this,
                            insn,
                            0xff,
                            0x0,
@@ -375,7 +375,7 @@ namespace gbe
     this->setSrc1(insn, GenRegister::immud(0));
     const uint32_t msg_length = 3;
     const uint32_t response_length = 0;
-    setDPByteScatterGather(this,
+    setDPByteScatterGatherA64(this,
                            insn,
                            0xff,
                            0x0,
diff --git a/backend/src/backend/gen_encoder.cpp b/backend/src/backend/gen_encoder.cpp
index b379419..637403c 100644
--- a/backend/src/backend/gen_encoder.cpp
+++ b/backend/src/backend/gen_encoder.cpp
@@ -237,8 +237,7 @@ namespace gbe
       NOT_SUPPORTED;
   }
 
-  static void setDPByteScatterGather(GenEncoder *p,
-                                     GenNativeInstruction *insn,
+  void GenEncoder::setDPByteScatterGather(GenNativeInstruction *insn,
                                      uint32_t bti,
                                      uint32_t elem_size,
                                      uint32_t msg_type,
@@ -246,13 +245,13 @@ namespace gbe
                                      uint32_t response_length)
   {
     const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA;
-    p->setMessageDescriptor(insn, sfid, msg_length, response_length);
+    setMessageDescriptor(insn, sfid, msg_length, response_length);
     insn->bits3.gen7_byte_rw.msg_type = msg_type;
     insn->bits3.gen7_byte_rw.bti = bti;
     insn->bits3.gen7_byte_rw.data_size = elem_size;
-    if (p->curr.execWidth == 8)
+    if (curr.execWidth == 8)
       insn->bits3.gen7_byte_rw.simd_mode = GEN_BYTE_SCATTER_SIMD8;
-    else if (p->curr.execWidth == 16)
+    else if (curr.execWidth == 16)
       insn->bits3.gen7_byte_rw.simd_mode = GEN_BYTE_SCATTER_SIMD16;
     else
       NOT_SUPPORTED;
@@ -472,8 +471,7 @@ namespace gbe
       response_length = 2;
     } else
       NOT_IMPLEMENTED;
-    setDPByteScatterGather(this,
-                           insn,
+    setDPByteScatterGather(insn,
                            bti,
                            elemSize,
                            GEN7_BYTE_GATHER,
@@ -515,8 +513,7 @@ namespace gbe
     } else
       NOT_IMPLEMENTED;
 
-    setDPByteScatterGather(this,
-                           insn,
+    setDPByteScatterGather(insn,
                            bti,
                            elemSize,
                            GEN7_BYTE_SCATTER,
diff --git a/backend/src/backend/gen_encoder.hpp b/backend/src/backend/gen_encoder.hpp
index e6f362b..b9446e6 100644
--- a/backend/src/backend/gen_encoder.hpp
+++ b/backend/src/backend/gen_encoder.hpp
@@ -247,6 +247,8 @@ namespace gbe
     ////////////////////////////////////////////////////////////////////////
     // Helper functions to encode
     ////////////////////////////////////////////////////////////////////////
+    void setDPByteScatterGather(GenNativeInstruction *insn, uint32_t bti, uint32_t elem_size,
+                                     uint32_t msg_type, uint32_t msg_length, uint32_t response_length);
     virtual void setDPUntypedRW(GenNativeInstruction *insn, uint32_t bti, uint32_t rgba,
                                 uint32_t msg_type, uint32_t msg_length,
                                 uint32_t response_length);
-- 
1.9.1



More information about the Beignet mailing list