diff options
author | Gil Pitney <gil.pitney@linaro.org> | 2015-04-10 00:25:46 +0000 |
---|---|---|
committer | Gil Pitney <gil.pitney@linaro.org> | 2015-04-10 00:25:46 +0000 |
commit | 6a94b46ff3cc78706cadf95a9d3f5adadb410c5d (patch) | |
tree | 54f7973f4e8bc3c8fce5e54722a423cf9b479b55 | |
parent | 07efdfd40f4d61801e46e2c733248759afe4ae8e (diff) |
Implementied clEnqueueBarrierWithWaitList(), and updated clEnqueueBarrier()
clEnqueueBarrierWithWaitList() is a new OpenCL v1.2 API, which adds
a list of dependent events to the barrier being enqueued.
The new API was also added to ICD table.
This commit allows the Khronos barrier event tests to PASS:
- % test_events event_enqueue_barrier_with_event_list
- % test_events out_of_order_event_enqueue_barrier_single_queue
Also, added the new API to the ICD table.
Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
-rw-r--r-- | src/api/api_enqueue.cpp | 43 | ||||
-rw-r--r-- | src/core/events.cpp | 7 | ||||
-rw-r--r-- | src/core/events.h | 2 | ||||
-rw-r--r-- | src/core/icd.cpp | 2 |
4 files changed, 38 insertions, 16 deletions
diff --git a/src/api/api_enqueue.cpp b/src/api/api_enqueue.cpp index ce47cc9..0e7e44f 100644 --- a/src/api/api_enqueue.cpp +++ b/src/api/api_enqueue.cpp @@ -782,21 +782,11 @@ clEnqueueWaitForEvents(cl_command_queue command_queue, cl_int clEnqueueBarrier(cl_command_queue command_queue) { - cl_int rs = CL_SUCCESS; - - if (!command_queue->isA(Coal::Object::T_CommandQueue)) - return CL_INVALID_COMMAND_QUEUE; - - Coal::BarrierEvent *command = new Coal::BarrierEvent( - (Coal::CommandQueue *)command_queue, &rs); + cl_int rs; - if (rs != CL_SUCCESS) - { - delete command; - return rs; - } + rs = clEnqueueBarrierWithWaitList(command_queue, 0, NULL, NULL); - return queueEvent(command_queue, command, 0, false); + return rs; } @@ -848,3 +838,30 @@ clEnqueueMarkerWithWaitList(cl_command_queue command_queue, return queueEvent(command_queue, command, event, false); } + + +cl_int +clEnqueueBarrierWithWaitList(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; + + 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. + + Coal::BarrierEvent *command = new Coal::BarrierEvent( + (Coal::CommandQueue *)command_queue, num_events_in_wait_list, + (const Coal::Event **)event_wait_list, &rs); + + if (rs != CL_SUCCESS) + { + delete command; + return rs; + } + + return queueEvent(command_queue, command, event, false); +} diff --git a/src/core/events.cpp b/src/core/events.cpp index 629a0c9..d454a33 100644 --- a/src/core/events.cpp +++ b/src/core/events.cpp @@ -1478,8 +1478,11 @@ Event::Type CopyBufferToImageEvent::type() const * Barrier */ -BarrierEvent::BarrierEvent(CommandQueue *parent, cl_int *errcode_ret) -: Event(parent, Queued, 0, 0, errcode_ret) +BarrierEvent::BarrierEvent(CommandQueue *parent, + cl_uint num_events_in_wait_list, + const Event **event_wait_list, + cl_int *errcode_ret) +: Event(parent, Queued, num_events_in_wait_list, event_wait_list, errcode_ret) {} Event::Type BarrierEvent::type() const diff --git a/src/core/events.h b/src/core/events.h index 2311d92..4d679f3 100644 --- a/src/core/events.h +++ b/src/core/events.h @@ -680,6 +680,8 @@ class BarrierEvent : public Event { public: BarrierEvent(CommandQueue *parent, + cl_uint num_events_in_wait_list, + const Event **event_wait_list, cl_int *errcode_ret); Type type() const; /*!< \brief Say the event is a \c Coal::Event::Barrier one */ diff --git a/src/core/icd.cpp b/src/core/icd.cpp index 0af7296..5c79d0e 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, // clEnqueueBarrierWithWaitList; (void *) clEnqueueMarkerWithWaitList, + (void *) clEnqueueBarrierWithWaitList, (void *) 0, // clGetExtensionFunctionAddressForPlatform; (void *) 0, // clCreateFromGLTexture; |