summaryrefslogtreecommitdiff
path: root/utests/compiler_global_constant_2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utests/compiler_global_constant_2.cpp')
-rw-r--r--utests/compiler_global_constant_2.cpp29
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);