Skip to content

Commit ada1668

Browse files
zhaomaosukbenzie
andauthored
[DevASAN] Only report warning if passing host ptr to kernel (#16654)
UR Part: oneapi-src/unified-runtime#2569 --------- Co-authored-by: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
1 parent 4969065 commit ada1668

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# commit 023a84744b7db460d42225c8b5ea4d6def085c81
2-
# Merge: 9b57d7b7 0607d2c8
1+
# commit eaea885d5477c8936209175a5b00062ca44f5765
2+
# Merge: af4ab49c 2a03334c
33
# Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
4-
# Date: Thu Jan 16 10:17:25 2025 +0000
5-
# Merge pull request #2546 from lukaszstolarczuk/bump-umf-to-latest-main
6-
# [main] Bump UMF to v0.10.1
7-
set(UNIFIED_RUNTIME_TAG 023a84744b7db460d42225c8b5ea4d6def085c81)
4+
# Date: Thu Jan 16 14:30:47 2025 +0000
5+
# Merge pull request #2569 from zhaomaosu/asan-only-warn-host-ptr
6+
# [DevASAN] Only report warning if passing host ptr to kernel
7+
set(UNIFIED_RUNTIME_TAG eaea885d5477c8936209175a5b00062ca44f5765)

sycl/test-e2e/AddressSanitizer/invalid-argument/host-pointer.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
// REQUIRES: linux, cpu || (gpu && level_zero)
22
// RUN: %{build} %device_asan_flags -O2 -g -o %t
3-
// RUN: env UR_LAYER_ASAN_OPTIONS="detect_kernel_arguments:1" %{run} %if gpu %{ not %} %t 2>&1 | FileCheck --check-prefixes %if cpu %{ CHECK-CPU %} %if gpu %{ CHECK-GPU %} %s
3+
// RUN: env UR_LAYER_ASAN_OPTIONS="detect_kernel_arguments:1" %{run} %t 2>&1 | FileCheck --check-prefixes %if cpu %{ CHECK-CPU %} %if gpu %{ CHECK-GPU %} %s
44

55
#include <sycl/detail/core.hpp>
66
#include <sycl/usm.hpp>
77

8-
///
9-
/// GPU devices don't support shared system USM currently, so passing host
10-
/// pointer to kernel is invalid.
11-
/// CPU devices support shared system USM.
12-
///
13-
148
int main() {
159
sycl::queue Q;
10+
auto *array = sycl::malloc_device<uintptr_t>(1, Q);
1611
auto hostPtr = new int;
1712

1813
Q.submit([&](sycl::handler &h) {
19-
h.single_task<class MyKernel>([=]() { *hostPtr = 0; });
14+
h.single_task<class MyKernel>([=]() { array[0] = (uintptr_t)hostPtr; });
2015
});
2116
Q.wait();
2217

2318
// CHECK-GPU: ERROR: DeviceSanitizer: invalid-argument
2419
// CHECK-GPU: The {{[0-9]+}}th argument {{.*}} is not a USM pointer
2520
// CHECK-CPU-NOT: ERROR: DeviceSanitizer: invalid-argument
2621

22+
sycl::free(array, Q);
2723
delete hostPtr;
2824
puts("PASS\n");
2925
return 0;

0 commit comments

Comments
 (0)