From 1c4904c45b348c82d9befa40d7bbca0c7185cf98 Mon Sep 17 00:00:00 2001 From: Luo Date: Fri, 13 Jun 2014 11:17:35 +0800 Subject: add test case runtime_barrier_list and runtime_marker_list. Reviewed-by: "Yang, Rong R" Signed-off-by: Luo Conflicts: utests/CMakeLists.txt --- utests/runtime_marker_list.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 utests/runtime_marker_list.cpp (limited to 'utests/runtime_marker_list.cpp') diff --git a/utests/runtime_marker_list.cpp b/utests/runtime_marker_list.cpp new file mode 100644 index 00000000..fc771569 --- /dev/null +++ b/utests/runtime_marker_list.cpp @@ -0,0 +1,75 @@ +#include "utest_helper.hpp" + +#define BUFFERSIZE 32*1024 +void runtime_marker_list(void) +{ + const size_t n = BUFFERSIZE; + cl_int cpu_src[BUFFERSIZE]; + cl_int cpu_src_2[BUFFERSIZE]; + cl_event ev[5]; + cl_int status = 0; + cl_int value = 34; + + // Setup kernel and buffers + OCL_CREATE_KERNEL("compiler_event"); + OCL_CREATE_BUFFER(buf[0], 0, BUFFERSIZE*sizeof(int), NULL); + OCL_CREATE_BUFFER(buf[1], 0, BUFFERSIZE*sizeof(int), NULL); + + for(cl_uint i=0; i= CL_SUBMITTED); + } + + + buf_data[0] = clEnqueueMapBuffer(queue, buf[0], CL_TRUE, 0, 0, BUFFERSIZE*sizeof(int), 1, &ev[2], NULL, NULL); + + clEnqueueMarkerWithWaitList(queue, 0, NULL, &ev[3]); + + clEnqueueWriteBuffer(queue, buf[1], CL_TRUE, 0, BUFFERSIZE*sizeof(int), (void *)cpu_src_2, 0, NULL, &ev[4]); + + OCL_FINISH(); + clGetEventInfo(ev[4], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(status), &status, NULL); + OCL_ASSERT(status == CL_COMPLETE); + + OCL_SET_USER_EVENT_STATUS(ev[0], CL_COMPLETE); + + clGetEventInfo(ev[0], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(status), &status, NULL); + OCL_ASSERT(status == CL_COMPLETE); + + OCL_FINISH(); + + for (cl_uint i = 0; i != sizeof(ev) / sizeof(cl_event); ++i) { + clGetEventInfo(ev[i], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(status), &status, NULL); + OCL_ASSERT(status <= CL_COMPLETE); + } + + for (uint32_t i = 0; i < n; ++i) { + OCL_ASSERT(((int*)buf_data[0])[i] == (int)value + 0x3); + } + clEnqueueUnmapMemObject(queue, buf[0], buf_data[0], 0, NULL, NULL); + + for (cl_uint i = 0; i != sizeof(ev) / sizeof(cl_event); ++i) { + clReleaseEvent(ev[i]); + } +} + +MAKE_UTEST_FROM_FUNCTION(runtime_marker_list); -- cgit v1.2.1