[all-commits] [llvm/llvm-project] f11bda: [mlir][linalg] Use vector.shuffle to flatten conv ...
Andrzej Warzyński via All-commits
all-commits at lists.llvm.org
Fri Dec 15 09:57:13 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f11bda78c8fc551cf3e22cd5caa4005c329b904f
https://github.com/llvm/llvm-project/commit/f11bda78c8fc551cf3e22cd5caa4005c329b904f
Author: Andrzej Warzyński <andrzej.warzynski at arm.com>
Date: 2023-12-15 (Fri, 15 Dec 2023)
Changed paths:
M mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
M mlir/test/Dialect/Linalg/vectorize-convolution-flatten.mlir
Log Message:
-----------
[mlir][linalg] Use vector.shuffle to flatten conv filter (#75038)
Updates the vectorisation of 1D depthwise convolution when flattening
the channel dimension (introduced in #71918). In particular - how the
convolution filter is "flattened". ATM, the vectoriser will use
`vector.shape_cast`:
```mlir
%b_filter = vector.broadcast %filter : vector<4xf32> to vector<3x2x4xf32>
%sc_filter = vector.shape_cast %b_filter : vector<3x2x4xf32> to vector<3x8xf32>
```
This lowering is not ideal - `vector.shape_cast` can be convenient when
it's folded away, but that's not happening in this case. Instead, this
patch updates the vectoriser to use `vector.shuffle` (the overall result
is identical):
```mlir
%sh_filter = vector.shuffle %filter, %filter
[0, 1, 2, 3, 0, 1, 2, 3] : vector<4xf32>, vector<4xf32>
%b_filter = vector.broadcast %sh_filter : vector<8xf32> to vector<3x8xf32>
```
More information about the All-commits
mailing list