Skip to content

Commit

Permalink
[mlir][vector] Disable vector.flat_transpose for scalable vectors (l…
Browse files Browse the repository at this point in the history
…lvm#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 llvm#102573 in which I disabled
`vector.matrix_multiply`.
  • Loading branch information
banach-space committed Nov 7, 2024
1 parent bc7e099 commit 26e6a1d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [{
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions mlir/test/Dialect/Vector/invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -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>
}

0 comments on commit 26e6a1d

Please sign in to comment.