Skip to content

Commit 9ebd2d2

Browse files
authored
[DeviceASAN][test] split aot build flag and related test (#17289)
Features like `cpu`, `gpu`, `opencl`, `level_zero` are only available for lines containing `%{run}`, causing the AOT build flag substitution behavior abnormally. In this change, we use dedicated build flags for CPU and GPU devices to avoid relying on the features. This would fix #17273.
1 parent 90f7820 commit 9ebd2d2

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// REQUIRES: linux, ocloc, gpu && level_zero
2+
// REQUIRES: (arch-intel_gpu_pvc || gpu-intel-dg2)
23

3-
// RUN: %{build} %device_asan_aot_flags -O0 -g %S/Inputs/host-usm-oob.cpp -o %t.out
4+
// RUN: %{run-aux} %{build} %device_asan_aot_flags -O0 -g %S/Inputs/host-usm-oob.cpp -o %t.out
45
// RUN: %{run} not %t.out 2>&1 | FileCheck %S/Inputs/host-usm-oob.cpp
56

6-
// RUN: %{build} %device_asan_aot_flags -O1 -g %S/Inputs/host-usm-oob.cpp -o %t.out
7+
// RUN: %{run-aux} %{build} %device_asan_aot_flags -O1 -g %S/Inputs/host-usm-oob.cpp -o %t.out
78
// RUN: %{run} not %t.out 2>&1 | FileCheck %S/Inputs/host-usm-oob.cpp
89

9-
// RUN: %{build} %device_asan_aot_flags -O2 -g %S/Inputs/host-usm-oob.cpp -o %t.out
10+
// RUN: %{run-aux} %{build} %device_asan_aot_flags -O2 -g %S/Inputs/host-usm-oob.cpp -o %t.out
1011
// RUN: %{run} not %t.out 2>&1 | FileCheck %S/Inputs/host-usm-oob.cpp
1112

12-
// RUN: %{build} %device_asan_aot_flags -O3 -g %S/Inputs/host-usm-oob.cpp -o %t.out
13+
// RUN: %{run-aux} %{build} %device_asan_aot_flags -O3 -g %S/Inputs/host-usm-oob.cpp -o %t.out
1314
// RUN: %{run} not %t.out 2>&1 | FileCheck %S/Inputs/host-usm-oob.cpp
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// REQUIRES: linux, opencl-aot, cpu
2+
3+
// RUN: %{run-aux} %{build} %device_asan_aot_flags %S/kernel-filter.cpp -O2 -fsanitize-ignorelist=%p/ignorelist.txt -o %t1
4+
// RUN: %{run} %t1 2>&1 | FileCheck %S/kernel-filter.cpp
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// REQUIRES: linux, ocloc, gpu && level_zero
2+
// REQUIRES: (arch-intel_gpu_pvc || gpu-intel-dg2)
3+
4+
// RUN: %{run-aux} %{build} %device_asan_aot_flags %S/kernel-filter.cpp -O2 -fsanitize-ignorelist=%p/ignorelist.txt -o %t1
5+
// RUN: %{run} %t1 2>&1 | FileCheck %S/kernel-filter.cpp

sycl/test-e2e/AddressSanitizer/common/kernel-filter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// REQUIRES: linux, cpu || (gpu && level_zero)
22
// RUN: %{build} %device_asan_flags -O2 -fsanitize-ignorelist=%p/ignorelist.txt -o %t1
33
// RUN: %{run} %t1 2>&1 | FileCheck %s
4-
// RUN: %{build} %device_asan_aot_flags -O2 -fsanitize-ignorelist=%p/ignorelist.txt -o %t2
5-
// RUN: %{run} %t2 2>&1 | FileCheck %s
64

75
#include <sycl/detail/core.hpp>
86
#include <sycl/usm.hpp>

sycl/test-e2e/AddressSanitizer/lit.local.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
config.substitutions.append(
22
("%device_asan_flags", "-Xarch_device -fsanitize=address")
33
)
4+
# For GPU, DASAN only support pvc and dg2 currently
45
config.substitutions.append(
5-
("%device_asan_aot_flags", "-Xarch_device -fsanitize=address %if cpu %{ -fsycl-targets=spir64_x86_64 %} %if gpu %{ -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen %gpu_aot_target_opts %}")
6+
("%device_asan_aot_flags", "-Xarch_device -fsanitize=address %if cpu %{ -fsycl-targets=spir64_x86_64 %} %if gpu %{ -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen '-devices pvc,dg2' %}")
67
)
78
config.substitutions.append(
89
("%force_device_asan_rt", "env UR_ENABLE_LAYERS=UR_LAYER_ASAN")

0 commit comments

Comments
 (0)