Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DeviceASAN][bugfix] Not allow concurrent kernel launches across different queue #2679

Merged
merged 4 commits into from
Feb 10, 2025
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