[Beignet] [PATCH] add OpenCL 1.2 API clEnqueueMarkerWithWaitList.

xionghu.luo at intel.com xionghu.luo at intel.com
Thu Apr 24 17:57:24 PDT 2014


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

---
 src/cl_api.c   | 23 ++++++++++++++++++++---
 src/cl_event.c | 10 +++++++++-
 src/cl_event.h |  2 +-
 3 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/src/cl_api.c b/src/cl_api.c
index 1543ff4..0f62cb5 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -2621,10 +2621,26 @@ clEnqueueNativeKernel(cl_command_queue   command_queue,
 error:
   return err;
 }
+clEnqueueMarker(cl_command_queue command_queue,
+    cl_event *event)
+{
+  cl_int err = CL_SUCCESS;
+  CHECK_QUEUE(command_queue);
+  if(event == NULL) {
+    err = CL_INVALID_VALUE;
+    goto error;
+  }
+
+  cl_event_marker_with_wait_list(command_queue, 0, NULL, event);
+error:
+  return err;
+}
 
 cl_int
-clEnqueueMarker(cl_command_queue     command_queue,
-                cl_event *           event)
+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);
@@ -2632,8 +2648,9 @@ clEnqueueMarker(cl_command_queue     command_queue,
     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(command_queue, event);
+  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 727ee1f..9d4e491 100644
--- a/src/cl_event.c
+++ b/src/cl_event.c
@@ -474,7 +474,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;
 
@@ -482,6 +485,11 @@ cl_int cl_event_marker(cl_command_queue queue, cl_event* event)
   if(event == NULL)
     return CL_OUT_OF_HOST_MEMORY;
 
+  //insert the input events to queue
+  for(i=0; i<num_events_in_wait_list; i++) {
+      cl_command_queue_insert_event(event_wait_list[i]);
+  }
+
   //if wait_events_num>0, the marker event need wait queue->wait_events
   if(queue->wait_events_num > 0) {
     data.type = EnqueueMarker;
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



More information about the Beignet mailing list