[all-commits] [llvm/llvm-project] d1fc59: [mlir][ArmSME] Rewrite illegal `shape_casts` to `v...
Benjamin Maxwell via All-commits
all-commits at lists.llvm.org
Thu Mar 7 09:04:35 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d1fc59c3b5c5ce292a6060d7a5545094cdf1b5fc
https://github.com/llvm/llvm-project/commit/d1fc59c3b5c5ce292a6060d7a5545094cdf1b5fc
Author: Benjamin Maxwell <benjamin.maxwell at arm.com>
Date: 2024-03-07 (Thu, 07 Mar 2024)
Changed paths:
M mlir/lib/Dialect/ArmSME/Transforms/VectorLegalization.cpp
M mlir/test/Dialect/ArmSME/vector-legalization.mlir
Log Message:
-----------
[mlir][ArmSME] Rewrite illegal `shape_casts` to `vector.transpose` ops (#82985)
This adds a rewrite that converts illegal 2D unit-dim `shape_casts` into
`vector.transpose` ops.
E.g.
```mlir
// Case 1:
%a = vector.shape_cast %0 : vector<[4]x1xf32> to vector<1x[4]xf32>
// Case 2:
%b = vector.shape_cast %1 : vector<[4]x1xf32> to vector<[4]xf32>
```
Becomes:
```mlir
// Case 1:
%a = vector.transpose %0 : [1, 0] vector<[4]x1xf32> to vector<1x[4]xf32>
// Case 2:
%t = vector.transpose %1 : [1, 0] vector<[4]x1xf32> to vector<1x[4]xf32>
%b = vector.shape_cast %t : vector<1x[4]xf32> to vector<[4]xf32>
```
Various lowerings and drop unit-dims patterns add such shape_casts,
however, if they do not cancel out (which they likely won't if we've
reached the vector-legalization pass) they will prevent lowering the IR.
Rewriting them as a transpose gives `LiftIllegalVectorTransposeToMemory`
a chance to eliminate the illegal types.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list