[Beignet] [PATCH] Clear atomic dst buffer to fix atomic random fail.
Yang Rong
rong.r.yang at intel.com
Sun Jun 30 22:38:48 PDT 2013
Because atomic's address used as src and dst, so need to clear this address.
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
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 <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;
--
1.7.10.4
More information about the Beignet
mailing list