[all-commits] [llvm/llvm-project] 8934f7: [LowerBufferFatPointers] Don't lose data from unal...
Krzysztof Drewniak via All-commits
all-commits at lists.llvm.org
Wed Mar 26 13:45:00 PDT 2025
Branch: refs/heads/users/zyin/tip-with-krzysztof-llvm-132981
Home: https://github.com/llvm/llvm-project
Commit: 8934f7db6bbb97fb5e0d911990070f628dc813dc
https://github.com/llvm/llvm-project/commit/8934f7db6bbb97fb5e0d911990070f628dc813dc
Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
Date: 2025-03-26 (Wed, 26 Mar 2025)
Changed paths:
M llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp
M llvm/test/CodeGen/AMDGPU/buffer-fat-pointers-contents-legalization.ll
M llvm/test/CodeGen/AMDGPU/lower-buffer-fat-pointers-contents-legalization.ll
Log Message:
-----------
[LowerBufferFatPointers] Don't lose data from unaligned < word vectors
Previously, AMDGPULowerBufferFatPointers would always cast long
vectors of small types, such as <8 x i8> or <2 x f16> to instructions
that operate on words, like loading/storing <2 x i32> and i32,
respectively.
This transformation is correct - and correctly returns 0s for loads
where the vector is partially in bounds - only if the offset of the
vector is word-aligned. That is, supposing a buffer has a numRecords
of 8, loading a <8 x i8> starting at offset 4 will correctly return
the last word of the buffer and 4 0s. However, if one instead starts
at offset 6 or 7 (for an alignment of 2 and 1, respectively), the
hardware will mask off the entire word, causing an all-0 result.
To inhibit this surprising and undesired behavior, loads/stores of
vectors with sub-word elements that aren't aligned to at least a word
will be broken down into scalar reads and writes, preserving the
expected out-of-bounds behavior.
This transformation will still load at least one element at a time, so
a <4 x half>, align 1 load will still use buffer_load_ushort.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list