[Mlir-commits] [mlir] [mlir][vector] Add verification for incorrect vector.extract (PR #115824)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Thu Nov 21 06:59:51 PST 2024
https://github.com/banach-space approved this pull request.
A few minor comments inline and one request below, but otherwise LGTM. Thanks for the discussion!
----
This PR restricts vector.extract/vector.insert operations to ensure that 0-D vectors are only allowed when the "other" input is either:
* A 0-D vector, or
* An n-D vector with more than 1 element (e.g., `vector<8xf32>`).
Examples:
```mlir
// Valid
vector.extract %src_1[0]: vector<f32> from vector<8xf32>
// Invalid
vector.extract %src_2[0]: vector<f32> from vector<1xf32>
```
To me, this feels like a stepping stone toward further restricting (or even removing) the usage of 0-D vectors, which I fully support.
However, I found the behavior somewhat confusing initially. To improve clarity:
* Consider making the restrictions more explicit in `verifyInsertExtractIndicesAndShapes`.
* Update the operation description in VectorOps.td to reflect this behavior.
https://github.com/llvm/llvm-project/pull/115824
More information about the Mlir-commits
mailing list