Skip to content

Commit 34aeaba

Browse files
authored
[SYCL][DeviceASAN] Fix AcceeChain to a matrix for bfloat16 (#16323)
If element type is bfloat16 its storage will be accessed via GEP. So need to skip this GEP during AccessChain handling. Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
1 parent e9143ca commit 34aeaba

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
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

0 commit comments

Comments
 (0)