Skip to content

Commit 81a80f1

Browse files
committed
add mutex
1 parent 58513c8 commit 81a80f1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

source/loader/layers/sanitizer/asan/asan_ddi.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch(
474474
/// [out][optional] return an event object that identifies this
475475
/// particular kernel execution instance.
476476
ur_event_handle_t *phEvent) {
477+
478+
// This mutex is to prevent concurrent kernel launches on the same queue or
479+
// across different queues as the DeviceASAN local/private shadow memory
480+
// does not support concurrent kernel launches now.
481+
static ur_shared_mutex KernelLaunchMutex;
482+
std::scoped_lock<ur_shared_mutex> Guard(KernelLaunchMutex);
483+
477484
auto pfnKernelLaunch = getContext()->urDdiTable.Enqueue.pfnKernelLaunch;
478485

479486
if (nullptr == pfnKernelLaunch) {

0 commit comments

Comments
 (0)