From fb3600f82d046ba4cce3b76d3f04f7ae653cc6df Mon Sep 17 00:00:00 2001 From: Yang Rong Date: Mon, 1 Jul 2013 13:38:48 +0800 Subject: [PATCH] Clear atomic dst buffer to fix atomic random fail. Because atomic's address used as src and dst, so need to clear this address. Signed-off-by: Yang Rong Reviewed-by: Zhigang Gong --- utests/compiler_atomic_functions.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utests/compiler_atomic_functions.cpp b/utests/compiler_atomic_functions.cpp index 71e8384..571e0c6 100644 --- a/utests/compiler_atomic_functions.cpp +++ b/utests/compiler_atomic_functions.cpp @@ -1,6 +1,7 @@ #include "utest_helper.hpp" #include #include +#include #define GROUP_NUM 16 #define LOCAL_SIZE 64 @@ -71,6 +72,10 @@ static void compiler_atomic_functions(void) OCL_SET_ARG(1, 16 * sizeof(int), NULL); OCL_SET_ARG(2, sizeof(cl_mem), &buf[1]); + OCL_MAP_BUFFER(0); + memset(buf_data[0], 0, 16 * sizeof(int)); + OCL_UNMAP_BUFFER(0); + OCL_MAP_BUFFER(1); for (uint32_t i = 0; i < locals[0]; ++i) cpu_src[i] = ((int*)buf_data[1])[i] = rand() & 0xff; -- 2.7.4