[Mlir-commits] [mlir] [mlir][vector] Add a check to ensure input vector rank equals target shape rank (PR #127706)
Prakhar Dixit
llvmlistbot at llvm.org
Tue Feb 25 09:47:31 PST 2025
================
@@ -768,6 +768,15 @@ func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
// -----
+func.func @extract_strided_slice(%arg0: vector<3x2x2xf32>) {
+ // expected-error at +1 {{expected input vector rank to match target shape rank}}
----------------
Prakhar-Dixit wrote:
No, I guess not, because extracting a 2D slice from a 3D vector is not supported. As a result, an error is thrown indicating that the resulting vector type must be a 3D vector. This behavior is already verified by the following test:
```
func.func @extract_strided_slice(%arg0: vector<4x8x16xf32>) {
// expected-error at +1 {{op expected result type to be 'vector<2x8x16xf32>'}}
%1 = vector.extract_strided_slice %arg0 {offsets = [2], sizes = [2], strides = [1]} : vector<4x8x16xf32> to vector<3x1xf32>
}
```
https://github.com/llvm/llvm-project/pull/127706
More information about the Mlir-commits
mailing list