Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions source/loader/layers/sanitizer/asan/asan_ddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch(
/// [out][optional] return an event object that identifies this
/// particular kernel execution instance.
ur_event_handle_t *phEvent) {

// 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 @@ -354,6 +354,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
Loading