Skip to content

Commit 88c096c

Browse files
authored
[DeviceASAN] Fix invalid test-e2e "kernel-filter.cpp" (#17328)
The old "kernel-filter.cpp" is invalid to test kernel filter feature.
1 parent df4cdfe commit 88c096c

File tree

5 files changed

+19
-27
lines changed

5 files changed

+19
-27
lines changed

sycl/test-e2e/AddressSanitizer/aot/gpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: linux, ocloc, gpu && level_zero
1+
// REQUIRES: linux, gpu && level_zero
22
// REQUIRES: (arch-intel_gpu_pvc || gpu-intel-dg2)
33

44
// RUN: %{run-aux} %{build} %device_asan_aot_flags -O0 -g %S/Inputs/host-usm-oob.cpp -o %t.out
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fun:*NoSanitized*
1+
fun:*MyKernel*
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// REQUIRES: linux, opencl-aot, cpu
22

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
3+
// RUN: %{run-aux} %{build} %device_asan_aot_flags %S/kernel-filter.cpp -g -O2 -fsanitize-ignorelist=%p/ignorelist.txt -o %t1
4+
// RUN: %{run} %t1 2>&1 | FileCheck %S/kernel-filter.cpp --check-prefixes CHECK-IGNORE
5+
// RUN: %{run-aux} %{build} %device_asan_aot_flags %S/kernel-filter.cpp -g -O2 -o %t2
6+
// RUN: %{run} not %t2 2>&1 | FileCheck %S/kernel-filter.cpp
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
// REQUIRES: linux, ocloc, gpu && level_zero
1+
// REQUIRES: linux, gpu && level_zero
22
// REQUIRES: (arch-intel_gpu_pvc || gpu-intel-dg2)
33

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
4+
// RUN: %{run-aux} %{build} %device_asan_aot_flags %S/kernel-filter.cpp -g -O2 -fsanitize-ignorelist=%p/ignorelist.txt -o %t1
5+
// RUN: %{run} %t1 2>&1 | FileCheck %S/kernel-filter.cpp --check-prefixes CHECK-IGNORE
6+
// RUN: %{run-aux} %{build} %device_asan_aot_flags %S/kernel-filter.cpp -g -O2 -o %t2
7+
// RUN: %{run} not %t2 2>&1 | FileCheck %S/kernel-filter.cpp
Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// REQUIRES: linux, cpu || (gpu && level_zero)
2-
// RUN: %{build} %device_asan_flags -O2 -fsanitize-ignorelist=%p/ignorelist.txt -o %t1
3-
// RUN: %{run} %t1 2>&1 | FileCheck %s
2+
// RUN: %{build} %device_asan_flags -g -O2 -fsanitize-ignorelist=%p/ignorelist.txt -o %t1
3+
// RUN: %{run} %t1 2>&1 | FileCheck %s --check-prefixes CHECK-IGNORE
4+
// RUN: %{build} %device_asan_flags -g -O2 -o %t2
5+
// RUN: %{run} not %t2 2>&1 | FileCheck %s
46

57
#include <sycl/detail/core.hpp>
68
#include <sycl/usm.hpp>
@@ -19,31 +21,17 @@ int main() {
1921
Q.submit([&](sycl::handler &h) {
2022
auto buf_acc = buf.get_access<sycl::access::mode::read_write>(h);
2123
auto loc_acc = sycl::local_accessor<int>(group_size, h);
22-
h.parallel_for<class NoSanitized>(
24+
h.parallel_for<class MyKernel>(
2325
sycl::nd_range<1>(N, group_size), [=](sycl::nd_item<1> item) {
2426
auto gid = item.get_global_id(0);
2527
auto lid = item.get_local_id(0);
26-
array[gid] = buf_acc[gid] + loc_acc[lid];
28+
array[gid + 1] = buf_acc[gid] + loc_acc[lid];
2729
});
2830
});
2931
Q.wait();
30-
// CHECK-NOT: ERROR: DeviceSanitizer: out-of-bounds-access
31-
32-
Q.submit([&](sycl::handler &h) {
33-
auto buf_acc = buf.get_access<sycl::access::mode::read_write>(h);
34-
auto loc_acc = sycl::local_accessor<int>(group_size, h);
35-
h.parallel_for<class Sanitized>(sycl::nd_range<1>(N, group_size),
36-
[=](sycl::nd_item<1> item) {
37-
auto gid = item.get_global_id(0);
38-
auto lid = item.get_local_id(0);
39-
array[gid] = buf_acc[gid] + loc_acc[lid];
40-
});
41-
});
42-
Q.wait();
32+
// CHECK-IGNORE-NOT: ERROR: DeviceSanitizer: out-of-bounds-access
33+
// CHECK: ERROR: DeviceSanitizer: out-of-bounds-access
4334

4435
sycl::free(array, Q);
45-
std::cout << "PASS" << std::endl;
46-
// CHECK: PASS
47-
4836
return 0;
4937
}

0 commit comments

Comments
 (0)