Skip to content

Commit 35729a7

Browse files
authored
[SYCL][CUDA] Don't enqueue an event wait on same CUDA stream (#5099)
This is a no-op as CUDA streams are 'in order'. This patch avoids small overhead associated with submitting the wait.
1 parent 86c4c15 commit 35729a7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,10 @@ pi_result enqueueEventWait(pi_queue queue, pi_event event) {
473473
// for native events, the cuStreamWaitEvent call is used.
474474
// This makes all future work submitted to stream wait for all
475475
// work captured in event.
476-
return PI_CHECK_ERROR(cuStreamWaitEvent(queue->get(), event->get(), 0));
476+
if (queue->get() != event->get_queue()->get()) {
477+
return PI_CHECK_ERROR(cuStreamWaitEvent(queue->get(), event->get(), 0));
478+
}
479+
return PI_SUCCESS;
477480
}
478481

479482
_pi_program::_pi_program(pi_context ctxt)

0 commit comments

Comments
 (0)