Skip to content

Commit 39157bd

Browse files
committed
[DeviceSanitizer] Only allows to report one error per each kernel launch
When error is detected, the corresponding work-item will exit without unpoisoning local/private shadow memory. Then other work-items are eary to cause false alarms. So, we only allows to report one error per each kernel launch by default.
1 parent de4851c commit 39157bd

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

libdevice/include/asan_libdevice.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ struct LaunchInfo {
7575
uint32_t NumLocalArgs = 0;
7676
LocalArgsInfo *LocalArgs = nullptr; // Ordered by ArgIndex
7777

78+
int ReportFlag = 0;
7879
DeviceSanitizerReport SanitizerReport[ASAN_MAX_NUM_REPORTS];
7980
};
8081

libdevice/sanitizer_utils.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,11 @@ bool __asan_internal_report_save(DeviceSanitizerErrorType error_type) {
412412
auto &SanitizerReport = ((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)
413413
->SanitizerReport[WG_LID % ASAN_MAX_NUM_REPORTS];
414414

415-
if (atomicCompareAndSet(&SanitizerReport.Flag, Desired, Expected) ==
416-
Expected) {
415+
if (atomicCompareAndSet(
416+
&(((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)->ReportFlag), 1,
417+
0) == 0 &&
418+
atomicCompareAndSet(&SanitizerReport.Flag, Desired, Expected) ==
419+
Expected) {
417420
SanitizerReport.ErrorType = error_type;
418421
SanitizerReport.IsRecover = false;
419422

@@ -455,8 +458,12 @@ bool __asan_internal_report_save(
455458
auto &SanitizerReport = ((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)
456459
->SanitizerReport[WG_LID % ASAN_MAX_NUM_REPORTS];
457460

458-
if (atomicCompareAndSet(&SanitizerReport.Flag, Desired, Expected) ==
459-
Expected) {
461+
if ((is_recover ||
462+
atomicCompareAndSet(
463+
&(((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)->ReportFlag), 1,
464+
0) == 0) &&
465+
atomicCompareAndSet(&SanitizerReport.Flag, Desired, Expected) ==
466+
Expected) {
460467

461468
int FileLength = 0;
462469
int FuncLength = 0;

sycl/cmake/modules/FetchUnifiedRuntime.cmake

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,8 @@ if(SYCL_UR_USE_FETCH_CONTENT)
116116
CACHE PATH "Path to external '${name}' adapter source dir" FORCE)
117117
endfunction()
118118

119-
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
120-
# commit 8c9dd7e464a99ebbfb238ac2dabefc3ac77baea5
121-
# Merge: a99dbcee 3abe18cf
122-
# Author: Piotr Balcer <[email protected]>
123-
# Date: Fri Sep 6 17:21:17 2024 +0200
124-
# Merge pull request #1820 from pbalcer/static-linking
125-
# Add support for static linking of the L0 adapter
126-
set(UNIFIED_RUNTIME_TAG 8c9dd7e464a99ebbfb238ac2dabefc3ac77baea5)
119+
set(UNIFIED_RUNTIME_REPO "https://github.com/zhaomaosu/unified-runtime.git")
120+
set(UNIFIED_RUNTIME_TAG devsan-add-report-flag)
127121

128122
set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")
129123
# Due to the use of dependentloadflag and no installer for UMF and hwloc we need

0 commit comments

Comments
 (0)