Fix a clEnqueueBarrierWithWaitList event status bug.
authorYang Rong <rong.r.yang@intel.com>
Mon, 16 Jun 2014 08:20:08 +0000 (16:20 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Mon, 16 Jun 2014 07:05:52 +0000 (15:05 +0800)
Event's status should be CL_COMPLETE if all wait events are complete in the wait list, in function
clEnqueueBarrierWithWaitList and clEnqueueMarkerWithWaitList.

v2: revert delete the event change in v1.
Signed-off-by: Yang Rong <rong.r.yang@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
src/cl_event.c

index 5dccfd9..c93d245 100644 (file)
@@ -484,9 +484,11 @@ cl_int cl_event_marker_with_wait_list(cl_command_queue queue,
 //enqueues a marker command which waits for either a list of events to complete, or if the list is
 //empty it waits for all commands previously enqueued in command_queue to complete before it  completes.
   if(num_events_in_wait_list > 0){
-    data.type = EnqueueMarker;
-    cl_event_new_enqueue_callback(*event, &data, num_events_in_wait_list, event_wait_list);
-    return CL_SUCCESS;
+    if(cl_event_wait_events(num_events_in_wait_list, event_wait_list, queue) == CL_ENQUEUE_EXECUTE_DEFER) {
+      data.type = EnqueueMarker;
+      cl_event_new_enqueue_callback(*event, &data, num_events_in_wait_list, event_wait_list);
+      return CL_SUCCESS;
+    }
   } else if(queue->wait_events_num > 0) {
     data.type = EnqueueMarker;
     cl_event_new_enqueue_callback(*event, &data, queue->wait_events_num, queue->wait_events);
@@ -519,9 +521,11 @@ cl_int cl_event_barrier_with_wait_list(cl_command_queue queue,
 //enqueues a barrier command which waits for either a list of events to complete, or if the list is
 //empty it waits for all commands previously enqueued in command_queue to complete before it  completes.
   if(num_events_in_wait_list > 0){
-    data.type = EnqueueBarrier;
-    cl_event_new_enqueue_callback(e, &data, num_events_in_wait_list, event_wait_list);
-    return CL_SUCCESS;
+    if(cl_event_wait_events(num_events_in_wait_list, event_wait_list, queue) == CL_ENQUEUE_EXECUTE_DEFER) {
+      data.type = EnqueueBarrier;
+      cl_event_new_enqueue_callback(e, &data, num_events_in_wait_list, event_wait_list);
+      return CL_SUCCESS;
+    }
   } else if(queue->wait_events_num > 0) {
     data.type = EnqueueBarrier;
     cl_event_new_enqueue_callback(e, &data, queue->wait_events_num, queue->wait_events);