Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit c871081

Browse files
authored
[mlir] Enable decoupling two kinds of greedy behavior. (#104649)
The greedy rewriter is used in many different flows and it has a lot of convenience (work list management, debugging actions, tracing, etc). But it combines two kinds of greedy behavior 1) how ops are matched, 2) folding wherever it can. These are independent forms of greedy and leads to inefficiency. E.g., cases where one need to create different phases in lowering and is required to applying patterns in specific order split across different passes. Using the driver one ends up needlessly retrying folding/having multiple rounds of folding attempts, where one final run would have sufficed. Of course folks can locally avoid this behavior by just building their own, but this is also a common requested feature that folks keep on working around locally in suboptimal ways. For downstream users, there should be no behavioral change. Updating from the deprecated should just be a find and replace (e.g., `find ./ -type f -exec sed -i 's|applyPatternsAndFoldGreedily|applyPatternsGreedily|g' {} \;` variety) as the API arguments hasn't changed between the two.
1 parent bad6b99 commit c871081

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

mlir/lib/CAPI/Transforms/Rewrite.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,7 @@ MlirLogicalResult
289289
mlirApplyPatternsAndFoldGreedily(MlirModule op,
290290
MlirFrozenRewritePatternSet patterns,
291291
MlirGreedyRewriteDriverConfig) {
292-
return wrap(
293-
mlir::applyPatternsAndFoldGreedily(unwrap(op), *unwrap(patterns)));
292+
return wrap(mlir::applyPatternsGreedily(unwrap(op), *unwrap(patterns)));
294293
}
295294

296295
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)