add [opencl 1.2] API clEnqueueMarkerWithWaitList.
authorLuo <xionghu.luo@intel.com>
Fri, 13 Jun 2014 00:58:15 +0000 (08:58 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Fri, 13 Jun 2014 05:50:46 +0000 (13:50 +0800)
Reviewed-by: "Yang, Rong R" <rong.r.yang@intel.com>
src/cl_api.c
src/cl_event.c
src/cl_event.h

index 0e28f6b..b3e2fd5 100644 (file)
@@ -2725,8 +2725,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);
@@ -2735,7 +2735,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;
 }
index 2325675..26756ec 100644 (file)
@@ -459,14 +459,32 @@ 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;
+  cl_uint i = 0;
 
   *event = cl_event_new(queue->ctx, queue, CL_COMMAND_MARKER, CL_TRUE);
   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++) {
+    if(event_wait_list[i]->type==CL_COMMAND_USER) {
+      cl_command_queue_insert_event(queue, event_wait_list[i]);
+    }else if(event_wait_list[i]->enqueue_cb != NULL) {
+      user_event* user_events = event_wait_list[i]->enqueue_cb->wait_user_events;
+
+      while(user_events != NULL) {
+        cl_command_queue_insert_event(queue, user_events->event);
+        user_events = user_events->next;
+      }
+    }
+  }
+
   //if wait_events_num>0, the marker event need wait queue->wait_events
   if(queue->wait_events_num > 0) {
     data.type = EnqueueMarker;
index d864770..63ff983 100644 (file)
@@ -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);
 /*insert the user event*/