Skip to content

Commit c20acc4

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into review/yang/restructure_asan_msan
2 parents bb0326d + 8106796 commit c20acc4

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,8 @@ static TargetExtType *getTargetExtType(Type *Ty) {
16231623
// store float %1, ptr %call, align 4
16241624
// clang-format on
16251625
static bool isJointMatrixAccess(Value *V) {
1626-
if (auto *CI = dyn_cast<CallInst>(V)) {
1626+
auto *ActualV = V->stripInBoundsOffsets();
1627+
if (auto *CI = dyn_cast<CallInst>(ActualV)) {
16271628
for (Value *Op : CI->args()) {
16281629
if (auto *AI = dyn_cast<AllocaInst>(Op->stripInBoundsOffsets()))
16291630
if (auto *TargetTy = getTargetExtType(AI->getAllocatedType()))

llvm/test/Instrumentation/AddressSanitizer/SPIRV/ignore_target_ext_type.ll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ entry:
2626
%a = alloca %"struct.sycl::_V1::ext::oneapi::experimental::matrix::joint_matrix", align 8
2727
%0 = getelementptr inbounds %"struct.sycl::_V1::ext::oneapi::experimental::matrix::joint_matrix", ptr %a, i64 0, i32 0
2828
%call.i35 = call spir_func ptr @_Z19__spirv_AccessChainIfN4sycl3_V13ext6oneapi12experimental6matrix9precision4tf32ELm8ELm8ELN5__spv9MatrixUseE0ELNS8_5Scope4FlagE3EEPT_PPNS8_28__spirv_CooperativeMatrixKHRIT0_XT4_EXT1_EXT2_EXT3_EEEm(ptr %0, i64 0)
29+
%1 = getelementptr inbounds { i16 }, ptr %call.i35, i64 0, i32 0
2930
; CHECK-NOT: call void @__asan_load
3031
; CHECK-NOT: call void @__asan_store
31-
%1 = load float, ptr %call.i35, align 4
32+
%2 = load i16, ptr %1, align 4
3233
%call.i42 = call spir_func ptr @_Z19__spirv_AccessChainIfN4sycl3_V13ext6oneapi12experimental6matrix9precision4tf32ELm8ELm8ELN5__spv9MatrixUseE0ELNS8_5Scope4FlagE3EEPT_PPNS8_28__spirv_CooperativeMatrixKHRIT0_XT4_EXT1_EXT2_EXT3_EEEm(ptr %0, i64 0)
33-
store float %1, ptr %call.i42, align 4
34+
%3 = getelementptr inbounds { i16 }, ptr %call.i42, i64 0, i32 0
35+
store i16 %2, ptr %3, align 4
3436
ret void
3537
}
3638

sycl/test-e2e/Adapters/interop-l0-direct.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// REQUIRES: level_zero, level_zero_dev_kit
22
// UNSUPPORTED: ze_debug
3+
4+
// DeviceSanitizer will report error for cross context USM usage, turn it off
5+
// RUN: export UR_LAYER_ASAN_OPTIONS="detect_kernel_arguments:0"
6+
37
// RUN: %{build} %level_zero_options -o %t.out
48
// RUN: env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=0 %{run} %t.out
59
// RUN: env SYCL_PI_LEVEL_ZERO_USE_IMMEDIATE_COMMANDLISTS=1 %{run} %t.out
@@ -219,6 +223,9 @@ int main() {
219223
std::cout << "GPU Result from Immediate Q = {" << hostOut[0] << ", "
220224
<< hostOut[1] << ", " << hostOut[2] << "}" << std::endl;
221225
}
226+
227+
free(deviceData, InteropContext);
228+
222229
// Check results
223230
buffer<int, 1> bufDataResult{data, 3};
224231
host_accessor hostResult{bufDataResult, read_only};
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// REQUIRES: linux, cpu || (gpu && level_zero)
22
// RUN: %{build} %device_asan_flags -O2 -g -o %t
33
// RUN: %{run} %t 2>&1 | FileCheck %s
4-
// RUN: env UR_LAYER_ASAN_OPTIONS=print_stats:1 %{run} %t 2>&1 | FileCheck --check-prefixes CHECK-STATS %s
4+
// RUN: env UR_LAYER_ASAN_OPTIONS="print_stats:1;quarantine_size_mb:1" %{run} %t 2>&1 | FileCheck --check-prefixes CHECK-STATS %s
5+
// RUN: env UR_LAYER_ASAN_OPTIONS="print_stats:1;quarantine_size_mb:0" %{run} %t 2>&1 | FileCheck --check-prefixes CHECK-STATS %s
56
#include <sycl/usm.hpp>
67

78
/// This test is used to check enabling/disabling memory overhead statistics
@@ -12,20 +13,26 @@ constexpr std::size_t group_size = 1;
1213

1314
int main() {
1415
sycl::queue Q;
15-
int *array = sycl::malloc_device<int>(1024 * 1024, Q);
16+
int *array1 = sycl::malloc_device<int>(10 * 1024 * 1024, Q);
17+
int *array2 = sycl::malloc_device<int>(10 * 1024 * 1024, Q);
18+
int *array3 = sycl::malloc_device<int>(10 * 1024 * 1024, Q);
19+
20+
sycl::free(array2, Q);
21+
sycl::free(array3, Q);
1622

1723
Q.submit([&](sycl::handler &cgh) {
1824
auto acc = sycl::local_accessor<int>(group_size, cgh);
1925
cgh.parallel_for<class MyKernel>(
2026
sycl::nd_range<1>(N, group_size), [=](sycl::nd_item<1> item) {
21-
array[item.get_global_id()] = acc[item.get_local_id()];
27+
array1[item.get_global_id()] = acc[item.get_local_id()];
2228
});
2329
});
2430
Q.wait();
2531
// CHECK-STATS: Stats
2632
// CHECK-NOT: Stats
2733

28-
sycl::free(array, Q);
34+
sycl::free(array1, Q);
35+
2936
std::cout << "PASS" << std::endl;
3037
return 0;
3138
}

0 commit comments

Comments
 (0)