[Beignet] [PATCH 8/9] Fix bugs in utest for event.

junyan.he at inbox.com junyan.he at inbox.com
Wed Sep 21 09:47:23 UTC 2016


From: Junyan He <junyan.he at intel.com>

The block api should make sure all its wait list
will become ready, or we will hang.

Signed-off-by: Junyan He <junyan.he at intel.com>
---
 utests/runtime_barrier_list.cpp | 11 +++++------
 utests/runtime_event.cpp        |  4 ++--
 utests/runtime_marker_list.cpp  | 13 ++++++-------
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/utests/runtime_barrier_list.cpp b/utests/runtime_barrier_list.cpp
index 3b8d3c3..7e12b66 100644
--- a/utests/runtime_barrier_list.cpp
+++ b/utests/runtime_barrier_list.cpp
@@ -23,7 +23,7 @@ void runtime_barrier_list(void)
 
   OCL_CREATE_USER_EVENT(ev[0]);
 
-  clEnqueueWriteBuffer(queue, buf[0], CL_TRUE, 0, BUFFERSIZE*sizeof(int), (void *)cpu_src, 1, &ev[0], &ev[1]);
+  clEnqueueWriteBuffer(queue, buf[0], CL_FALSE, 0, BUFFERSIZE*sizeof(int), (void *)cpu_src, 1, &ev[0], &ev[1]);
 
   OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
   OCL_SET_ARG(1, sizeof(int), &value);
@@ -40,23 +40,22 @@ void runtime_barrier_list(void)
   }
 
 
-  buf_data[0] = clEnqueueMapBuffer(queue, buf[0], CL_TRUE, 0, 0, BUFFERSIZE*sizeof(int), 1, &ev[2], NULL, NULL);
+  buf_data[0] = clEnqueueMapBuffer(queue, buf[0], CL_FALSE, 0, 0, BUFFERSIZE*sizeof(int), 1, &ev[2], NULL, NULL);
 
   clEnqueueBarrierWithWaitList(queue, 0, NULL, &ev[3]);
 
-  clEnqueueWriteBuffer(queue, buf[1], CL_TRUE, 0, BUFFERSIZE*sizeof(int), (void *)cpu_src_2, 0, NULL, &ev[4]);
+  clEnqueueWriteBuffer(queue, buf[1], CL_FALSE, 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);
 
+  OCL_FINISH();
+
   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);
diff --git a/utests/runtime_event.cpp b/utests/runtime_event.cpp
index 00e02f1..5804f95 100644
--- a/utests/runtime_event.cpp
+++ b/utests/runtime_event.cpp
@@ -18,7 +18,7 @@ void runtime_event(void)
 
   OCL_CREATE_USER_EVENT(ev[0]);
 
-  clEnqueueWriteBuffer(queue, buf[0], CL_TRUE, 0, BUFFERSIZE*sizeof(int), (void *)cpu_src, 1, &ev[0], &ev[1]);
+  clEnqueueWriteBuffer(queue, buf[0], CL_FALSE, 0, BUFFERSIZE*sizeof(int), (void *)cpu_src, 1, &ev[0], &ev[1]);
 
   OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
   OCL_SET_ARG(1, sizeof(int), &value);
@@ -33,7 +33,7 @@ void runtime_event(void)
     OCL_ASSERT(status >= CL_SUBMITTED);
   }
 
-  buf_data[0] = clEnqueueMapBuffer(queue, buf[0], CL_TRUE, 0, 0, BUFFERSIZE*sizeof(int), 1, &ev[2], NULL, NULL);
+  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);
 
diff --git a/utests/runtime_marker_list.cpp b/utests/runtime_marker_list.cpp
index 751f4a0..b4e6edb 100644
--- a/utests/runtime_marker_list.cpp
+++ b/utests/runtime_marker_list.cpp
@@ -23,7 +23,7 @@ void runtime_marker_list(void)
 
   OCL_CREATE_USER_EVENT(ev[0]);
 
-  clEnqueueWriteBuffer(queue, buf[0], CL_TRUE, 0, BUFFERSIZE*sizeof(int), (void *)cpu_src, 1, &ev[0], &ev[1]);
+  clEnqueueWriteBuffer(queue, buf[0], CL_FALSE, 0, BUFFERSIZE*sizeof(int), (void *)cpu_src, 1, &ev[0], &ev[1]);
 
   OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
   OCL_SET_ARG(1, sizeof(int), &value);
@@ -40,23 +40,22 @@ void runtime_marker_list(void)
   }
 
 
-  buf_data[0] = clEnqueueMapBuffer(queue, buf[0], CL_TRUE, 0, 0, BUFFERSIZE*sizeof(int), 1, &ev[2], NULL, NULL);
+  buf_data[0] = clEnqueueMapBuffer(queue, buf[0], CL_FALSE, 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]);
+  clEnqueueWriteBuffer(queue, buf[1], CL_FALSE, 0, BUFFERSIZE*sizeof(int), (void *)cpu_src_2, 1, &ev[3], &ev[4]);
 
-  OCL_FINISH();
   clGetEventInfo(ev[4], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(status), &status, NULL);
-  OCL_ASSERT(status == CL_COMPLETE);
+  OCL_ASSERT(status != CL_COMPLETE);
 
   OCL_SET_USER_EVENT_STATUS(ev[0], CL_COMPLETE);
 
+  OCL_FINISH();
+
   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);
-- 
2.7.4





More information about the Beignet mailing list