[Mlir-commits] [mlir] [mlir][linalg] Reimplement SimplifyPackToExpandShape and SimplifyUnPackToCollapseShape for more cases. (PR #204971)

Jerry Shih llvmlistbot at llvm.org
Sun Jun 21 03:45:41 PDT 2026


================
@@ -5969,7 +5956,13 @@ LogicalResult PackOp::canonicalize(PackOp packOp, PatternRewriter &rewriter) {
   }
 
   // Fold optional PaddingValue operand away if padding is not needed.
-  if (packOp.getPaddingValue() && paddingIsNotNeeded(packOp)) {
+  // Reject the dynamic tile size here.
+  if (packOp.getPaddingValue() &&
+      !ShapedType::isDynamicShape(packOp.getStaticInnerTiles()) &&
----------------
JerryShih wrote:

@banach-space @joker-eph 
could you help to check this pr?
The `requirePaddingValueStrict()` will check the folding result of tile size. But it looks like the canonicalize pass only checking for `static` size.

https://github.com/llvm/llvm-project/blob/e0cc08dc1121126392df2b832ee060a60cca6dc3/mlir/test/Dialect/Linalg/canonicalize.mlir#L1550-L1565


https://github.com/llvm/llvm-project/pull/204971


More information about the Mlir-commits mailing list