[Beignet] [PATCH v4 2/2] add [opencl-1.2] API clEnqueueMarkerWithWaitList.

Luo, Xionghu xionghu.luo at intel.com
Tue Apr 29 23:58:53 PDT 2014


Hi ZhiGang,
Comments are below from the spec, please add it to the patch if push. Or should I generate another updated patch?
Thanks

This API 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. 
This command returns an event which can be waited on, i.e. this event can be waited
on to insure that all events either in the event_wait_list or all previously enqueued commands,
queued before this command to command_queue, have completed.

Luo Xionghu
Best Regards


-----Original Message-----
From: Yang, Rong R 
Sent: Wednesday, April 30, 2014 2:52 PM
To: Luo, Xionghu; beignet at lists.freedesktop.org
Cc: Luo, Xionghu
Subject: RE: [Beignet] [PATCH v4 2/2] add [opencl-1.2] API clEnqueueMarkerWithWaitList.

LGTM.

BTW, it is better to add some comments rather than title only.

-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of xionghu.luo at intel.com
Sent: Wednesday, April 30, 2014 9:48 AM
To: beignet at lists.freedesktop.org
Cc: Luo, Xionghu
Subject: [Beignet] [PATCH v4 2/2] add [opencl-1.2] API clEnqueueMarkerWithWaitList.

From: Luo <xionghu.luo at intel.com>

---
 src/cl_api.c   | 25 ++++++++++++++++++++++---
 src/cl_event.c | 14 +++++++++++---
 src/cl_event.h |  2 +-
 3 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/src/cl_api.c b/src/cl_api.c index 1543ff4..de67f01 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -2623,8 +2623,8 @@ error:
 }
 
 cl_int
-clEnqueueMarker(cl_command_queue     command_queue,
-                cl_event *           event)
+clEnqueueMarker(cl_command_queue command_queue,
+    cl_event *event)
 {
   cl_int err = CL_SUCCESS;
   CHECK_QUEUE(command_queue);
@@ -2633,7 +2633,26 @@ clEnqueueMarker(cl_command_queue     command_queue,
     goto error;
   }
 
-  cl_event_marker(command_queue, event);
+  cl_event_marker_with_wait_list(command_queue, 0, NULL, event);
+error:
+  return err;
+}
+
+cl_int
+clEnqueueMarkerWithWaitList(cl_command_queue command_queue,
+    cl_uint num_events_in_wait_list,
+    const cl_event *event_wait_list,
+    cl_event *event)
+{
+  cl_int err = CL_SUCCESS;
+  CHECK_QUEUE(command_queue);
+  if(event == NULL) {
+    err = CL_INVALID_VALUE;
+    goto error;
+  }
+  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);
 error:
   return err;
 }
diff --git a/src/cl_event.c b/src/cl_event.c index 9d21984..49dd423 100644
--- a/src/cl_event.c
+++ b/src/cl_event.c
@@ -486,7 +486,10 @@ void cl_event_update_status(cl_event event)
     cl_event_set_status(event, CL_COMPLETE);  }
 
-cl_int cl_event_marker(cl_command_queue queue, cl_event* event)
+cl_int cl_event_marker_with_wait_list(cl_command_queue queue,
+                cl_uint num_events_in_wait_list,
+                const cl_event *event_wait_list,
+                cl_event* event)
 {
   enqueue_data data;
 
@@ -494,8 +497,13 @@ cl_int cl_event_marker(cl_command_queue queue, cl_event* event)
   if(event == NULL)
     return CL_OUT_OF_HOST_MEMORY;
 
-  //if wait_events_num>0, the marker event need wait queue->wait_events
-  if(queue->wait_events_num > 0) {
+  //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;
+  } else if(queue->wait_events_num > 0) {
     data.type = EnqueueMarker;
     cl_event_new_enqueue_callback(*event, &data, queue->wait_events_num, queue->wait_events);
     return CL_SUCCESS;
diff --git a/src/cl_event.h b/src/cl_event.h index 3c61110..5a78a8d 100644
--- a/src/cl_event.h
+++ b/src/cl_event.h
@@ -90,7 +90,7 @@ void cl_event_set_status(cl_event, cl_int);
 /* Check and update event status */
 void cl_event_update_status(cl_event);
 /* Create the marker event */
-cl_int cl_event_marker(cl_command_queue, cl_event*);
+cl_int cl_event_marker_with_wait_list(cl_command_queue, cl_uint, const 
+cl_event *,  cl_event*);
 /* Do the event profiling */
 cl_int cl_event_get_timestamp(cl_event event, cl_profiling_info param_name);  #endif /* __CL_EVENT_H__ */
--
1.8.1.2

_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list