Skip to content

Commit bdbe7b4

Browse files
authored
Merge pull request #2679 from yingcong-wu/yc/0208-ur-dasan-bugfix-main
[DeviceASAN][bugfix] Not allow concurrent kernel launches across different queue
2 parents e55fe50 + 508e6b9 commit bdbe7b4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

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

+7
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 across different queues
479+
// as the DeviceASAN local/private shadow memory does not support concurrent
480+
// kernel launches now.
481+
std::scoped_lock<ur_shared_mutex> Guard(
482+
getAsanInterceptor()->KernelLaunchMutex);
483+
477484
auto pfnKernelLaunch = getContext()->urDdiTable.Enqueue.pfnKernelLaunch;
478485

479486
if (nullptr == pfnKernelLaunch) {

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

+2
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ class AsanInterceptor {
354354
std::shared_ptr<ShadowMemory>
355355
getOrCreateShadowMemory(ur_device_handle_t Device, DeviceType Type);
356356

357+
ur_shared_mutex KernelLaunchMutex;
358+
357359
private:
358360
ur_result_t updateShadowMemory(std::shared_ptr<ContextInfo> &ContextInfo,
359361
std::shared_ptr<DeviceInfo> &DeviceInfo,

0 commit comments

Comments
 (0)