summaryrefslogtreecommitdiff
path: root/utests/compiler_atomic_functions.cpp
diff options
context:
space:
mode:
authorYang Rong <rong.r.yang@intel.com>2013-07-01 13:38:48 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-07-01 16:50:38 +0800
commitfb3600f82d046ba4cce3b76d3f04f7ae653cc6df (patch)
treeae6ddc930832e39f4be39b1ecf69a262233b222c /utests/compiler_atomic_functions.cpp
parentc14d3d4a44980566e17a8db2224dfee059287dfc (diff)
downloadbeignet-fb3600f82d046ba4cce3b76d3f04f7ae653cc6df.tar.gz
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 <rong.r.yang@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/compiler_atomic_functions.cpp')
-rw-r--r--utests/compiler_atomic_functions.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/utests/compiler_atomic_functions.cpp b/utests/compiler_atomic_functions.cpp
index 71e8384c..571e0c67 100644
--- a/utests/compiler_atomic_functions.cpp
+++ b/utests/compiler_atomic_functions.cpp
@@ -1,6 +1,7 @@
#include "utest_helper.hpp"
#include <cmath>
#include <algorithm>
+#include <string.h>
#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;