Skip to content

Commit 6b76c4e

Browse files
[mlir][linalg] Bring populateFoldUnitExtentDimsVia(Reshapes/Slices)Patterns in sync
Make sure that both functions populate patterns with the same functionality. Both should be refactored at some point so that canonicalization patterns are not populated. Differential Revision: https://reviews.llvm.org/D140372
1 parent def915c commit 6b76c4e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,12 @@ void mlir::linalg::populateFoldUnitExtentDimsViaSlicesPatterns(
686686
patterns.add<ReplaceUnitExtents>(context,
687687
RankReductionStrategy::ExtractInsertSlice);
688688
patterns.add<FoldUnitDimLoops>(context);
689+
// TODO: Patterns unrelated to unit dim folding should be factored out.
690+
linalg::FillOp::getCanonicalizationPatterns(patterns, context);
691+
tensor::EmptyOp::getCanonicalizationPatterns(patterns, context);
692+
tensor::populateFoldTensorEmptyPatterns(patterns);
693+
memref::populateResolveRankedShapeTypeResultDimsPatterns(patterns);
694+
memref::populateResolveShapedTypeResultDimsPatterns(patterns);
689695
}
690696

691697
void mlir::linalg::populateMoveInitOperandsToInputPattern(

0 commit comments

Comments
 (0)