[Mlir-commits] [mlir] [mlir][linalg] Use vector.shuffle to flatten conv filter (PR #75038)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Thu Dec 14 01:44:17 PST 2023
banach-space wrote:
@nicolasvasilache If you don't have strong objections, I would like to go ahead and land this.
We discussed this offline on Tue and you suggested that it would be better to create a pattern to match:
```mlir
%b_filter = vector.broadcast %filter : vector<4xf32> to vector<3x2x4xf32>
%sc_filter = vector.shape_cast %b_filter : vector<3x2x4xf32> to vector<3x8xf32>
```
and to replace it with:
```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>
```
However, it's not clear to me how to go about it. Also, mindful of the recent discussions on `vector.shape_cast`, I feel that it would actually be preferred to avoid generating `vector.shape_cast` to begin with.
Separately, this removes one problem with "flattened" convs (flattening the filter). There are still a few other issues that I need to address (flattening the input/output vectors and making that work at both Tensor and Memref level). By landing this I can re-focus on the other issues.
If there are no new comments I will merge it this week. Happy to work on an alternative solution, but I may need some guidance :)
https://github.com/llvm/llvm-project/pull/75038
More information about the Mlir-commits
mailing list