[Beignet] [PATCH] Runtime: Fix a event bug.
Yang Rong
rong.r.yang at intel.com
Thu Jan 5 05:29:44 UTC 2017
SVM enqueues need to call cl_event_exec every time.
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
src/cl_api.c | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/src/cl_api.c b/src/cl_api.c
index 55cfd4e..b86f9bf 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -276,14 +276,12 @@ clEnqueueSVMFree (cl_command_queue command_queue,
data->size = num_svm_pointers;
data->ptr = user_data;
- if (e_status == CL_COMPLETE) { // No need to wait
- err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
- if (err != CL_SUCCESS) {
- break;
- }
- } else { // May need to wait some event to complete.
- cl_command_queue_enqueue_event(command_queue, e);
+ err = cl_event_exec(e, e_status == CL_COMPLETE ? CL_SUBMITTED : CL_QUEUED, CL_FALSE);
+ if (err != CL_SUCCESS) {
+ break;
}
+
+ cl_command_queue_enqueue_event(command_queue, e);
} while (0);
if (err == CL_SUCCESS && event) {
@@ -417,14 +415,12 @@ cl_int clEnqueueSVMMemcpy (cl_command_queue command_queue,
data->const_ptr = src_ptr;
data->size = size;
- if (e_status == CL_COMPLETE) { // No need to wait
- err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
- if (err != CL_SUCCESS) {
- break;
- }
- } else { // May need to wait some event to complete.
- cl_command_queue_enqueue_event(command_queue, e);
+ err = cl_event_exec(e, e_status == CL_COMPLETE ? CL_SUBMITTED : CL_QUEUED, CL_FALSE);
+ if (err != CL_SUCCESS) {
+ break;
}
+
+ cl_command_queue_enqueue_event(command_queue, e);
} while(0);
if (err == CL_SUCCESS && event) {
@@ -501,15 +497,12 @@ cl_int clEnqueueSVMMemFill (cl_command_queue command_queue,
data->pattern_size = pattern_size;
data->size = size;
- if (e_status == CL_COMPLETE) { // No need to wait
- err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
- if (err != CL_SUCCESS) {
- break;
- }
- } else { // May need to wait some event to complete.
- cl_command_queue_enqueue_event(command_queue, e);
+ err = cl_event_exec(e, e_status == CL_COMPLETE ? CL_SUBMITTED : CL_QUEUED, CL_FALSE);
+ if (err != CL_SUCCESS) {
+ break;
}
+ cl_command_queue_enqueue_event(command_queue, e);
} while(0);
if (err == CL_SUCCESS && event) {
--
2.1.4
More information about the Beignet
mailing list