From 10ab6c831fe2a6a2c2c8c4b69531d34e661753a8 Mon Sep 17 00:00:00 2001 From: haonanya1 Date: Tue, 10 Jun 2025 23:20:49 -0700 Subject: [PATCH 1/2] [DeviceSanitizer] Remove duplicated syncToDevice call. AsanInterceptor::prepareLaunch has this call, which aligns with msan and tsan. --- unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp index 0b4a64c38a54..6538056ed2c1 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp @@ -516,7 +516,6 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( LaunchInfo LaunchInfo(GetContext(hQueue), GetDevice(hQueue), pGlobalWorkSize, pLocalWorkSize, pGlobalWorkOffset, workDim); - UR_CALL(LaunchInfo.Data.syncToDevice(hQueue)); UR_CALL(getAsanInterceptor()->preLaunchKernel(hKernel, hQueue, LaunchInfo)); From 7a107f820bc5563987e9f4dad4c14725bb5c0392 Mon Sep 17 00:00:00 2001 From: haonanya1 Date: Wed, 11 Jun 2025 19:37:14 -0700 Subject: [PATCH 2/2] Revert "[DeviceSanitizer] Remove duplicated syncToDevice call." and add comments. This reverts commit 10ab6c831fe2a6a2c2c8c4b69531d34e661753a8. --- .../source/loader/layers/sanitizer/asan/asan_ddi.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp b/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp index 6538056ed2c1..53e6994631f1 100644 --- a/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp +++ b/unified-runtime/source/loader/layers/sanitizer/asan/asan_ddi.cpp @@ -516,6 +516,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( LaunchInfo LaunchInfo(GetContext(hQueue), GetDevice(hQueue), pGlobalWorkSize, pLocalWorkSize, pGlobalWorkOffset, workDim); + // When the kernel is filtered, it's still possible that LaunchInfo is used in + // kernel code, so the "syncToDevice" here will give it the default value. + UR_CALL(LaunchInfo.Data.syncToDevice(hQueue)); UR_CALL(getAsanInterceptor()->preLaunchKernel(hKernel, hQueue, LaunchInfo));