Skip to content

Commit d6d73ec

Browse files
authored
[mlir][vector] Disable vector.flat_transpose for scalable vectors (#115338)
Disables `vector.flat_transpose` for scalable vectors. As per the docs: > This is the counterpart of llvm.matrix.transpose in MLIR I'm not aware of any use of any matrix-multiply intrinsics in the context of scalable vectors, hence disabling. Note, this is a follow-on for #102573 in which I disabled `vector.matrix_multiply`.
1 parent f02b1cc commit d6d73ec

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

mlir/include/mlir/Dialect/Vector/IR/VectorOps.td

+5-3
Original file line numberDiff line numberDiff line change
@@ -2770,11 +2770,11 @@ def Vector_FlatTransposeOp : Vector_Op<"flat_transpose", [Pure,
27702770
TCresVTEtIsSameAsOpBase<0, 0>>]>,
27712771
Arguments<(
27722772
// TODO: tighten vector element types that make sense.
2773-
ins VectorOfRankAndType<[1],
2773+
ins FixedVectorOfRankAndType<[1],
27742774
[AnySignlessInteger, AnySignedInteger, Index, AnyFloat]>:$matrix,
27752775
I32Attr:$rows, I32Attr:$columns)>,
27762776
Results<(
2777-
outs VectorOfRankAndType<[1],
2777+
outs FixedVectorOfRankAndType<[1],
27782778
[AnySignlessInteger, AnySignedInteger, Index, AnyFloat]>:$res)> {
27792779
let summary = "Vector matrix transposition on flattened 1-D MLIR vectors";
27802780
let description = [{
@@ -2789,7 +2789,9 @@ def Vector_FlatTransposeOp : Vector_Op<"flat_transpose", [Pure,
27892789
a 2-D matrix with <rows> rows and <columns> columns, and returns the
27902790
transposed matrix in flattened form in 'res'.
27912791

2792-
Also see:
2792+
Note, the corresponding LLVM intrinsic, `@llvm.matrix.transpose.*`, does not
2793+
support scalable vectors. Hence, this Op is only available for fixed-width
2794+
vectors. Also see:
27932795

27942796
http://llvm.org/docs/LangRef.html#llvm-matrix-transpose-intrinsic
27952797

mlir/test/Dialect/Vector/invalid.mlir

+9
Original file line numberDiff line numberDiff line change
@@ -1900,3 +1900,12 @@ func.func @matrix_multiply_scalable(%a: vector<[4]xf64>, %b: vector<4xf64>) {
19001900

19011901
return
19021902
}
1903+
1904+
// -----
1905+
1906+
func.func @flat_transpose_scalable(%arg0: vector<[16]xf32>) -> vector<[16]xf32> {
1907+
// expected-error @+1 {{'vector.flat_transpose' op operand #0 must be fixed-length vector of signless integer or signed integer or index or floating-point values of ranks 1, but got 'vector<[16]xf32>'}}
1908+
%0 = vector.flat_transpose %arg0 { rows = 4: i32, columns = 4: i32 }
1909+
: vector<[16]xf32> -> vector<[16]xf32>
1910+
return %0 : vector<[16]xf32>
1911+
}

0 commit comments

Comments
 (0)