diff options
author | Ruiling Song <ruiling.song@intel.com> | 2013-09-11 15:22:04 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@linux.intel.com> | 2013-09-17 16:23:24 +0800 |
commit | c705a8f73787626ed810f52aa56e4798a84db6cf (patch) | |
tree | 62cc725de718e88a509a2654296283aca2459077 /utests/compiler_global_constant_2.cpp | |
parent | fd98654b20589eb942fe834fd735431a46f17b0e (diff) | |
download | beignet-c705a8f73787626ed810f52aa56e4798a84db6cf.tar.gz |
change constant test case to cover short/long type.
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/compiler_global_constant_2.cpp')
-rw-r--r-- | utests/compiler_global_constant_2.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/utests/compiler_global_constant_2.cpp b/utests/compiler_global_constant_2.cpp index 56fccb57..cbe63aec 100644 --- a/utests/compiler_global_constant_2.cpp +++ b/utests/compiler_global_constant_2.cpp @@ -23,8 +23,37 @@ void compiler_global_constant_2(void) // Check results OCL_MAP_BUFFER(0); for (uint32_t i = 0; i < n; ++i) +// std::cout << ((uint32_t *)buf_data[0])[i] << std::endl; OCL_ASSERT(((uint32_t *)buf_data[0])[i] == m[i%3] + t[i%5] + e + r); OCL_UNMAP_BUFFER(0); } +void compiler_global_constant_2_long(void) +{ + const size_t n = 2048; + const uint32_t e = 34, r = 77; + + // Setup kernel and buffers + OCL_CREATE_KERNEL_FROM_FILE("compiler_global_constant_2", "compiler_global_constant_2_long"); + OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(uint64_t), NULL); + OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]); + OCL_SET_ARG(1, sizeof(uint32_t), &e); + OCL_SET_ARG(2, sizeof(uint32_t), &r); + + // Run the kernel + globals[0] = n; + locals[0] = 16; + OCL_NDRANGE(1); + + uint64_t m[3] = {0x15b,0x25b,0xFFFFFFFFF}; + + // Check results + OCL_MAP_BUFFER(0); + for (uint32_t i = 0; i < n; ++i) +// std::cout << ((uint64_t *)buf_data[0])[i] << std::endl; + OCL_ASSERT(((uint64_t *)buf_data[0])[i] == m[i%3] + e + r); + OCL_UNMAP_BUFFER(0); +} + MAKE_UTEST_FROM_FUNCTION(compiler_global_constant_2); +MAKE_UTEST_FROM_FUNCTION(compiler_global_constant_2_long); |