diff options
author | Lu Guanqun <guanqun.lu@intel.com> | 2013-11-05 13:55:27 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2013-11-06 11:06:06 +0800 |
commit | 270bd283c26fa79d8ea3b714004d7f0bbe863465 (patch) | |
tree | f71ec7938b852f720ef156d469cda427822cfa08 /utests | |
parent | 7dcf5a6c052e2a5402e92809661a52dc30a9e8fa (diff) | |
download | beignet-270bd283c26fa79d8ea3b714004d7f0bbe863465.tar.gz |
utests: add test case for structure argument
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
Diffstat (limited to 'utests')
-rw-r--r-- | utests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | utests/compiler_function_argument3.cpp | 45 |
2 files changed, 46 insertions, 0 deletions
diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt index d25621f8..2be0c360 100644 --- a/utests/CMakeLists.txt +++ b/utests/CMakeLists.txt @@ -147,6 +147,7 @@ set (utests_sources compiler_long_asr.cpp compiler_long_mult.cpp compiler_long_cmp.cpp + compiler_function_argument3.cpp compiler_bool_cross_basic_block.cpp load_program_from_bin.cpp enqueue_copy_buf.cpp diff --git a/utests/compiler_function_argument3.cpp b/utests/compiler_function_argument3.cpp new file mode 100644 index 00000000..e9f5e809 --- /dev/null +++ b/utests/compiler_function_argument3.cpp @@ -0,0 +1,45 @@ +#include "utest_helper.hpp" + +struct sfloat8 { + float a; + float b; + float c; + float d; + float e; + float f; + float g; + float h; +}; + +void compiler_function_argument3(void) +{ + sfloat8 arg6; + + arg6.a = 3.0f; + arg6.h = 4.0f; + + // Setup kernel and buffers + OCL_CREATE_KERNEL("compiler_function_argument3"); + OCL_CREATE_BUFFER(buf[0], 0, sizeof(struct sfloat8) * 8, NULL); + + OCL_SET_ARG(0, sizeof(arg6), &arg6); + OCL_SET_ARG(1, sizeof(cl_mem), &buf[0]); + + // Run the kernel + globals[0] = 1; + locals[0] = 1; + OCL_NDRANGE(1); + + OCL_MAP_BUFFER(0); + + /* Check results */ + sfloat8 *dst = (sfloat8*)buf_data[0]; + + OCL_ASSERT(dst[0].a == 3.0f); + OCL_ASSERT(dst[0].b == 12.0f); + OCL_ASSERT(dst[0].h == 7.0f); + + OCL_UNMAP_BUFFER(0); +} + +MAKE_UTEST_FROM_FUNCTION(compiler_function_argument3); |