[Beignet] [PATCH] Add a test for vector argument deallocate assert.

Yang Rong rong.r.yang at intel.com
Sun Oct 20 22:05:18 PDT 2013


Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
 kernels/compiler_function_argument2.cl | 12 ++++++++++++
 utests/CMakeLists.txt                  |  1 +
 utests/compiler_function_argument2.cpp | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 kernels/compiler_function_argument2.cl
 create mode 100644 utests/compiler_function_argument2.cpp

diff --git a/kernels/compiler_function_argument2.cl b/kernels/compiler_function_argument2.cl
new file mode 100644
index 0000000..24e5795
--- /dev/null
+++ b/kernels/compiler_function_argument2.cl
@@ -0,0 +1,12 @@
+__kernel void compiler_function_argument2(
+char8 c, uchar8 uc, short8 s, ushort8 us, int8 i, uint8 ui, float8 f,
+__global float8 *result)
+{
+  result[0] = convert_float8(c);
+  result[1] = convert_float8(uc);
+  result[2] = convert_float8(s);
+  result[3] = convert_float8(us);
+  result[4] = convert_float8(i);
+  result[5] = convert_float8(ui);
+  result[6] = f;
+}
diff --git a/utests/CMakeLists.txt b/utests/CMakeLists.txt
index 373f449..37240fe 100644
--- a/utests/CMakeLists.txt
+++ b/utests/CMakeLists.txt
@@ -41,6 +41,7 @@ set (utests_sources
   compiler_fill_image_3d_2.cpp
   compiler_function_argument0.cpp
   compiler_function_argument1.cpp
+  compiler_function_argument2.cpp
   compiler_function_argument.cpp
   compiler_function_constant0.cpp
   compiler_function_constant1.cpp
diff --git a/utests/compiler_function_argument2.cpp b/utests/compiler_function_argument2.cpp
new file mode 100644
index 0000000..078566e
--- /dev/null
+++ b/utests/compiler_function_argument2.cpp
@@ -0,0 +1,32 @@
+#include "utest_helper.hpp"
+
+#define VECSIZE 8
+void compiler_function_argument2(void)
+{
+  const char arg0[8] = { 0 };
+  const unsigned char arg1[8] = { 0 };
+  const short arg2[8] = { 0 };
+  const unsigned short arg3[8] = { 0 };
+  const int arg4[8] = { 0 };
+  const unsigned int arg5[8] = { 0 };
+  const float arg6[8] = { 0 };
+
+  // Setup kernel and buffers
+  OCL_CREATE_KERNEL("compiler_function_argument2");
+  OCL_CREATE_BUFFER(buf[0], 0, sizeof(float) * 8, NULL);
+  OCL_SET_ARG(0, sizeof(arg0), arg0);
+  OCL_SET_ARG(1, sizeof(arg1), arg1);
+  OCL_SET_ARG(2, sizeof(arg2), arg2);
+  OCL_SET_ARG(3, sizeof(arg3), arg3);
+  OCL_SET_ARG(4, sizeof(arg4), arg4);
+  OCL_SET_ARG(5, sizeof(arg5), arg5);
+  OCL_SET_ARG(6, sizeof(arg6), arg6);
+  OCL_SET_ARG(7, sizeof(cl_mem), &buf[0]);
+
+  // Run the kernel
+  globals[0] = 1;
+  locals[0] = 1;
+  OCL_NDRANGE(1);
+}
+
+MAKE_UTEST_FROM_FUNCTION(compiler_function_argument2);
-- 
1.8.1.2



More information about the Beignet mailing list