Skip to content

[SYCL][CUDA] Enable cuda_piEnqueueEventsWaitWithBarrier #3932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ pi_result cuda_piEnqueueEventsWait(pi_queue command_queue,
pi_uint32 num_events_in_wait_list,
const pi_event *event_wait_list,
pi_event *event);
pi_result cuda_piEnqueueEventsWaitWithBarrier(pi_queue command_queue,
pi_uint32 num_events_in_wait_list,
const pi_event *event_wait_list,
pi_event *event);
pi_result cuda_piEventRelease(pi_event event);
pi_result cuda_piEventRetain(pi_event event);

Expand Down Expand Up @@ -3279,11 +3283,33 @@ pi_result cuda_piEventRelease(pi_event event) {

/// Enqueues a wait on the given CUstream for all events.
/// See \ref enqueueEventWait
/// TODO: Add support for multiple streams once the Event class is properly
/// refactored.
///
pi_result cuda_piEnqueueEventsWait(pi_queue command_queue,
pi_uint32 num_events_in_wait_list,
const pi_event *event_wait_list,
pi_event *event) {
return cuda_piEnqueueEventsWaitWithBarrier(
command_queue, num_events_in_wait_list, event_wait_list, event);
}

/// Enqueues a wait on the given CUstream for all specified events (See
/// \ref enqueueEventWaitWithBarrier.) If the events list is empty, the enqueued
/// wait will wait on all previous events in the queue.
///
/// \param[in] command_queue A valid PI queue.
/// \param[in] num_events_in_wait_list Number of events in event_wait_list.
/// \param[in] event_wait_list Events to wait on.
/// \param[out] event Event for when all events in event_wait_list have finished
/// or, if event_wait_list is empty, when all previous events in the queue have
/// finished.
///
/// \return TBD
pi_result cuda_piEnqueueEventsWaitWithBarrier(pi_queue command_queue,
pi_uint32 num_events_in_wait_list,
const pi_event *event_wait_list,
pi_event *event) {
if (!command_queue) {
return PI_INVALID_QUEUE;
}
Expand Down Expand Up @@ -3317,26 +3343,6 @@ pi_result cuda_piEnqueueEventsWait(pi_queue command_queue,
}
}

/// Enqueues a wait on the given CUstream for all specified events (See
/// \ref enqueueEventWait.) If the events list is empty, the enqueued wait will
/// wait on all previous events in the queue.
/// TODO: Implement this.
///
/// \param[in] command_queue A valid PI queue.
/// \param[in] num_events_in_wait_list Number of events in event_wait_list.
/// \param[in] event_wait_list Events to wait on.
/// \param[out] event Event for when all events in event_wait_list have finished
/// or, if event_wait_list is empty, when all previous events in the queue have
/// finished.
///
/// \return TBD
pi_result cuda_piEnqueueEventsWaitWithBarrier(pi_queue, pi_uint32,
const pi_event *, pi_event *) {
cl::sycl::detail::pi::die(
"cuda_piEnqueueEventsWaitWithBarrier not implemented");
return {};
}

/// Gets the native CUDA handle of a PI event object
///
/// \param[in] event The PI event to get the native CUDA object of.
Expand Down