[Beignet] [PATCH] Fix a clEnqueueBarrierWithWaitList event status bug.
Yang Rong
rong.r.yang at intel.com
Sun Jun 15 23:28:25 PDT 2014
Event's status should be CL_COMPLETE if all wait events are complete in the wait list, in function
clEnqueueBarrierWithWaitList and clEnqueueMarkerWithWaitList.
Also delete the event if event have release before assign a new event.
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
src/cl_api.c | 7 +++++++
src/cl_event.c | 16 ++++++++++------
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/cl_api.c b/src/cl_api.c
index 7850793..275b0ac 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -2962,6 +2962,8 @@ clEnqueueMarker(cl_command_queue command_queue,
err = CL_INVALID_VALUE;
goto error;
}
+ if(IS_EVENT(*event))
+ cl_event_delete(*event);
cl_event_marker_with_wait_list(command_queue, 0, NULL, event);
error:
@@ -2980,6 +2982,9 @@ clEnqueueMarkerWithWaitList(cl_command_queue command_queue,
err = CL_INVALID_VALUE;
goto error;
}
+ if(IS_EVENT(*event))
+ cl_event_delete(*event);
+
TRY(cl_event_check_waitlist, num_events_in_wait_list, event_wait_list, event, command_queue->ctx);
cl_event_marker_with_wait_list(command_queue, num_events_in_wait_list, event_wait_list, event);
@@ -3021,6 +3026,8 @@ clEnqueueBarrierWithWaitList(cl_command_queue command_queue,
cl_int err = CL_SUCCESS;
CHECK_QUEUE(command_queue);
+ if(event && IS_EVENT(*event))
+ cl_event_delete(*event);
TRY(cl_event_check_waitlist, num_events_in_wait_list, event_wait_list, event, command_queue->ctx);
cl_event_barrier_with_wait_list(command_queue, num_events_in_wait_list, event_wait_list, event);
diff --git a/src/cl_event.c b/src/cl_event.c
index 5dccfd9..c93d245 100644
--- a/src/cl_event.c
+++ b/src/cl_event.c
@@ -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);
--
1.9.1
More information about the Beignet
mailing list