[Beignet] [PATCH 6/6 OpenCL-1.2] Add the test case for printf
junyan.he at inbox.com
junyan.he at inbox.com
Tue Jun 3 23:03:49 PDT 2014
From: Junyan He <junyan.he at linux.intel.com>
Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
kernels/test_printf.cl | 8 ++++++++
utests/CMakeLists.txt | 1 +
utests/test_printf.cpp | 14 ++++++++++++++
3 files changed, 23 insertions(+)
create mode 100644 kernels/test_printf.cl
create mode 100644 utests/test_printf.cpp
diff --git a/kernels/test_printf.cl b/kernels/test_printf.cl
new file mode 100644
index 0000000..6ab7385
--- /dev/null
+++ b/kernels/test_printf.cl
@@ -0,0 +1,8 @@
+__kernel void
+test_printf(void)
+{
+ int x = (int)get_global_id(0);
+
+ if (x % 15 == 0)
+ printf("######## global_id(0) = %d, global_size(0) = %d\n", x, get_global_size(0));
+}
diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt
index 698c9ff..7331d72 100644
--- a/utests/CMakeLists.txt
+++ b/utests/CMakeLists.txt
@@ -181,6 +181,7 @@ set (utests_sources
enqueue_copy_buf_unaligned.cpp
enqueue_fill_buf.cpp
enqueue_built_in_kernels.cpp
+ test_printf.cpp
image_1D_buffer.cpp
utest_assert.cpp
utest.cpp
diff --git a/utests/test_printf.cpp b/utests/test_printf.cpp
new file mode 100644
index 0000000..9a852ad
--- /dev/null
+++ b/utests/test_printf.cpp
@@ -0,0 +1,14 @@
+#include "utest_helper.hpp"
+
+void test_printf(void)
+{
+ // Setup kernel and buffers
+ OCL_CREATE_KERNEL("test_printf");
+ globals[0] = 16;
+ locals[0] = 16;
+
+ // Run the kernel on GPU
+ OCL_NDRANGE(1);
+}
+
+MAKE_UTEST_FROM_FUNCTION(test_printf);
--
1.8.3.2
More information about the Beignet
mailing list