Skip to content

[SYCL][CUDA] Cleanup of profiling events #1956

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
Jul 6, 2020
Merged
Show file tree
Hide file tree
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
15 changes: 13 additions & 2 deletions sycl/plugins/cuda/pi_cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,18 @@ pi_result _pi_event::wait() {
return retErr;
}

pi_result _pi_event::release() {
assert(queue_ != nullptr);
PI_CHECK_ERROR(cuEventDestroy(evEnd_));

if (queue_->properties_ & PI_QUEUE_PROFILING_ENABLE) {
PI_CHECK_ERROR(cuEventDestroy(evQueued_));
PI_CHECK_ERROR(cuEventDestroy(evStart_));
}

return PI_SUCCESS;
}

// makes all future work submitted to queue wait for all work captured in event.
pi_result enqueueEventWait(pi_queue queue, pi_event event) {
// for native events, the cuStreamWaitEvent call is used.
Expand Down Expand Up @@ -2733,8 +2745,7 @@ pi_result cuda_piEventRelease(pi_event event) {
pi_result result = PI_INVALID_EVENT;
try {
ScopedContext active(event->get_context());
auto cuEvent = event->get();
result = PI_CHECK_ERROR(cuEventDestroy(cuEvent));
result = event->release();
} catch (...) {
result = PI_OUT_OF_RESOURCES;
}
Expand Down
2 changes: 2 additions & 0 deletions sycl/plugins/cuda/pi_cuda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ class _pi_event {
return new _pi_event(type, queue->get_context(), queue);
}

pi_result release();

~_pi_event();

private:
Expand Down