Skip to content

Commit 8034fe0

Browse files
committed
Merge pull request #2679 from yingcong-wu/yc/0208-ur-dasan-bugfix-main
[DeviceASAN][bugfix] Not allow concurrent kernel launches across different queue
1 parent db5d018 commit 8034fe0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch(
463463
phEvent ///< [out][optional] return an event object that identifies this particular
464464
///< kernel execution instance.
465465
) {
466+
// This mutex is to prevent concurrent kernel launches across different queues
467+
// as the DeviceASAN local/private shadow memory does not support concurrent
468+
// kernel launches now.
469+
std::scoped_lock<ur_shared_mutex> Guard(
470+
getAsanInterceptor()->KernelLaunchMutex);
471+
466472
auto pfnKernelLaunch = getContext()->urDdiTable.Enqueue.pfnKernelLaunch;
467473

468474
if (nullptr == pfnKernelLaunch) {

source/loader/layers/sanitizer/asan/asan_interceptor.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ class AsanInterceptor {
360360
std::shared_ptr<ShadowMemory>
361361
getOrCreateShadowMemory(ur_device_handle_t Device, DeviceType Type);
362362

363+
ur_shared_mutex KernelLaunchMutex;
364+
363365
private:
364366
ur_result_t updateShadowMemory(std::shared_ptr<ContextInfo> &ContextInfo,
365367
std::shared_ptr<DeviceInfo> &DeviceInfo,

0 commit comments

Comments
 (0)