Skip to content

Commit 53f1cce

Browse files
authored
[SYCL][HIP] Enable hip_piEnqueueEventsWaitWithBarrier (#4975)
This patch enables piEnqueueEventsWaitWithBarrier for the HIP plugin, it brings it to the same level as the CUDA plugin, see #3932. This fixes the `llvm-test-suite`, `SYCL/Basic/submit_barrier.cpp`, `SYCL/Basic/enqueue_barrier.cpp` and `SYCL/Basic/barrier_order.cpp` tests for the HIP plugin.
1 parent 8d598e2 commit 53f1cce

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

sycl/plugins/hip/pi_hip.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,10 @@ pi_result hip_piEnqueueEventsWait(pi_queue command_queue,
365365
pi_uint32 num_events_in_wait_list,
366366
const pi_event *event_wait_list,
367367
pi_event *event);
368+
pi_result hip_piEnqueueEventsWaitWithBarrier(pi_queue command_queue,
369+
pi_uint32 num_events_in_wait_list,
370+
const pi_event *event_wait_list,
371+
pi_event *event);
368372
pi_result hip_piEventRelease(pi_event event);
369373
pi_result hip_piEventRetain(pi_event event);
370374

@@ -3436,13 +3440,30 @@ pi_result hip_piEventRelease(pi_event event) {
34363440
return PI_SUCCESS;
34373441
}
34383442

3439-
/// Enqueues a wait on the given CUstream for all events.
3443+
/// Enqueues a wait on the given queue for all events.
34403444
/// See \ref enqueueEventWait
34413445
///
3446+
/// Currently queues are represented by a single in-order stream, therefore
3447+
/// every command is an implicit barrier and so hip_piEnqueueEventsWait has the
3448+
/// same behavior as hip_piEnqueueEventsWaitWithBarrier. So
3449+
/// hip_piEnqueueEventsWait can just call hip_piEnqueueEventsWaitWithBarrier.
34423450
pi_result hip_piEnqueueEventsWait(pi_queue command_queue,
34433451
pi_uint32 num_events_in_wait_list,
34443452
const pi_event *event_wait_list,
34453453
pi_event *event) {
3454+
return hip_piEnqueueEventsWaitWithBarrier(
3455+
command_queue, num_events_in_wait_list, event_wait_list, event);
3456+
}
3457+
3458+
/// Enqueues a wait on the given queue for all specified events.
3459+
/// See \ref enqueueEventWaitWithBarrier
3460+
///
3461+
/// If the events list is empty, the enqueued wait will wait on all previous
3462+
/// events in the queue.
3463+
pi_result hip_piEnqueueEventsWaitWithBarrier(pi_queue command_queue,
3464+
pi_uint32 num_events_in_wait_list,
3465+
const pi_event *event_wait_list,
3466+
pi_event *event) {
34463467
if (!command_queue) {
34473468
return PI_INVALID_QUEUE;
34483469
}
@@ -4886,6 +4907,7 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
48864907
_PI_CL(piEnqueueKernelLaunch, hip_piEnqueueKernelLaunch)
48874908
_PI_CL(piEnqueueNativeKernel, hip_piEnqueueNativeKernel)
48884909
_PI_CL(piEnqueueEventsWait, hip_piEnqueueEventsWait)
4910+
_PI_CL(piEnqueueEventsWaitWithBarrier, hip_piEnqueueEventsWaitWithBarrier)
48894911
_PI_CL(piEnqueueMemBufferRead, hip_piEnqueueMemBufferRead)
48904912
_PI_CL(piEnqueueMemBufferReadRect, hip_piEnqueueMemBufferReadRect)
48914913
_PI_CL(piEnqueueMemBufferWrite, hip_piEnqueueMemBufferWrite)

0 commit comments

Comments
 (0)