Signed-off-by: Yang Rong <[email protected]>
---
 kernels/compiler_insert_vector.cl | 11 +++++++++++
 utests/CMakeLists.txt             |  1 +
 utests/compiler_insert_vector.cpp | 18 ++++++++++++++++++
 3 files changed, 30 insertions(+)
 create mode 100644 kernels/compiler_insert_vector.cl
 create mode 100644 utests/compiler_insert_vector.cpp

diff --git a/kernels/compiler_insert_vector.cl 
b/kernels/compiler_insert_vector.cl
new file mode 100644
index 0000000..0f0e20f
--- /dev/null
+++ b/kernels/compiler_insert_vector.cl
@@ -0,0 +1,11 @@
+__kernel void
+compiler_insert_vector(__global int4 *out )
+{
+    int tid = get_global_id(0);
+    int4 output = (int4)(0, 0, 0, 1); //black
+    if (tid > 16)
+    {
+        output = (int4)(tid, tid, 1, 1);
+    }
+    out[tid] = output;
+}
diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt
index daa4d6f..373f449 100644
--- a/utests/CMakeLists.txt
+++ b/utests/CMakeLists.txt
@@ -52,6 +52,7 @@ set (utests_sources
   compiler_if_else.cpp
   compiler_integer_division.cpp
   compiler_integer_remainder.cpp
+       compiler_insert_vector.cpp
   compiler_lower_return0.cpp
   compiler_lower_return1.cpp
   compiler_lower_return2.cpp
diff --git a/utests/compiler_insert_vector.cpp 
b/utests/compiler_insert_vector.cpp
new file mode 100644
index 0000000..c7c239f
--- /dev/null
+++ b/utests/compiler_insert_vector.cpp
@@ -0,0 +1,18 @@
+#include "utest_helper.hpp"
+
+void compiler_insert_vector(void)
+{
+  const size_t n = 2048;
+
+  // Setup kernel and buffers
+  OCL_CREATE_KERNEL("compiler_insert_vector");
+  OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(int) * 4, NULL);
+  OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
+
+  // Run the kernel
+  globals[0] = n;
+  locals[0] = 16;
+  OCL_NDRANGE(1);
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_insert_vector);
-- 
1.8.1.2

_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to