[all-commits] [llvm/llvm-project] 0473e3: [mlir][ArmSME] Add rewrite to lift illegal vector....
Benjamin Maxwell via All-commits
all-commits at lists.llvm.org
Tue Feb 6 01:31:07 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0473e322f67228a9c2dbf462357e5b4a2b3799be
https://github.com/llvm/llvm-project/commit/0473e322f67228a9c2dbf462357e5b4a2b3799be
Author: Benjamin Maxwell <benjamin.maxwell at arm.com>
Date: 2024-02-06 (Tue, 06 Feb 2024)
Changed paths:
M mlir/lib/Dialect/ArmSME/Transforms/VectorLegalization.cpp
M mlir/test/Dialect/ArmSME/vector-legalization.mlir
Log Message:
-----------
[mlir][ArmSME] Add rewrite to lift illegal vector.transposes to memory (#80170)
When unrolling the reduction dimension of something like a matmul for
SME, you can end up with transposed reads of illegal types, like so:
```mlir
%illegalRead = vector.transfer_read %memref[%a, %b]
: memref<?x?xf32>, vector<[8]x4xf32>
%legalType = vector.transpose %illegalRead, [1, 0]
: vector<[8]x4xf32> to vector<4x[8]xf32>
```
Here the `vector<[8]x4xf32>` is an illegal type, there's no way to lower
a scalable vector of fixed vectors. However, as the final type
`vector<4x[8]xf32>` is legal, we can instead lift the transpose to
memory (producing a strided memref), and eliminate all the illegal
types. This is shown below.
```mlir
%readSubview = memref.subview %memref[%a, %b] [%c8_vscale, %c4] [%c1, %c1]
: memref<?x?xf32> to memref<?x?xf32>
%transpose = memref.transpose %readSubview (d0, d1) -> (d1, d0)
: memref<?x?xf32> to memref<?x?xf32>
%legalType = vector.transfer_read %transpose[%c0, %c0]
: memref<?x?xf32>, vector<4x[8]xf32>
```
More information about the All-commits
mailing list