#include "utest_helper.hpp" #define BUFFERSIZE 32*1024 void runtime_event(void) { const size_t n = BUFFERSIZE; cl_int cpu_src[BUFFERSIZE]; cl_event ev[3]; 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); for(cl_uint i=0; i= CL_SUBMITTED); } buf_data[0] = clEnqueueMapBuffer(queue, buf[0], CL_FALSE, 0, 0, BUFFERSIZE*sizeof(int), 1, &ev[2], NULL, NULL); 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); } for (cl_uint i = 0; i != sizeof(ev) / sizeof(cl_event); ++i) { clReleaseEvent(ev[i]); } } MAKE_UTEST_FROM_FUNCTION(runtime_event);