diff options
author | Dag Lem <dag@nimrod.no> | 2013-06-10 08:55:48 +0200 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@linux.intel.com> | 2013-06-14 17:00:20 +0800 |
commit | 018c62908da4cea499477d166f302da28d4fb31d (patch) | |
tree | 318ad683b3f549fa0f17f962a13b490e6214d094 /utests/compiler_global_memory_barrier.cpp | |
parent | 25688346b4f7015f415a3e88ad24eb573250abec (diff) | |
download | beignet-018c62908da4cea499477d166f302da28d4fb31d.tar.gz |
utests: Add test case for global memory barrier
Disable this test case currently, as we don't support
global memory barrier now.
Signed-off-by: Dag Lem <dag@nimrod.no>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/compiler_global_memory_barrier.cpp')
-rw-r--r-- | utests/compiler_global_memory_barrier.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/utests/compiler_global_memory_barrier.cpp b/utests/compiler_global_memory_barrier.cpp new file mode 100644 index 00000000..a6496a78 --- /dev/null +++ b/utests/compiler_global_memory_barrier.cpp @@ -0,0 +1,28 @@ +#include "utest_helper.hpp" + +static void compiler_global_memory_barrier(void) +{ + const size_t n = 16*1024; + + // Setup kernel and buffers + OCL_CREATE_KERNEL("compiler_global_memory_barrier"); + OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(uint32_t), NULL); + OCL_CREATE_BUFFER(buf[1], 0, n * sizeof(uint32_t), NULL); + OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); + OCL_SET_ARG(1, sizeof(cl_mem), &buf[1]); + + // Run the kernel + globals[0] = n/2; + locals[0] = 32; + OCL_NDRANGE(1); + OCL_MAP_BUFFER(0); + + // Check results + uint32_t *dst = (uint32_t*)buf_data[0]; + for (uint32_t i = 0; i < n; i+=locals[0]) + for (uint32_t j = 0; j < locals[0]; ++j) + OCL_ASSERT(dst[i+j] == locals[0] - 1 -j); + OCL_UNMAP_BUFFER(0); +} + +MAKE_UTEST_FROM_FUNCTION(compiler_global_memory_barrier); |