[Mlir-commits] [mlir] [mlir] Add reshape propagation patterns for tensor.pad (PR #94489)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jun 5 13:15:02 PDT 2024


================
@@ -1937,6 +2069,8 @@ void mlir::linalg::populateFoldReshapeOpsByExpansionPatterns(
     const ControlFusionFn &controlFoldingReshapes) {
   patterns.add<FoldReshapeWithGenericOpByExpansion>(patterns.getContext(),
                                                     controlFoldingReshapes);
+  patterns.add<FoldPadWithProducerReshapeOpByExpansion>(patterns.getContext(),
----------------
MaheshRavishankar wrote:

AFAICS both the patterns added here are "propagating by collapsing". You are moving the expand_shape down and collapse_shape up. In both cases the pad is happening on collapsed dimensions. So you should add both to the `populateFoldReshapeOpsByCollapsingPatterns`.

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


More information about the Mlir-commits mailing list