summaryrefslogtreecommitdiff
path: root/utests/buildin_work_dim.cpp
diff options
context:
space:
mode:
authorYi Sun <yi.sun@intel.com>2013-06-04 17:34:30 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2013-06-05 10:56:37 +0800
commitcbb363aadb543a5c6dd41519787ec6dcd1bfeab9 (patch)
tree9df1262059c0e871d81c5212c9fa8f3e7dcdcd83 /utests/buildin_work_dim.cpp
parentb9686a0dd699fb4f33f4ed31c2d59a4c1b9560fe (diff)
downloadbeignet-cbb363aadb543a5c6dd41519787ec6dcd1bfeab9.tar.gz
utest: Add test case for build-in function get_work_dim
v2: Refine the case, verifying the result of function get_work_dim. v3: Since the 16 work group size limitation is fixed, re-side the global size and local size with 1. Signed-off-by: Yi Sun <yi.sun@intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'utests/buildin_work_dim.cpp')
-rw-r--r--utests/buildin_work_dim.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/utests/buildin_work_dim.cpp b/utests/buildin_work_dim.cpp
new file mode 100644
index 00000000..d678c0f0
--- /dev/null
+++ b/utests/buildin_work_dim.cpp
@@ -0,0 +1,37 @@
+#include "utest_helper.hpp"
+
+static void buildin_work_dim(void)
+{
+ // Setup kernel and buffers
+
+ int result, err;
+ OCL_CREATE_KERNEL("buildin_work_dim");
+
+ OCL_CREATE_BUFFER(buf[0], CL_MEM_READ_WRITE, sizeof(int), NULL);
+ OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
+
+ globals[0] = 1;
+ globals[1] = 1;
+ globals[2] = 1;
+ locals[0] = 1;
+ locals[1] = 1;
+ locals[2] = 1;
+
+ for( int i=1; i <= 3; i++ )
+ {
+
+ // Run the kernel
+ OCL_NDRANGE(i);
+
+ err = clEnqueueReadBuffer( queue, buf[0], CL_TRUE, 0, sizeof(int), &result, 0, NULL, NULL);
+ if (err != CL_SUCCESS)
+ {
+ printf("Error: Failed to read output array! %d\n", err);
+ exit(1);
+ }
+
+ OCL_ASSERT( result == i);
+ }
+}
+
+MAKE_UTEST_FROM_FUNCTION(buildin_work_dim);