diff options
author | Ruiling Song <ruiling.song@intel.com> | 2014-11-06 15:44:49 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-11-06 15:16:07 +0800 |
commit | 56aaa7ed21b653d39216caeafb7559fba20e86a8 (patch) | |
tree | b201a7e14cc61c8bd10fe895c19f74ceb3656bd4 /utests/runtime_set_kernel_arg.cpp | |
parent | 8b41bb61600aa725fa2c67b15845971e8e6dc465 (diff) | |
download | beignet-56aaa7ed21b653d39216caeafb7559fba20e86a8.tar.gz |
utests: add a test to trigger cl_float3 bug in clSetKernelArg.
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/runtime_set_kernel_arg.cpp')
-rw-r--r-- | utests/runtime_set_kernel_arg.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/utests/runtime_set_kernel_arg.cpp b/utests/runtime_set_kernel_arg.cpp new file mode 100644 index 00000000..d58c77e4 --- /dev/null +++ b/utests/runtime_set_kernel_arg.cpp @@ -0,0 +1,30 @@ +#include "utest_helper.hpp" + +void runtime_set_kernel_arg(void) +{ + const size_t n = 16; + + cl_float3 src; + src.s[0] = 1; src.s[1] =2; src.s[2] = 3; + + // Setup kernel and buffers + OCL_CREATE_KERNEL("set_kernel_arg"); + OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(uint32_t), NULL); + OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); + OCL_SET_ARG(1, sizeof(cl_float3), &src); + + // Run the kernel + globals[0] = n; + locals[0] = 16; + OCL_NDRANGE(1); + OCL_MAP_BUFFER(0); + + // Check results + for (uint32_t i = 0; i < n; ++i) { +// printf("%d %d\n",i, ((uint32_t*)buf_data[0])[i]); + OCL_ASSERT(((uint32_t*)buf_data[0])[i] == src.s[i%3]); + } + OCL_UNMAP_BUFFER(0); +} + +MAKE_UTEST_FROM_FUNCTION(runtime_set_kernel_arg); |