diff options
author | Guo Yejun <yejun.guo@intel.com> | 2015-05-12 16:28:11 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2015-05-12 17:20:01 +0800 |
commit | e8a7f0e248bdb0a2e579535fc8fd09ae2cc3c3a5 (patch) | |
tree | 274f9f95b22a62ba51e9ad16b312682dcc5d9bf2 /utests/compiler_sub_group_any.cpp | |
parent | 7179227e123b028cb9e63eb8d9eb97af0fa4be38 (diff) |
rename __gen_ocl_simd_any/all to sub_group_any/all
it is defined in https://www.khronos.org/registry/cl/extensions/intel/cl_intel_subgroups.txt
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/compiler_sub_group_any.cpp')
-rw-r--r-- | utests/compiler_sub_group_any.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/utests/compiler_sub_group_any.cpp b/utests/compiler_sub_group_any.cpp new file mode 100644 index 00000000..98b1bdd4 --- /dev/null +++ b/utests/compiler_sub_group_any.cpp @@ -0,0 +1,43 @@ +#include "utest_helper.hpp" + +void compiler_sub_group_any(void) +{ + const size_t n = 40; + + // Setup kernel and buffers + OCL_CREATE_KERNEL("compiler_sub_group_any"); + OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(int), NULL); + OCL_CREATE_BUFFER(buf[1], 0, n * sizeof(int), NULL); + OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); + OCL_SET_ARG(1, sizeof(cl_mem), &buf[1]); + + globals[0] = n; + locals[0] = 10; + + OCL_MAP_BUFFER(0); + for (int32_t i = 0; i < (int32_t) n; ++i) + ((int*)buf_data[0])[i] = i; + OCL_UNMAP_BUFFER(0); + + // Run the kernel on GPU + OCL_NDRANGE(1); + + // Run on CPU + + // Compare + OCL_MAP_BUFFER(1); + for (int32_t i = 0; i < (int32_t) n; ++i){ + //printf("%d %d\n", i, ((int *)buf_data[1])[i]); + if (i % 2 == 1) { + if (i < (int32_t)locals[0]) + OCL_ASSERT(((int *)buf_data[1])[i] == 1); + else + OCL_ASSERT(((int *)buf_data[1])[i] == 2); + } + else + OCL_ASSERT(((int *)buf_data[1])[i] == 3); + } + OCL_UNMAP_BUFFER(1); +} + +MAKE_UTEST_FROM_FUNCTION(compiler_sub_group_any); |