[Beignet] [PATCH] Runtime: fix a profiling fail.

Yang Rong rong.r.yang at intel.com
Fri Dec 30 09:54:04 UTC 2016


cl_event_exec it the uniformal entry for all event command execution,
call cl_enqueue_handle may miss time stamp record.
Replace all cl_enqueue_handle to cl_event_exec.

Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
 src/cl_api.c        | 18 +++---------------
 src/cl_api_event.c  |  8 ++------
 src/cl_api_kernel.c |  3 +--
 3 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/src/cl_api.c b/src/cl_api.c
index 51b0c67..55cfd4e 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -277,14 +277,10 @@ clEnqueueSVMFree (cl_command_queue command_queue,
     data->ptr       = user_data;
 
     if (e_status == CL_COMPLETE) { // No need to wait
-      err = cl_enqueue_handle(data, CL_COMPLETE);
+      err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
       if (err != CL_SUCCESS) {
-        assert(err < 0);
-        e->status = err;
         break;
       }
-
-      e->status = CL_COMPLETE;
     } else { // May need to wait some event to complete.
       cl_command_queue_enqueue_event(command_queue, e);
     }
@@ -422,14 +418,10 @@ cl_int clEnqueueSVMMemcpy (cl_command_queue command_queue,
     data->size         = size;
 
     if (e_status == CL_COMPLETE) { // No need to wait
-      err = cl_enqueue_handle(data, CL_COMPLETE);
+      err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
       if (err != CL_SUCCESS) {
-        assert(err < 0);
-        e->status = err;
         break;
       }
-
-      e->status = CL_COMPLETE;
     } else { // May need to wait some event to complete.
       cl_command_queue_enqueue_event(command_queue, e);
     }
@@ -510,14 +502,10 @@ cl_int clEnqueueSVMMemFill (cl_command_queue command_queue,
     data->size         = size;
 
     if (e_status == CL_COMPLETE) { // No need to wait
-      err = cl_enqueue_handle(data, CL_COMPLETE);
+      err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
       if (err != CL_SUCCESS) {
-        assert(err < 0);
-        e->status = err;
         break;
       }
-
-      e->status = CL_COMPLETE;
     } else { // May need to wait some event to complete.
       cl_command_queue_enqueue_event(command_queue, e);
     }
diff --git a/src/cl_api_event.c b/src/cl_api_event.c
index af1442a..9207021 100644
--- a/src/cl_api_event.c
+++ b/src/cl_api_event.c
@@ -105,12 +105,10 @@ clEnqueueMarkerWithWaitList(cl_command_queue command_queue,
       err = CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
       break;
     } else if (e_status == CL_COMPLETE) {
-      err = cl_enqueue_handle(&e->exec_data, CL_COMPLETE);
+      err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
       if (err != CL_SUCCESS) {
         break;
       }
-
-      e->status = CL_COMPLETE;
     } else {
       cl_command_queue_enqueue_event(command_queue, e);
     }
@@ -164,12 +162,10 @@ clEnqueueBarrierWithWaitList(cl_command_queue command_queue,
       err = CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
       break;
     } else if (e_status == CL_COMPLETE) {
-      err = cl_enqueue_handle(&e->exec_data, CL_COMPLETE);
+      err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
       if (err != CL_SUCCESS) {
         break;
       }
-
-      e->status = CL_COMPLETE;
       /* Already a completed barrier, no need to insert to queue. */
     } else {
       cl_command_queue_insert_barrier_event(command_queue, e);
diff --git a/src/cl_api_kernel.c b/src/cl_api_kernel.c
index 7799ecb..863b47f 100644
--- a/src/cl_api_kernel.c
+++ b/src/cl_api_kernel.c
@@ -266,11 +266,10 @@ clEnqueueNDRangeKernel(cl_command_queue command_queue,
             err = CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
             break;
           } else if (event_status == CL_COMPLETE) {
-            err = cl_enqueue_handle(&e->exec_data, CL_SUBMITTED);
+            err = cl_event_exec(e, CL_SUBMITTED, CL_FALSE);
             if (err != CL_SUCCESS) {
               break;
             }
-            e->status = CL_SUBMITTED;
           }
 
           cl_command_queue_enqueue_event(command_queue, e);
-- 
2.1.4



More information about the Beignet mailing list