[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
================
@@ -220,6 +220,31 @@ struct FoldPadWithPackOp : public OpRewritePattern<PackOp> {
if (!isEqualConstantIntOrValue(paddingValue, constantPaddingValue))
return failure();
+ // Folding is not allowed if it introduces artificial padding. It is not
+ // safe to fold the ops if any dynamic dimension or tile size is present,
+ // because we can not infer the padding size.
----------------
banach-space wrote:
OK, I am re-reading this and realising that I got confused. Basically, in the case of "dynamic" sizes we bail out conservatively because there could be "artificial" padding, but it is impossible to check. That was not clear to me initially.
```suggestion
// Folding is not allowed if it were to introduce artificial padding. Folding is also disabled In the case of dynamic dimensions and/or tile sizes - that is because it would be impossible to compute the padding size and hence to establish whether "artificial" padding would be created.
```
https://github.com/llvm/llvm-project/pull/150272
More information about the Mlir-commits
mailing list