[Beignet] [PATCH 1/2] [OCL20] fix compiler_generic_atomic utest bug.

xionghu.luo at intel.com xionghu.luo at intel.com
Wed Mar 9 14:02:33 UTC 2016


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

should use opencl 2.0 API to test generic atomic, the atomic_fetch_add
will return the old value of the source pointer, so should move the src
data to dst with another instruction.
---
 kernels/compiler_generic_atomic.cl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernels/compiler_generic_atomic.cl b/kernels/compiler_generic_atomic.cl
index 63947ec..3db49e2 100644
--- a/kernels/compiler_generic_atomic.cl
+++ b/kernels/compiler_generic_atomic.cl
@@ -24,7 +24,8 @@ kernel void compiler_generic_atomic_##T(global T *src, global T *dst)  \
   generic T * q1 = &pdata[lid];                                        \
   generic T * q2 = &ldata[lid];                                        \
   generic T *q = (gid & 1) ? q1 : q2;                                  \
-  dst[gid] = atomic_add(q , pdata[lid]);                               \
+  atomic_fetch_add((atomic_int*)q , pdata[lid]);                       \
+  dst[gid] = *q;                                                       \
 }
 
 GENERIC_KERNEL(int)
-- 
2.1.4



More information about the Beignet mailing list