[Beignet] [PATCH] refine bswap utest to cover nsetc fail cases.

xionghu.luo at intel.com xionghu.luo at intel.com
Wed Dec 3 00:51:53 PST 2014


From: Luo Xionghu <xionghu.luo at intel.com>

two bswap call in one block would trigger nsetc failures.
the fail was fixed in backend already, just update the utest.

Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
 kernels/compiler_bswap.cl |    1 +
 utests/compiler_bswap.cpp |    7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/kernels/compiler_bswap.cl b/kernels/compiler_bswap.cl
index 9ef0e6b..97313b1 100644
--- a/kernels/compiler_bswap.cl
+++ b/kernels/compiler_bswap.cl
@@ -1,6 +1,7 @@
 #define TEST_TYPE(TYPE, LENGTH)                                       \
 kernel void compiler_bswap_##TYPE(global TYPE * src, global TYPE * dst){ \
    dst[get_global_id(0)]= __builtin_bswap##LENGTH(src[get_global_id(0)]); \
+   dst[get_global_id(0)]= __builtin_bswap##LENGTH(dst[get_global_id(0)] -1 ); \
 }
 
 
diff --git a/utests/compiler_bswap.cpp b/utests/compiler_bswap.cpp
index b5986b9..9475b99 100644
--- a/utests/compiler_bswap.cpp
+++ b/utests/compiler_bswap.cpp
@@ -85,6 +85,13 @@ void test(const char *kernel_name)
   for (int32_t i = 0; i < (int32_t) n; ++i)
     cpu(i, cpu_src, cpu_dst);
 
+  for (int32_t i = 0; i < (int32_t) n; ++i)
+    cpu_dst[i] = cpu_dst[i] -1;
+
+  // Run on CPU
+  for (int32_t i = 0; i < (int32_t) n; ++i)
+    cpu(i, cpu_dst, cpu_dst);
+
   OCL_MAP_BUFFER(1);
  // dump_data(cpu_src, cpu_dst, n);
 
-- 
1.7.9.5



More information about the Beignet mailing list