[Beignet] [PATCH] Debug: Correct function type is being lost att LLVM backend

Grigore Lupescu grigore.lupescu at intel.com
Mon Apr 11 14:32:01 UTC 2016


From: Grigore Lupescu <grigore.lupescu at intel.com>

Signed-off-by: Grigore Lupescu <grigore.lupescu at intel.com>
---
 backend/src/backend/gen_context.cpp          | 12 ++++++------
 backend/src/libocl/src/ocl_work_group.cl     | 12 ++++++++++++
 backend/src/llvm/llvm_gen_backend.cpp        |  7 +++++--
 utests/compiler_workgroup_scan_exclusive.cpp |  2 +-
 4 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp
index 8842c02..26cbb98 100644
--- a/backend/src/backend/gen_context.cpp
+++ b/backend/src/backend/gen_context.cpp
@@ -2468,12 +2468,12 @@ namespace gbe
   }
 
   static void wgOpPerformThread(GenRegister threadDst,
-                                  GenRegister inputVal,
-                                  GenRegister threadExchangeData,
-                                   GenRegister resultVal,
-                                   uint32_t simd,
-                                   uint32_t wg_op,
-                                   GenEncoder *p)
+                                GenRegister inputVal,
+                                GenRegister threadExchangeData,
+                                GenRegister resultVal,
+                                uint32_t simd,
+                                uint32_t wg_op,
+                                GenEncoder *p)
   {
    p->push();
    p->curr.predicate = GEN_PREDICATE_NONE;
diff --git a/backend/src/libocl/src/ocl_work_group.cl b/backend/src/libocl/src/ocl_work_group.cl
index 2c43d6d..e52f8e1 100644
--- a/backend/src/libocl/src/ocl_work_group.cl
+++ b/backend/src/libocl/src/ocl_work_group.cl
@@ -102,6 +102,10 @@ RANGE_OP(scan_inclusive, max, float, true)
 RANGE_OP(scan_inclusive, max, double, true)
 
 /* scan_exclusive add */
+RANGE_OP(scan_exclusive, add, char, true)
+RANGE_OP(scan_exclusive, add, uchar, false)
+RANGE_OP(scan_exclusive, add, short, true)
+RANGE_OP(scan_exclusive, add, ushort, false)
 RANGE_OP(scan_exclusive, add, int, true)
 RANGE_OP(scan_exclusive, add, uint, false)
 RANGE_OP(scan_exclusive, add, long, true)
@@ -109,6 +113,10 @@ RANGE_OP(scan_exclusive, add, ulong, false)
 RANGE_OP(scan_exclusive, add, float, true)
 RANGE_OP(scan_exclusive, add, double, true)
 /* scan_exclusive min */
+RANGE_OP(scan_exclusive, min, char, true)
+RANGE_OP(scan_exclusive, min, uchar, false)
+RANGE_OP(scan_exclusive, min, short, true)
+RANGE_OP(scan_exclusive, min, ushort, false)
 RANGE_OP(scan_exclusive, min, int, true)
 RANGE_OP(scan_exclusive, min, uint, false)
 RANGE_OP(scan_exclusive, min, long, true)
@@ -116,6 +124,10 @@ RANGE_OP(scan_exclusive, min, ulong, false)
 RANGE_OP(scan_exclusive, min, float, true)
 RANGE_OP(scan_exclusive, min, double, true)
 /* scan_exclusive max */
+RANGE_OP(scan_exclusive, max, char, true)
+RANGE_OP(scan_exclusive, max, uchar, false)
+RANGE_OP(scan_exclusive, max, short, true)
+RANGE_OP(scan_exclusive, max, ushort, false)
 RANGE_OP(scan_exclusive, max, int, true)
 RANGE_OP(scan_exclusive, max, uint, false)
 RANGE_OP(scan_exclusive, max, long, true)
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index ba9f989..0c168cb 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -3976,8 +3976,8 @@ namespace gbe
          When we come to here, the global thread local vars should have all been
          allocated, so it's safe for us to steal a piece of SLM for this usage. */
 
-      // at most 64 thread for one subslice, along with extra padding
-      uint32_t mapSize = sizeof(uint32_t) * (64 + 4);
+      // at most 32 thread for one subslice x 4 bytes (qword), along with extra padding
+      uint32_t mapSize = sizeof(char) * (8 * 32);
       f.setUseSLM(true);
       uint32_t oldSlm = f.getSLMSize();
       f.setSLMSize(oldSlm + mapSize);
@@ -4010,6 +4010,7 @@ namespace gbe
       ConstantInt *sign = dyn_cast<ConstantInt>(AI);
       GBE_ASSERT(sign);
       bool isSign = sign->getZExtValue();
+      std::cout << "BOOL" << isSign << std::endl;
       AI++;
       ir::Type ty;
       if (isSign) {
@@ -4024,6 +4025,8 @@ namespace gbe
       src[1] = ir::ocl::threadid;
       src[2] = this->getRegister(*(AI++));
       const ir::Tuple srcTuple = ctx.arrayTuple(&src[0], 3);
+
+      std::cout << "VALUE LLVM " << ty << std::endl;
       ctx.WORKGROUP(opcode, (uint32_t)f.gettidMapSLM(), getRegister(&I), srcTuple, 3, ty);
     }
 
diff --git a/utests/compiler_workgroup_scan_exclusive.cpp b/utests/compiler_workgroup_scan_exclusive.cpp
index 9613140..1d24bc8 100644
--- a/utests/compiler_workgroup_scan_exclusive.cpp
+++ b/utests/compiler_workgroup_scan_exclusive.cpp
@@ -10,7 +10,7 @@
 using namespace std;
 
 /* set to 1 for debug, output of input-expected data */
-#define DEBUG_STDOUT    0
+#define DEBUG_STDOUT    1
 
 /* NDRANGE */
 #define WG_GLOBAL_SIZE  64
-- 
2.5.0



More information about the Beignet mailing list