Skip to content

Commit 2e97848

Browse files
author
Alexander Johnston
authored
[SYCL][CUDA] Enable cuda_piEnqueueEventsWaitWithBarrier (#3932)
Enable cuda_piEnqueueEventsWaitWithBarrier using cuda_piEnqueueEventsWait implementation and redirect cuda_piEnqueueEventsWait to cuda_piEnqueueEventsWaitWithBarrier until it can be implemented properly after multiple streams are supported properly after an Event class refactor. Signed-off-by: Alexander Johnston <alexander@codeplay.com>
1 parent eb6d098 commit 2e97848

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ pi_result cuda_piEnqueueEventsWait(pi_queue command_queue,
311311
pi_uint32 num_events_in_wait_list,
312312
const pi_event *event_wait_list,
313313
pi_event *event);
314+
pi_result cuda_piEnqueueEventsWaitWithBarrier(pi_queue command_queue,
315+
pi_uint32 num_events_in_wait_list,
316+
const pi_event *event_wait_list,
317+
pi_event *event);
314318
pi_result cuda_piEventRelease(pi_event event);
315319
pi_result cuda_piEventRetain(pi_event event);
316320

@@ -3279,11 +3283,33 @@ pi_result cuda_piEventRelease(pi_event event) {
32793283

32803284
/// Enqueues a wait on the given CUstream for all events.
32813285
/// See \ref enqueueEventWait
3286+
/// TODO: Add support for multiple streams once the Event class is properly
3287+
/// refactored.
32823288
///
32833289
pi_result cuda_piEnqueueEventsWait(pi_queue command_queue,
32843290
pi_uint32 num_events_in_wait_list,
32853291
const pi_event *event_wait_list,
32863292
pi_event *event) {
3293+
return cuda_piEnqueueEventsWaitWithBarrier(
3294+
command_queue, num_events_in_wait_list, event_wait_list, event);
3295+
}
3296+
3297+
/// Enqueues a wait on the given CUstream for all specified events (See
3298+
/// \ref enqueueEventWaitWithBarrier.) If the events list is empty, the enqueued
3299+
/// wait will wait on all previous events in the queue.
3300+
///
3301+
/// \param[in] command_queue A valid PI queue.
3302+
/// \param[in] num_events_in_wait_list Number of events in event_wait_list.
3303+
/// \param[in] event_wait_list Events to wait on.
3304+
/// \param[out] event Event for when all events in event_wait_list have finished
3305+
/// or, if event_wait_list is empty, when all previous events in the queue have
3306+
/// finished.
3307+
///
3308+
/// \return TBD
3309+
pi_result cuda_piEnqueueEventsWaitWithBarrier(pi_queue command_queue,
3310+
pi_uint32 num_events_in_wait_list,
3311+
const pi_event *event_wait_list,
3312+
pi_event *event) {
32873313
if (!command_queue) {
32883314
return PI_INVALID_QUEUE;
32893315
}
@@ -3317,26 +3343,6 @@ pi_result cuda_piEnqueueEventsWait(pi_queue command_queue,
33173343
}
33183344
}
33193345

3320-
/// Enqueues a wait on the given CUstream for all specified events (See
3321-
/// \ref enqueueEventWait.) If the events list is empty, the enqueued wait will
3322-
/// wait on all previous events in the queue.
3323-
/// TODO: Implement this.
3324-
///
3325-
/// \param[in] command_queue A valid PI queue.
3326-
/// \param[in] num_events_in_wait_list Number of events in event_wait_list.
3327-
/// \param[in] event_wait_list Events to wait on.
3328-
/// \param[out] event Event for when all events in event_wait_list have finished
3329-
/// or, if event_wait_list is empty, when all previous events in the queue have
3330-
/// finished.
3331-
///
3332-
/// \return TBD
3333-
pi_result cuda_piEnqueueEventsWaitWithBarrier(pi_queue, pi_uint32,
3334-
const pi_event *, pi_event *) {
3335-
cl::sycl::detail::pi::die(
3336-
"cuda_piEnqueueEventsWaitWithBarrier not implemented");
3337-
return {};
3338-
}
3339-
33403346
/// Gets the native CUDA handle of a PI event object
33413347
///
33423348
/// \param[in] event The PI event to get the native CUDA object of.

0 commit comments

Comments
 (0)