[mlir] Update docs for Greedy Pattern Rewrite Driver(NFC) (#126701)

The `applyOpPatternsAndFold` is deprecated, use
`applyOpPatternsGreedily` instead.
This commit is contained in:
Longsheng Mou
2025-02-17 22:11:49 +08:00
committed by GitHub
parent 18ea6c9280
commit 4e41e9ac4c
2 changed files with 8 additions and 7 deletions

View File

@@ -361,7 +361,7 @@ This driver comes in two fashions:
* `applyPatternsGreedily` ("region-based driver") applies patterns to
all ops in a given region or a given container op (but not the container op
itself). I.e., the worklist is initialized with all containing ops.
* `applyOpPatternsAndFold` ("op-based driver") applies patterns to the
* `applyOpPatternsGreedily` ("op-based driver") applies patterns to the
provided list of operations. I.e., the worklist is initialized with the
specified list of ops.

View File

@@ -56,13 +56,14 @@ static void applyPatterns(Region &region,
opsInRange.push_back(&op.value());
}
// `applyOpPatternsAndFold` may erase the ops so we can't do the pattern
// matching in above iteration. Besides, erase op not-in-range may end up in
// invalid module, so `applyOpPatternsAndFold` should come before that
// transform.
// `applyOpPatternsGreedily` with folding may erase the ops so we can't do the
// pattern matching in above iteration. Besides, erase op not-in-range may end
// up in invalid module, so `applyOpPatternsGreedily` with folding should come
// before that transform.
for (Operation *op : opsInRange) {
// `applyOpPatternsAndFold` returns whether the op is convered. Omit it
// because we don't have expectation this reduction will be success or not.
// `applyOpPatternsGreedily` with folding returns whether the op is
// convered. Omit it because we don't have expectation this reduction will
// be success or not.
GreedyRewriteConfig config;
config.strictMode = GreedyRewriteStrictness::ExistingOps;
(void)applyOpPatternsGreedily(op, patterns, config);