Skip to content
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
15 changes: 6 additions & 9 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7486,9 +7486,8 @@ pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context,
// indirect access. This lock also protects access to the context's data
// structures. If indirect access tracking is not enabled then lock context
// mutex to protect access to context's data structures.
auto Lock = IndirectAccessTrackingEnabled
? std::scoped_lock(Plt->ContextsMutex)
: std::scoped_lock(Context->Mutex);
std::scoped_lock Lock(IndirectAccessTrackingEnabled ? Plt->ContextsMutex
: Context->Mutex);

if (IndirectAccessTrackingEnabled) {
// We are going to defer memory release if there are kernels with indirect
Expand Down Expand Up @@ -7729,9 +7728,8 @@ static pi_result USMFreeHelper(pi_context Context, void *Ptr,
pi_result piextUSMFree(pi_context Context, void *Ptr) {
pi_platform Plt = Context->getPlatform();

auto Lock = IndirectAccessTrackingEnabled
? std::scoped_lock(Plt->ContextsMutex)
: std::scoped_lock(Context->Mutex);
std::scoped_lock Lock(IndirectAccessTrackingEnabled ? Plt->ContextsMutex
: Context->Mutex);

return USMFreeHelper(Context, Ptr, true /* OwnZeMemHandle */);
}
Expand Down Expand Up @@ -8358,9 +8356,8 @@ pi_result _pi_buffer::free() {
break;
case allocation_t::free: {
pi_platform Plt = Context->getPlatform();
auto Lock = IndirectAccessTrackingEnabled
? std::scoped_lock(Plt->ContextsMutex)
: std::scoped_lock(Context->Mutex);
std::scoped_lock Lock(IndirectAccessTrackingEnabled ? Plt->ContextsMutex
: Context->Mutex);

PI_CALL(USMFreeHelper(Context, ZeHandle, true));
break;
Expand Down