File tree Expand file tree Collapse file tree 8 files changed +117
-14
lines changed
test-e2e/AddressSanitizer Expand file tree Collapse file tree 8 files changed +117
-14
lines changed Original file line number Diff line number Diff line change @@ -116,13 +116,13 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
116116 endfunction ()
117117
118118 set (UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git" )
119- # commit a89657c2e36d7152820b9ecc088422a54ca1d844
120- # Merge: 2355a7d6 be7057c4
121- # Author: Omar Ahmed <omar.ahmed @codeplay.com>
122- # Date: Wed Aug 7 12:01:33 2024 +0100
123- # Merge pull request #1699 from PietroGhg/pietro/usm_fixes
124- # [NATIVECPU] Implement urUSMGetMemAllocInfo and aligned alloc
125- set (UNIFIED_RUNTIME_TAG a89657c2e36d7152820b9ecc088422a54ca1d844 )
119+ # commit 2d3524e74ab6a09d1ad1a96d977973fac32ca55d
120+ # Merge: 6b2e678d d6e93fa1
121+ # Author: Kenneth Benzie (Benie) <k.benzie @codeplay.com>
122+ # Date: Wed Aug 7 14:23:09 2024 +0100
123+ # Merge pull request #1930 from oneapi-src/benie/no-import-in-pragma-region
124+ # Make pragma region names joined by _
125+ set (UNIFIED_RUNTIME_TAG 2d3524e74ab6a09d1ad1a96d977973fac32ca55d )
126126
127127 set (UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES" )
128128 # Due to the use of dependentloadflag and no installer for UMF and hwloc we need
Original file line number Diff line number Diff line change 11// REQUIRES: linux
22// RUN: %{build} %device_asan_flags -O0 -g -o %t
3- // RUN: %force_device_asan_rt UR_LAYER_ASAN_OPTIONS=quarantine_size_mb:1 %{run} not %t 2>&1 | FileCheck --check-prefixes CHECK,CHECK-DEVICE %s
3+ // RUN: %force_device_asan_rt UR_LAYER_ASAN_OPTIONS=" quarantine_size_mb:1;detect_kernel_arguments:0" %{run} not %t 2>&1 | FileCheck --check-prefixes CHECK,CHECK-DEVICE %s
44// RUN: %{build} %device_asan_flags -DMALLOC_HOST -O0 -g -o %t
5- // RUN: %force_device_asan_rt UR_LAYER_ASAN_OPTIONS=quarantine_size_mb:1 %{run} not %t 2>&1 | FileCheck --check-prefixes CHECK,CHECK-HOST %s
5+ // RUN: %force_device_asan_rt UR_LAYER_ASAN_OPTIONS=" quarantine_size_mb:1;detect_kernel_arguments:0" %{run} not %t 2>&1 | FileCheck --check-prefixes CHECK,CHECK-HOST %s
66// RUN: %{build} %device_asan_flags -DMALLOC_SHARED -O0 -g -o %t
7- // RUN: %force_device_asan_rt UR_LAYER_ASAN_OPTIONS=quarantine_size_mb:1 %{run} not %t 2>&1 | FileCheck --check-prefixes CHECK,CHECK-SHARED %s
7+ // RUN: %force_device_asan_rt UR_LAYER_ASAN_OPTIONS=" quarantine_size_mb:1;detect_kernel_arguments:0" %{run} not %t 2>&1 | FileCheck --check-prefixes CHECK,CHECK-SHARED %s
88#include < sycl/usm.hpp>
99
1010constexpr size_t N = 64 ;
Original file line number Diff line number Diff line change 1+ // REQUIRES: linux, (gpu && level_zero), cpu
2+ // RUN: %{build} %device_asan_flags -DMALLOC_DEVICE -O2 -g -o %t
3+ // RUN: env SYCL_PREFER_UR=1 UR_LAYER_ASAN_OPTIONS="detect_kernel_arguments:1" %{run} not %t 2>&1 | FileCheck --check-prefixes CHECK,CHECK-DEVICE %s
4+
5+ #include < sycl/detail/core.hpp>
6+
7+ #include < sycl/usm.hpp>
8+
9+ int main () {
10+ sycl::queue gpu_queue (sycl::gpu_selector_v);
11+ sycl::queue cpu_queue (sycl::cpu_selector_v);
12+
13+ auto data = sycl::malloc_device<int >(1 , cpu_queue);
14+
15+ gpu_queue.submit ([&](sycl::handler &h) {
16+ h.single_task <class MyKernel >([=]() { *data = 0 ; });
17+ });
18+ gpu_queue.wait ();
19+ // CHECK: DeviceSanitizer: invalid-argument on kernel
20+ // CHECK: The 1th argument {{.*}} is allocated in other context
21+ // CHECK: {{.*}} is located inside of Device USM region
22+
23+ sycl::free (data, cpu_queue);
24+ return 0 ;
25+ }
Original file line number Diff line number Diff line change 1+ // REQUIRES: linux
2+ // RUN: %{build} %device_asan_flags -O2 -g -o %t
3+ // RUN: env SYCL_PREFER_UR=1 UR_LAYER_ASAN_OPTIONS="detect_kernel_arguments:1" ONEAPI_DEVICE_SELECTOR=level_zero:gpu %{run-unfiltered-devices} not %t 2>&1 | FileCheck --check-prefixes CHECK-GPU %s
4+ // RUN: env SYCL_PREFER_UR=1 UR_LAYER_ASAN_OPTIONS="detect_kernel_arguments:1" ONEAPI_DEVICE_SELECTOR=opencl:cpu %{run-unfiltered-devices} %t 2>&1 | FileCheck --check-prefixes CHECK-CPU %s
5+
6+ #include < sycl/detail/core.hpp>
7+ #include < sycl/usm.hpp>
8+
9+ // /
10+ // / GPU devices don't support shared system USM currently, so passing host
11+ // / pointer to kernel is invalid.
12+ // / CPU devices support shared system USM.
13+ // /
14+
15+ int main () {
16+ sycl::queue Q;
17+ auto hostPtr = new int ;
18+
19+ Q.submit ([&](sycl::handler &h) {
20+ h.single_task <class MyKernel >([=]() { *hostPtr = 0 ; });
21+ });
22+ Q.wait ();
23+
24+ // CHECK-GPU: ERROR: DeviceSanitizer: invalid-argument
25+ // CHECK-GPU: The 1th argument {{.*}} is not a USM pointer
26+ // CHECK-CPU-NOT: ERROR: DeviceSanitizer: invalid-argument
27+
28+ delete hostPtr;
29+ puts (" PASS\n " );
30+ return 0 ;
31+ }
Original file line number Diff line number Diff line change 1+ // REQUIRES: linux, gpu
2+ // RUN: %{build} %device_asan_flags -O2 -g -o %t
3+ // RUN: env SYCL_PREFER_UR=1 UR_LAYER_ASAN_OPTIONS="detect_kernel_arguments:1" %{run} not %t 2>&1 | FileCheck %s
4+
5+ #include < sycl/detail/core.hpp>
6+
7+ #include < sycl/usm.hpp>
8+
9+ int main () {
10+ sycl::queue Q;
11+ auto Data = sycl::malloc_device<int >(1 , Q);
12+ ++Data;
13+
14+ Q.submit ([&](sycl::handler &h) {
15+ h.single_task <class MyKernel >([=]() { *Data = 0 ; });
16+ });
17+ Q.wait ();
18+ // CHECK: ERROR: DeviceSanitizer: invalid-argument
19+ // CHECK: The 1th argument {{.*}} is located outside of its region
20+
21+ return 0 ;
22+ }
Original file line number Diff line number Diff line change 1+ // REQUIRES: linux, gpu
2+ // RUN: %{build} %device_asan_flags -O2 -g -o %t
3+ // RUN: env SYCL_PREFER_UR=1 UR_LAYER_ASAN_OPTIONS="quarantine_size_mb:1;detect_kernel_arguments:1" %{run} not %t 2>&1 | FileCheck %s
4+
5+ #include < sycl/detail/core.hpp>
6+
7+ #include < sycl/usm.hpp>
8+
9+ int main () {
10+ sycl::queue Q;
11+ auto Data = sycl::malloc_device<int >(1 , Q);
12+ sycl::free (Data, Q);
13+
14+ Q.submit ([&](sycl::handler &h) {
15+ h.single_task <class MyKernel >([=]() { *Data = 0 ; });
16+ });
17+ Q.wait ();
18+ // CHECK: ERROR: DeviceSanitizer: invalid-argument
19+ // CHECK: The 1th argument {{.*}} is a released USM pointer
20+ // CHECK: {{.*}} is located inside of Device USM region
21+ // CHECK: allocated here:
22+ // CHECK: freed here:
23+
24+ return 0 ;
25+ }
Original file line number Diff line number Diff line change 11// REQUIRES: linux
22// RUN: %{build} %device_asan_flags -O0 -g -o %t
3- // RUN: env UR_LAYER_ASAN_OPTIONS=quarantine_size_mb:5 UR_LOG_SANITIZER=level:info %{run} not %t 2>&1 | FileCheck %s
3+ // RUN: env UR_LAYER_ASAN_OPTIONS=" quarantine_size_mb:5;detect_kernel_arguments:0" UR_LOG_SANITIZER=level:info %{run} not %t 2>&1 | FileCheck %s
44#include < sycl/usm.hpp>
55
66// / Quarantine Cache Test
@@ -46,7 +46,7 @@ int main() {
4646 // CHECK: #0 {{.*}} {{.*quarantine-no-free.cpp}}:[[@LINE-5]]
4747 // CHECK: [[ADDR]] is located inside of Device USM region [{{0x.*}}, {{0x.*}})
4848 // CHECK: allocated here:
49- // CHECK: released here:
49+ // CHECK: freed here:
5050
5151 return 0 ;
5252}
Original file line number Diff line number Diff line change 11// REQUIRES: linux
22// RUN: %{build} %device_asan_flags -O0 -g -o %t
3- // RUN: env UR_LAYER_ASAN_OPTIONS=quarantine_size_mb:1 %{run} not %t 2>&1 | FileCheck %s
3+ // RUN: env UR_LAYER_ASAN_OPTIONS=" quarantine_size_mb:5;detect_kernel_arguments:0" %{run} not %t 2>&1 | FileCheck %s
44#include < sycl/usm.hpp>
55
66constexpr size_t N = 1024 ;
@@ -21,7 +21,7 @@ int main() {
2121 // CHECK: #0 {{.*}} {{.*use-after-free.cpp:}}[[@LINE-5]]
2222 // CHECK: [[ADDR]] is located inside of Device USM region [{{0x.*}}, {{0x.*}})
2323 // CHECK: allocated here:
24- // CHECK: released here:
24+ // CHECK: freed here:
2525
2626 return 0 ;
2727}
You can’t perform that action at this time.
0 commit comments