[Mlir-commits] [mlir] [mlir][linalg] Take artificial padding into account for pack/unpack folding. (PR #150272)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Thu Jul 24 05:15:30 PDT 2025
================
@@ -81,10 +91,10 @@ func.func @pad_pack(%src: tensor<16641x16xf32>) -> tensor<2082x1x8x32xf32> {
// -----
-func.func @nofold_pad_pack(%src: tensor<16641x16xf32>) -> tensor<2082x1x8x32xf32> {
+func.func @nofold_pad_pack_artificial_padding(%src: tensor<16641x16xf32>) -> tensor<2082x1x8x32xf32> {
----------------
banach-space wrote:
Side point about these tests ... Large sizes like `16656` or `2082` make it hard to see the significance of padding. IMO, this would be more readable:
```mlir
// Example 1
%padded = tensor.pad %src low[0, 0] high[7, 0] {
^bb0(%arg0: index, %arg1: index):
tensor.yield %cst : f32
} : tensor<9x16xf32> to tensor<16x16xf32>
```
Contrast this with:
```
```mlir
// Example 2
%padded = tensor.pad %src low[0, 0] high[8, 0] {
^bb0(%arg0: index, %arg1: index):
tensor.yield %cst : f32
} : tensor<9x16xf32> to tensor<17x16xf32>
```
and it becomes apparent that `Example 1` is a good candidate for "folding", whereas `Example 2` is not (due to "artificial padding").
No action required :)
https://github.com/llvm/llvm-project/pull/150272
More information about the Mlir-commits
mailing list