Skip to content
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

[SYCL] Add work-around for event leak in profiling tag #14985

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
10 changes: 8 additions & 2 deletions sycl/source/detail/scheduler/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3238,10 +3238,16 @@ ur_result_t ExecCGCommand::enqueueImpQueue() {
// If the queue is not in-order, we need to insert a barrier. This barrier
// does not need output events as it will implicitly enforce the following
// enqueue is blocked until it finishes.
if (!MQueue->isInOrder())
if (!MQueue->isInOrder()) {
// FIXME: Due to a bug in the L0 UR adapter, we will leak events if we do
// not pass an output event to the UR call. Once that is fixed,
// this immediately-deleted event can be removed.
ur_event_handle_t PreTimestampBarrierEvent{};
Plugin->call(urEnqueueEventsWaitWithBarrier, MQueue->getHandleRef(),
/*num_events_in_wait_list=*/0,
/*event_wait_list=*/nullptr, /*event=*/nullptr);
/*event_wait_list=*/nullptr, &PreTimestampBarrierEvent);
Plugin->call(urEventRelease, PreTimestampBarrierEvent);
}

Plugin->call(urEnqueueTimestampRecordingExp, MQueue->getHandleRef(),
/*blocking=*/false,
Expand Down
18 changes: 18 additions & 0 deletions sycl/test-e2e/ProfilingTag/profile_tag_leak.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// REQUIRES: level_zero

// RUN: %{build} -o %t.out
// RUN: %{l0_leak_check} %{run} %t.out 2>&1 | FileCheck %s --implicit-check-not=LEAK

// Regression test to avoid the reintroduction of a leak in L0 in the profiling
// tags when using barriers to ensure ordering on out-of-order queues.

#include <sycl/detail/core.hpp>
#include <sycl/ext/oneapi/experimental/profiling_tag.hpp>

int main() {
sycl::queue Queue;
sycl::event TagE =
sycl::ext::oneapi::experimental::submit_profiling_tag(Queue);
Queue.wait();
return 0;
}
Loading