[all-commits] [llvm/llvm-project] 3a1ae2: [mlir][vector] Fix invalid `LoadOp` indices being ...
Rik Huijzer via All-commits
all-commits at lists.llvm.org
Sun Dec 17 02:42:48 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3a1ae2f46db473cfde4baa6e1b090f5dae67e8db
https://github.com/llvm/llvm-project/commit/3a1ae2f46db473cfde4baa6e1b090f5dae67e8db
Author: Rik Huijzer <github at huijzer.xyz>
Date: 2023-12-17 (Sun, 17 Dec 2023)
Changed paths:
M mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
M mlir/test/Conversion/VectorToSCF/vector-to-scf.mlir
M mlir/test/Dialect/MemRef/invalid.mlir
Log Message:
-----------
[mlir][vector] Fix invalid `LoadOp` indices being created (#75519)
Fixes https://github.com/llvm/llvm-project/issues/71326.
The cause of the issue was that a new `LoadOp` was created which looked
something like:
```mlir
%arg4 =
func.func main(%arg1 : index, %arg2 : index) {
%alloca_0 = memref.alloca() : memref<vector<1x32xi1>>
%1 = vector.type_cast %alloca_0 : memref<vector<1x32xi1>> to memref<1xvector<32xi1>>
%2 = memref.load %1[%arg1, %arg2] : memref<1xvector<32xi1>>
return
}
```
which crashed inside the `LoadOp::verify`. Note here that `%alloca_0` is
0 dimensional, `%1` has one dimension, but `memref.load` tries to index
`%1` with two indices.
This is now fixed by using the fact that `unpackOneDim` always unpacks
one dim
https://github.com/llvm/llvm-project/blob/1bce61e6b01b38e04260be4f422bbae59c34c766/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp#L897-L903
and so the `loadOp` should just index only one dimension.
---------
Co-authored-by: Benjamin Maxwell <macdue at dueutil.tech>
More information about the All-commits
mailing list