summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYang Rong <rong.r.yang@intel.com>2017-01-05 13:29:44 +0800
committerYang Rong <rong.r.yang@intel.com>2017-01-06 18:17:05 +0800
commit09b8bcdebac1180db7a7b2f6e12459bf6f4fd256 (patch)
tree79b4d80ea0ef25e264f45d9769b1d1692d4bf0ff /src
parent416f022ef3ae48529fee4bd71026ed458e11ca62 (diff)
Runtime: Fix a event bug.
SVM enqueues need to call cl_event_exec every time. Signed-off-by: Yang Rong <rong.r.yang@intel.com> Reviewed-by: Junyan He <junyan.he@linux.intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/cl_api.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/cl_api.c b/src/cl_api.c
index 55cfd4e8..24b8b3d8 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -276,12 +276,17 @@ clEnqueueSVMFree (cl_command_queue command_queue,
data->size = num_svm_pointers;
data->ptr = user_data;
- if (e_status == CL_COMPLETE) { // No need to wait
+ if (e_status == CL_COMPLETE) {
+ // Sync mode, no need to queue event.
err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
if (err != CL_SUCCESS) {
break;
}
- } else { // May need to wait some event to complete.
+ } else {
+ err = cl_event_exec(e, CL_QUEUED, CL_FALSE);
+ if (err != CL_SUCCESS) {
+ break;
+ }
cl_command_queue_enqueue_event(command_queue, e);
}
} while (0);
@@ -417,12 +422,17 @@ 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
+ if (e_status == CL_COMPLETE) {
+ // Sync mode, no need to queue event.
err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
if (err != CL_SUCCESS) {
break;
}
- } else { // May need to wait some event to complete.
+ } else {
+ err = cl_event_exec(e, CL_QUEUED, CL_FALSE);
+ if (err != CL_SUCCESS) {
+ break;
+ }
cl_command_queue_enqueue_event(command_queue, e);
}
} while(0);
@@ -501,15 +511,19 @@ 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
+ if (e_status == CL_COMPLETE) {
+ // Sync mode, no need to queue event.
err = cl_event_exec(e, CL_COMPLETE, CL_FALSE);
if (err != CL_SUCCESS) {
break;
}
- } else { // May need to wait some event to complete.
+ } else {
+ err = cl_event_exec(e, CL_QUEUED, CL_FALSE);
+ if (err != CL_SUCCESS) {
+ break;
+ }
cl_command_queue_enqueue_event(command_queue, e);
}
-
} while(0);
if (err == CL_SUCCESS && event) {