This is an archive of the discontinued LLVM Phabricator instance.

[mlir] GreedyPatternRewriter: Reprocess modified ops
ClosedPublic

Authored by springerm on Nov 15 2022, 8:02 AM.

Details

Summary

Ops that were modifed in-place (finalizeRootUpdate was called) should be reprocessed by the GreedyPatternRewriter. This is currently not happening with GreedyRewriteConfig::maxIterations = 1.

Note: If your project goes into an infinite loop because of this change, you likely have one or multiple faulty patterns that modify the same operations in-place (updateRootInplace) indefinitely.

Diff Detail

Event Timeline

springerm created this revision.Nov 15 2022, 8:02 AM
springerm requested review of this revision.Nov 15 2022, 8:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 15 2022, 8:02 AM

(There is still a problem with this change. It is crashing vector-transfer-full-partial-split.mlir.)

Is this something we can test for?

The change makes sense to me, but it'd be nice to add a test if we can.

springerm updated this revision to Diff 475730.Nov 16 2022, 2:02 AM

address comments

springerm edited the summary of this revision. (Show Details)Nov 16 2022, 2:05 AM
rriddle added inline comments.Nov 16 2022, 11:38 AM
mlir/unittests/Transforms/GreedyPatternRewriteDriver.cpp
19–31

It would be nice if we could just have something on one of the existing test passes, instead of using a unittest. We generally don't use unittests to test IR/pattern/transformation/etc. changes.

See mlir/test/lib/Dialect/Test/TestPatterns.cpp

springerm updated this revision to Diff 476049.Nov 17 2022, 1:35 AM
springerm edited the summary of this revision. (Show Details)

address comments

springerm planned changes to this revision.Nov 17 2022, 1:35 AM
springerm requested review of this revision.
springerm marked an inline comment as done.
rriddle accepted this revision.Nov 17 2022, 8:30 PM

LGTM, but the windows build failure there looks real. Please resolve that before landing.

This revision is now accepted and ready to land.Nov 17 2022, 8:30 PM
springerm updated this revision to Diff 476390.Nov 18 2022, 2:18 AM

fix Windows build

This revision was automatically updated to reflect the committed changes.