Skip to content

Commit

Permalink
Merge pull request #2679 from yingcong-wu/yc/0208-ur-dasan-bugfix-main
Browse files Browse the repository at this point in the history
[DeviceASAN][bugfix] Not allow concurrent kernel launches across different queue
  • Loading branch information
kbenzie committed Feb 10, 2025
1 parent db5d018 commit 8034fe0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/loader/layers/sanitizer/asan/asan_ddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,12 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch(
phEvent ///< [out][optional] return an event object that identifies this particular
///< kernel execution instance.
) {
// This mutex is to prevent concurrent kernel launches across different queues
// as the DeviceASAN local/private shadow memory does not support concurrent
// kernel launches now.
std::scoped_lock<ur_shared_mutex> Guard(
getAsanInterceptor()->KernelLaunchMutex);

auto pfnKernelLaunch = getContext()->urDdiTable.Enqueue.pfnKernelLaunch;

if (nullptr == pfnKernelLaunch) {
Expand Down
2 changes: 2 additions & 0 deletions source/loader/layers/sanitizer/asan/asan_interceptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ class AsanInterceptor {
std::shared_ptr<ShadowMemory>
getOrCreateShadowMemory(ur_device_handle_t Device, DeviceType Type);

ur_shared_mutex KernelLaunchMutex;

private:
ur_result_t updateShadowMemory(std::shared_ptr<ContextInfo> &ContextInfo,
std::shared_ptr<DeviceInfo> &DeviceInfo,
Expand Down

0 comments on commit 8034fe0

Please sign in to comment.