aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGil Pitney <gil.pitney@linaro.org>2015-04-09 23:02:52 +0000
committerGil Pitney <gil.pitney@linaro.org>2015-04-09 23:02:52 +0000
commit07efdfd40f4d61801e46e2c733248759afe4ae8e (patch)
treea3204ce86d2b763283a49a64665b3a50471b1896
parent51afeaaa461d5546f60002e0166a9dc9ea01254f (diff)
Implement clEnqueueMarkerWithWaitList(), and updated clEnqueueMarker()
clEnqueueMarkerWithWaitList() is a new OpenCL v1.2 API, which adds a list of dependent events to the marker being enqueued. Semantics of clEnqueueMarker() were also modified (error check) to the updated spec. The new API was also added to ICD table. This commit enables passing the following Khronos conformance tests: - % test_events event_enqueue_marker - % test_events event_enqueue_marker_with_event_list - % test_events out_of_order_event_enqueue_marker_single_queue - % test_events out_of_order_event_enqueue_marker_multi_queue - % test_events out_of_order_event_enqueue_marker_multi_queue_multi_device => PASSED (by default, since only one device). Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r--src/api/api_enqueue.cpp79
-rw-r--r--src/core/icd.cpp2
2 files changed, 54 insertions, 27 deletions
diff --git a/src/api/api_enqueue.cpp b/src/api/api_enqueue.cpp
index 5ed3b1a..ce47cc9 100644
--- a/src/api/api_enqueue.cpp
+++ b/src/api/api_enqueue.cpp
@@ -746,37 +746,14 @@ cl_int
clEnqueueMarker(cl_command_queue command_queue,
cl_event * event)
{
- cl_int rs = CL_SUCCESS;
-
- if (!command_queue->isA(Coal::Object::T_CommandQueue))
- return CL_INVALID_COMMAND_QUEUE;
+ cl_int rs;
if (!event)
return CL_INVALID_VALUE;
- // Get the events in command_queue
- unsigned int count;
- Coal::Event **events = command_queue->events(count, false);
-
- Coal::MarkerEvent *command = new Coal::MarkerEvent(
- (Coal::CommandQueue *)command_queue,
- count, count == 0 ? NULL : (const Coal::Event **)events, &rs);
-
- if (rs != CL_SUCCESS)
- {
- delete command;
- return rs;
- }
-
- // Free events, they were memcpyed by Coal::Event
- for (unsigned int i=0; i<count; ++i)
- {
- events[i]->dereference();
- }
-
- if (events != NULL) std::free(events);
+ rs = clEnqueueMarkerWithWaitList(command_queue, 0, NULL, event);
- return queueEvent(command_queue, command, event, false);
+ return rs;
}
cl_int
@@ -821,3 +798,53 @@ clEnqueueBarrier(cl_command_queue command_queue)
return queueEvent(command_queue, command, 0, false);
}
+
+
+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 rs = CL_SUCCESS;
+ unsigned int count;
+ Coal::Event **events;
+
+ if (!command_queue->isA(Coal::Object::T_CommandQueue))
+ return CL_INVALID_COMMAND_QUEUE;
+
+ // Note: CL_INVALID_EVENT_WAIT_LIST case is checked in Coal::Event constructor.
+
+ // Two cases to handle:
+ // 1) event_wait_list not proveded: the command waits on command_queue events;
+ // 2) event_wait_list provided: the command waits on provided wait_list events;
+
+ if (event_wait_list) {
+ count = num_events_in_wait_list;
+ events = (Coal::Event **)event_wait_list;
+ }
+ else {
+ // Get the events in command_queue
+ events = command_queue->events(count, false);
+ }
+
+ Coal::MarkerEvent *command = new Coal::MarkerEvent(
+ (Coal::CommandQueue *)command_queue, count, (const Coal::Event **)events, &rs);
+
+ if (rs != CL_SUCCESS)
+ {
+ delete command;
+ return rs;
+ }
+
+ if (!event_wait_list) {
+ // Free events, they were memcpyed by CommandQueue::events()
+ for (unsigned int i=0; i<count; ++i)
+ {
+ events[i]->dereference();
+ }
+ if (events != NULL) std::free(events);
+ }
+
+ return queueEvent(command_queue, command, event, false);
+}
diff --git a/src/core/icd.cpp b/src/core/icd.cpp
index 1d3cf4b..0af7296 100644
--- a/src/core/icd.cpp
+++ b/src/core/icd.cpp
@@ -136,8 +136,8 @@ void * dispatch_table[] =
(void *) 0, // clEnqueueFillBuffer;
(void *) 0, // clEnqueueFillImage;
(void *) 0, // clEnqueueMigrateMemObjects;
- (void *) 0, // clEnqueueMarkerWithWaitList;
(void *) 0, // clEnqueueBarrierWithWaitList;
+ (void *) clEnqueueMarkerWithWaitList,
(void *) 0, // clGetExtensionFunctionAddressForPlatform;
(void *) 0, // clCreateFromGLTexture;