From 8034fe01116f6ce19ad868c8a13ed55add55ca77 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Mon, 10 Feb 2025 11:10:34 +0000 Subject: [PATCH 1/2] Merge pull request #2679 from yingcong-wu/yc/0208-ur-dasan-bugfix-main [DeviceASAN][bugfix] Not allow concurrent kernel launches across different queue --- source/loader/layers/sanitizer/asan/asan_ddi.cpp | 6 ++++++ source/loader/layers/sanitizer/asan/asan_interceptor.hpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/source/loader/layers/sanitizer/asan/asan_ddi.cpp b/source/loader/layers/sanitizer/asan/asan_ddi.cpp index a845ad94c1..9bddd82782 100644 --- a/source/loader/layers/sanitizer/asan/asan_ddi.cpp +++ b/source/loader/layers/sanitizer/asan/asan_ddi.cpp @@ -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 Guard( + getAsanInterceptor()->KernelLaunchMutex); + auto pfnKernelLaunch = getContext()->urDdiTable.Enqueue.pfnKernelLaunch; if (nullptr == pfnKernelLaunch) { diff --git a/source/loader/layers/sanitizer/asan/asan_interceptor.hpp b/source/loader/layers/sanitizer/asan/asan_interceptor.hpp index 37806c54eb..4324150b6f 100644 --- a/source/loader/layers/sanitizer/asan/asan_interceptor.hpp +++ b/source/loader/layers/sanitizer/asan/asan_interceptor.hpp @@ -360,6 +360,8 @@ class AsanInterceptor { std::shared_ptr getOrCreateShadowMemory(ur_device_handle_t Device, DeviceType Type); + ur_shared_mutex KernelLaunchMutex; + private: ur_result_t updateShadowMemory(std::shared_ptr &ContextInfo, std::shared_ptr &DeviceInfo, From ba09d77a6058eb1cbee3317fb2a3059de9d007d9 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Mon, 10 Feb 2025 11:17:33 +0000 Subject: [PATCH 2/2] Set CMake version to v0.11.8 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 619c26f5ee..b725f90485 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception cmake_minimum_required(VERSION 3.20.0 FATAL_ERROR) -project(unified-runtime VERSION 0.11.7) +project(unified-runtime VERSION 0.11.8) # Check if unified runtime is built as a standalone project. if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR UR_STANDALONE_BUILD)