diff options
author | Twice <twice@apache.org> | 2025-01-13 00:02:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-12 16:02:41 +0000 |
commit | b91d5af1ac3ad2c18b1dfde2061a6ac1d638e6e4 (patch) | |
tree | 13327f34c987cda25dc4253ad8026d6a3356129e /llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp | |
parent | be6c752e157638849f1f59f7e2b7ecbe11a022fe (diff) | |
download | llvm-b91d5af1ac3ad2c18b1dfde2061a6ac1d638e6e4.zip llvm-b91d5af1ac3ad2c18b1dfde2061a6ac1d638e6e4.tar.gz llvm-b91d5af1ac3ad2c18b1dfde2061a6ac1d638e6e4.tar.bz2 |
[MLIR][Vector] Allow any strided memref for one-element vector.load in lowering vector.gather (#122437)
In `Gather1DToConditionalLoads`, currently we will check if the stride
of the most minor dim of the input memref is 1. And if not, the
rewriting pattern will not be applied. However, according to the
verification of `vector.load` here:
https://github.com/llvm/llvm-project/blob/4e32271e8b304eb018c69f74c16edd1668fcdaf3/mlir/lib/Dialect/Vector/IR/VectorOps.cpp#L4971-L4975
.. if the output vector type of `vector.load` contains only one element,
we can ignore the requirement of the stride of the input memref, i.e.
the input memref can be with any stride layout attribute in such case.
So here we can allow more cases in lowering `vector.gather` by relaxing
such check.
As shown in the test case attached in this patch
[here](https://github.com/llvm/llvm-project/blob/1933fbad58302814ccce5991a9320c0967f3571b/mlir/test/Dialect/Vector/vector-gather-lowering.mlir#L151),
now `vector.gather` of memref with non-trivial stride can be lowered
successfully if the result vector contains only one element.
---------
Signed-off-by: PragmaTwice <twice@apache.org>
Co-authored-by: Andrzej WarzyĆski <andrzej.warzynski@gmail.com>
Diffstat (limited to 'llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions