[Mlir-commits] [mlir] andrzej/disable flat transpose scalable (PR #115338)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Thu Nov 7 08:32:35 PST 2024
https://github.com/banach-space updated https://github.com/llvm/llvm-project/pull/115338
>From 3d6c62c8796d63b53281045a22d7e6e051e2cb8a Mon Sep 17 00:00:00 2001
From: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: Thu, 7 Nov 2024 16:15:51 +0000
Subject: [PATCH] [mlir][vector] Disable `vector.flat_transpose` for scalable
vectors (#102573)
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`.
---
mlir/include/mlir/Dialect/Vector/IR/VectorOps.td | 8 ++++++--
mlir/test/Dialect/Vector/invalid.mlir | 9 +++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
index 3f45d0804e0450..6fe897cca79926 100644
--- a/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
+++ b/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
@@ -2770,11 +2770,11 @@ def Vector_FlatTransposeOp : Vector_Op<"flat_transpose", [Pure,
TCresVTEtIsSameAsOpBase<0, 0>>]>,
Arguments<(
// TODO: tighten vector element types that make sense.
- ins VectorOfRankAndType<[1],
+ ins FixedVectorOfRankAndType<[1],
[AnySignlessInteger, AnySignedInteger, Index, AnyFloat]>:$matrix,
I32Attr:$rows, I32Attr:$columns)>,
Results<(
- outs VectorOfRankAndType<[1],
+ outs FixedVectorOfRankAndType<[1],
[AnySignlessInteger, AnySignedInteger, Index, AnyFloat]>:$res)> {
let summary = "Vector matrix transposition on flattened 1-D MLIR vectors";
let description = [{
@@ -2789,6 +2789,10 @@ def Vector_FlatTransposeOp : Vector_Op<"flat_transpose", [Pure,
a 2-D matrix with <rows> rows and <columns> columns, and returns the
transposed matrix in flattened form in 'res'.
+ Note, the corresponding LLVM intrinsic, `@llvm.matrix.transpose.*`, does not
+ support scalable vectors. Hence, this Op is only available for fixed-width
+ vectors. Also see:
+
Also see:
http://llvm.org/docs/LangRef.html#llvm-matrix-transpose-intrinsic
diff --git a/mlir/test/Dialect/Vector/invalid.mlir b/mlir/test/Dialect/Vector/invalid.mlir
index 56039d04549aa5..d591c60acb64e7 100644
--- a/mlir/test/Dialect/Vector/invalid.mlir
+++ b/mlir/test/Dialect/Vector/invalid.mlir
@@ -1900,3 +1900,12 @@ func.func @matrix_multiply_scalable(%a: vector<[4]xf64>, %b: vector<4xf64>) {
return
}
+
+// -----
+
+func.func @flat_transpose_scalable(%arg0: vector<[16]xf32>) -> vector<[16]xf32> {
+ // 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>'}}
+ %0 = vector.flat_transpose %arg0 { rows = 4: i32, columns = 4: i32 }
+ : vector<[16]xf32> -> vector<[16]xf32>
+ return %0 : vector<[16]xf32>
+}
More information about the Mlir-commits
mailing list