Skip to content

Commit 5a254da

Browse files
committed
[UR][DeviceASAN] Fix incorrect symbolizer output for shared libraries
1 parent 475ca2d commit 5a254da

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

sycl/cmake/modules/FetchUnifiedRuntime.cmake

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +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 af7e275b509b41f54a66743ebf748dfb51668abf
121-
# Author: Maosu Zhao <[email protected]>
122-
# Date: Thu Oct 17 16:31:21 2024 +0800
123-
# [DeviceSanitizer] Refactor the code to manage shadow memory (#2127)
124-
set(UNIFIED_RUNTIME_TAG af7e275b509b41f54a66743ebf748dfb51668abf)
119+
set(UNIFIED_RUNTIME_REPO "https://github.com/zhaomaosu/unified-runtime.git")
120+
set(UNIFIED_RUNTIME_TAG symbolizer-fix-shared-lib)
125121

126122
set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")
127123
# Due to the use of dependentloadflag and no installer for UMF and hwloc we need
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// REQUIRES: linux, cpu
2+
// RUN: %{build} %device_asan_flags -O0 -g -fPIC -shared -DSHARED_LIB -o %t.so
3+
// RUN: %{build} %device_asan_flags -O0 -g -fPIC -Wl,-rpath,. %t.so -o %t
4+
// RUN: %{run} %t 2>&1 | FileCheck %s
5+
#include <sycl/detail/core.hpp>
6+
7+
#include <sycl/usm.hpp>
8+
9+
#if defined(SHARED_LIB)
10+
void test(sycl::queue &Q, size_t N) {
11+
auto *array = sycl::malloc_device<char>(N, Q);
12+
13+
Q.submit([&](sycl::handler &h) {
14+
h.parallel_for<class MyKernelR_4>(
15+
sycl::nd_range<1>(N, 1),
16+
[=](sycl::nd_item<1> item) { ++array[item.get_global_id(0)]; });
17+
}).wait();
18+
}
19+
20+
#else
21+
22+
void test(sycl::queue &Q, size_t N);
23+
24+
int main() {
25+
sycl::queue Q;
26+
constexpr std::size_t N = 12;
27+
28+
test(Q, N);
29+
30+
// CHECK: ERROR: DeviceSanitizer: detected memory leaks of Device USM
31+
// CHECK: Direct leak of 12 byte(s) at {{0x.*}} allocated from:
32+
// CHECK: in test{{.*memory-leak-shared-lib.cpp:}}[[@LINE-21]]
33+
34+
return 0;
35+
}
36+
37+
#endif

0 commit comments

Comments
 (0)