aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGil Pitney <gil.pitney@linaro.org>2015-04-16 02:02:22 +0000
committerGil Pitney <gil.pitney@linaro.org>2015-04-16 02:02:22 +0000
commit3f9e40056b9c28398d5c55eb89762e56c58307e3 (patch)
treeed0da7457da8bebdae57240bed0cf2299fb942f2
parent0298b47d4e665062a5bbb4ba8361ee82a4da3e55 (diff)
Updated callback handling for events to notify on Submitted, Running states
The v1.2 spec updates clSetEventCallback() to add notifications on CL_SUBMITTED and CL_RUNNING states. Updated worker thread to set CL_RUNNING status on the event when it starts. Updated clSetEventCallback() to allow CL_SUBMITTED and CL_RUNNING states. Updated test commandqueue to remove failure check for CL_SUBMITTED state. This change allows the following Khronos v1.2 tests to PASS: % test_events callbacks % test_events callback_simultaneous Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r--src/api/api_event.cpp5
-rw-r--r--src/core/commandqueue.cpp1
-rw-r--r--src/core/cpu/worker.cpp1
-rw-r--r--tests/test_commandqueue.cpp6
4 files changed, 5 insertions, 8 deletions
diff --git a/src/api/api_event.cpp b/src/api/api_event.cpp
index 52a1f62..d76f6bb 100644
--- a/src/api/api_event.cpp
+++ b/src/api/api_event.cpp
@@ -110,7 +110,10 @@ clSetEventCallback(cl_event event,
if (!event->isA(Coal::Object::T_Event))
return CL_INVALID_EVENT;
- if (!pfn_event_notify || command_exec_callback_type != CL_COMPLETE)
+ if (!pfn_event_notify ||
+ !((command_exec_callback_type == CL_SUBMITTED) ||
+ (command_exec_callback_type == CL_RUNNING) ||
+ (command_exec_callback_type == CL_COMPLETE)))
return CL_INVALID_VALUE;
event->setCallback(command_exec_callback_type, pfn_event_notify, user_data);
diff --git a/src/core/commandqueue.cpp b/src/core/commandqueue.cpp
index d0dcd65..ae5c526 100644
--- a/src/core/commandqueue.cpp
+++ b/src/core/commandqueue.cpp
@@ -684,7 +684,6 @@ int Event::setStatusHelper(Status status)
std::multimap<Status, CallbackData>::const_iterator it;
std::pair<std::multimap<Status, CallbackData>::const_iterator,
std::multimap<Status, CallbackData>::const_iterator> ret;
- // GP: TODO: This needs to find status < 0 too, I think.
ret = p_callbacks.equal_range(status > 0 ? status : CL_COMPLETE);
for (it=ret.first; it!=ret.second; ++it)
callbacks.push_back((*it).second);
diff --git a/src/core/cpu/worker.cpp b/src/core/cpu/worker.cpp
index aa04182..64d422b 100644
--- a/src/core/cpu/worker.cpp
+++ b/src/core/cpu/worker.cpp
@@ -84,6 +84,7 @@ void *worker(void *data)
event->updateTiming(Event::Start);
// Execute the action
+ event->setStatus(CL_RUNNING);
switch (t)
{
case Event::ReadBuffer:
diff --git a/tests/test_commandqueue.cpp b/tests/test_commandqueue.cpp
index 0119ec5..411e3ae 100644
--- a/tests/test_commandqueue.cpp
+++ b/tests/test_commandqueue.cpp
@@ -273,12 +273,6 @@ START_TEST (test_events)
"cannot enqueue an asynchronous write buffer command"
);
- result = clSetEventCallback(write_event, CL_SUBMITTED, &event_notify, &good);
- fail_if(
- result != CL_INVALID_VALUE,
- "callback_type must be CL_COMPLETE in OpenCL 1.1"
- );
-
result = clSetEventCallback(write_event, CL_COMPLETE, &event_notify, &good);
fail_if(
result != CL_COMPLETE,