Skip to content

Commit de855d3

Browse files
committed
[UR][DeviceASAN] Sync the latest changes in asan_libdevice.hpp
1 parent b7ef830 commit de855d3

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

libdevice/sanitizer_utils.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ static __SYCL_CONSTANT__ const char __generic_to[] =
8787

8888
#define ASAN_DEBUG(X) \
8989
do { \
90-
auto launch_info = (__SYCL_GLOBAL__ const LaunchInfo *)__AsanLaunchInfo; \
90+
auto launch_info = \
91+
(__SYCL_GLOBAL__ const AsanRuntimeData *)__AsanLaunchInfo; \
9192
if (launch_info->Debug) { \
9293
X; \
9394
} \
@@ -132,7 +133,7 @@ inline void ConvertGenericPointer(uptr &addr, uint32_t &as) {
132133
}
133134

134135
inline uptr MemToShadow_CPU(uptr addr) {
135-
auto launch_info = (__SYCL_GLOBAL__ const LaunchInfo *)__AsanLaunchInfo;
136+
auto launch_info = (__SYCL_GLOBAL__ const AsanRuntimeData *)__AsanLaunchInfo;
136137
return launch_info->GlobalShadowOffset + (addr >> ASAN_SHADOW_SCALE);
137138
}
138139

@@ -141,7 +142,7 @@ inline uptr MemToShadow_DG2(uptr addr, uint32_t as) {
141142
ConvertGenericPointer(addr, as);
142143
}
143144

144-
auto launch_info = (__SYCL_GLOBAL__ const LaunchInfo *)__AsanLaunchInfo;
145+
auto launch_info = (__SYCL_GLOBAL__ const AsanRuntimeData *)__AsanLaunchInfo;
145146
if (as == ADDRESS_SPACE_GLOBAL) { // global
146147
uptr shadow_ptr;
147148
if (addr & 0xFFFF000000000000ULL) { // Device USM
@@ -221,7 +222,7 @@ inline uptr MemToShadow_PVC(uptr addr, uint32_t as) {
221222
ConvertGenericPointer(addr, as);
222223
}
223224

224-
auto launch_info = (__SYCL_GLOBAL__ const LaunchInfo *)__AsanLaunchInfo;
225+
auto launch_info = (__SYCL_GLOBAL__ const AsanRuntimeData *)__AsanLaunchInfo;
225226
if (as == ADDRESS_SPACE_GLOBAL) { // global
226227
uptr shadow_ptr;
227228
if (addr & 0xFF00000000000000) { // Device USM
@@ -301,7 +302,7 @@ inline uptr MemToShadow_PVC(uptr addr, uint32_t as) {
301302
inline uptr MemToShadow(uptr addr, uint32_t as) {
302303
uptr shadow_ptr = 0;
303304

304-
auto launch_info = (__SYCL_GLOBAL__ const LaunchInfo *)__AsanLaunchInfo;
305+
auto launch_info = (__SYCL_GLOBAL__ const AsanRuntimeData *)__AsanLaunchInfo;
305306
if (launch_info->DeviceTy == DeviceType::CPU) {
306307
shadow_ptr = MemToShadow_CPU(addr);
307308
} else if (launch_info->DeviceTy == DeviceType::GPU_PVC) {
@@ -378,12 +379,12 @@ void __asan_internal_report_save(DeviceSanitizerErrorType error_type) {
378379
__spirv_BuiltInWorkgroupId.y * __spirv_BuiltInNumWorkgroups.z +
379380
__spirv_BuiltInWorkgroupId.z;
380381

381-
auto &SanitizerReport = ((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)
382+
auto &SanitizerReport = ((__SYCL_GLOBAL__ AsanRuntimeData *)__AsanLaunchInfo)
382383
->SanitizerReport[WG_LID % ASAN_MAX_NUM_REPORTS];
383384

384385
if (atomicCompareAndSet(
385-
&(((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)->ReportFlag), 1,
386-
0) == 0 &&
386+
&(((__SYCL_GLOBAL__ AsanRuntimeData *)__AsanLaunchInfo)->ReportFlag),
387+
1, 0) == 0 &&
387388
atomicCompareAndSet(&SanitizerReport.Flag, Desired, Expected) ==
388389
Expected) {
389390
SanitizerReport.ErrorType = error_type;
@@ -415,13 +416,13 @@ void __asan_internal_report_save(
415416
__spirv_BuiltInWorkgroupId.y * __spirv_BuiltInNumWorkgroups.z +
416417
__spirv_BuiltInWorkgroupId.z;
417418

418-
auto &SanitizerReport = ((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)
419+
auto &SanitizerReport = ((__SYCL_GLOBAL__ AsanRuntimeData *)__AsanLaunchInfo)
419420
->SanitizerReport[WG_LID % ASAN_MAX_NUM_REPORTS];
420421

421422
if ((is_recover ||
422423
atomicCompareAndSet(
423-
&(((__SYCL_GLOBAL__ LaunchInfo *)__AsanLaunchInfo)->ReportFlag), 1,
424-
0) == 0) &&
424+
&(((__SYCL_GLOBAL__ AsanRuntimeData *)__AsanLaunchInfo)->ReportFlag),
425+
1, 0) == 0) &&
425426
atomicCompareAndSet(&SanitizerReport.Flag, Desired, Expected) ==
426427
Expected) {
427428

@@ -818,7 +819,7 @@ DEVICE_EXTERN_C_NOINLINE void
818819
__asan_set_shadow_dynamic_local(uptr ptr, uint32_t num_args) {
819820
ASAN_DEBUG(__spirv_ocl_printf(__mem_set_shadow_dynamic_local_begin));
820821

821-
auto *launch_info = (__SYCL_GLOBAL__ const LaunchInfo *)__AsanLaunchInfo;
822+
auto *launch_info = (__SYCL_GLOBAL__ const AsanRuntimeData *)__AsanLaunchInfo;
822823
if (num_args != launch_info->NumLocalArgs) {
823824
__spirv_ocl_printf(__mem_report_arg_count_incorrect, num_args,
824825
launch_info->NumLocalArgs);
@@ -849,7 +850,7 @@ DEVICE_EXTERN_C_NOINLINE void
849850
__asan_unpoison_shadow_dynamic_local(uptr ptr, uint32_t num_args) {
850851
ASAN_DEBUG(__spirv_ocl_printf(__mem_unpoison_shadow_dynamic_local_begin));
851852

852-
auto *launch_info = (__SYCL_GLOBAL__ const LaunchInfo *)__AsanLaunchInfo;
853+
auto *launch_info = (__SYCL_GLOBAL__ const AsanRuntimeData *)__AsanLaunchInfo;
853854
if (num_args != launch_info->NumLocalArgs) {
854855
__spirv_ocl_printf(__mem_report_arg_count_incorrect, num_args,
855856
launch_info->NumLocalArgs);
@@ -885,7 +886,7 @@ DEVICE_EXTERN_C_NOINLINE void __asan_set_shadow_private(uptr begin, uptr size,
885886
char val) {
886887
ASAN_DEBUG(__spirv_ocl_printf(__mem_set_shadow_private_begin));
887888

888-
auto *launch_info = (__SYCL_GLOBAL__ const LaunchInfo *)__AsanLaunchInfo;
889+
auto *launch_info = (__SYCL_GLOBAL__ const AsanRuntimeData *)__AsanLaunchInfo;
889890
if (launch_info->PrivateShadowOffset == 0)
890891
return;
891892

sycl/cmake/modules/FetchUnifiedRuntime.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ 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")
119+
set(UNIFIED_RUNTIME_REPO "https://github.com/zhaomaosu/unified-runtime.git")
120120
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/UnifiedRuntimeTag.cmake)
121121

122122
set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")

sycl/cmake/modules/UnifiedRuntimeTag.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
# Date: Mon Oct 28 16:29:45 2024 +0100
55
# Merge pull request #2242 from nrspruit/sysman_env_disable
66
# [L0] Enable Sysman Thru Env by default and have zesInit be optional
7-
set(UNIFIED_RUNTIME_TAG dbd168cbed2d2590b47904728cd5762f1c2f4c6b)
7+
set(UNIFIED_RUNTIME_TAG use-device-usm-for-rtl-data)

0 commit comments

Comments
 (0)