This is an archive of the discontinued LLVM Phabricator instance.

[mlir][NFC] GreedyPatternRewriteDriver: Merge region-based and multi-op-based drivers
ClosedPublic

Authored by springerm on Jan 10 2023, 9:02 AM.

Details

Summary

Deduplicate large parts of the worklist processing (GreedyPatternRewriteDriver::processWorklist).

The new class hierarchy is as follows:

          GreedyPatternRewriteDriver (abstract)
                       ^
                       |
      -----------------------------------
      |                                 |
RegionPatternRewriteDriver         MultiOpPatternRewriteDriver

Also update the Markdown documentation.

Depends On: D142623

Diff Detail

Event Timeline

springerm created this revision.Jan 10 2023, 9:02 AM
springerm requested review of this revision.Jan 10 2023, 9:02 AM

I have failures in downstream projects, marking as NFC until I figured out what's going on.

This revision got pretty big. I could factor some things out.

springerm retitled this revision from [WIP][mlir][NFC] GreedyPatternRewriteDriver: Merge single + multi op rewriter to [WIP][mlir][NFC] GreedyPatternRewriteDriver.cpp: Merge single + multi op rewriter.Jan 10 2023, 9:06 AM
springerm edited the summary of this revision. (Show Details)
springerm retitled this revision from [WIP][mlir][NFC] GreedyPatternRewriteDriver.cpp: Merge single + multi op rewriter to [mlir][NFC] GreedyPatternRewriteDriver.cpp: Merge single + multi op rewriter.Jan 11 2023, 3:37 AM
springerm edited the summary of this revision. (Show Details)
springerm edited the summary of this revision. (Show Details)
springerm retitled this revision from [mlir][NFC] GreedyPatternRewriteDriver.cpp: Merge single + multi op rewriter to [mlir] GreedyPatternRewriteDriver.cpp: Merge single + multi op rewriter.Jan 11 2023, 3:39 AM
springerm edited the summary of this revision. (Show Details)
springerm planned changes to this revision.Jan 17 2023, 8:53 AM

I'm splitting this up into multiple smaller changes.

springerm retitled this revision from [mlir] GreedyPatternRewriteDriver.cpp: Merge single + multi op rewriter to [mlir][NFC] GreedyPatternRewriteDriver: Merge region-based and multi-op-based drivers.Jan 26 2023, 7:26 AM
springerm edited the summary of this revision. (Show Details)

Is there some documentation to update?

mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
385

The "bottom up" part depends on the config.useTopDownTraversal doesn't it?

springerm updated this revision to Diff 492752.Jan 27 2023, 7:18 AM
springerm edited the summary of this revision. (Show Details)

address comments

springerm updated this revision to Diff 492753.Jan 27 2023, 7:26 AM
springerm marked an inline comment as done.

update

Is there some documentation to update?

I made another pass through the file and updated some comments.

mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
38

I sorted the functions in here alphabetically, but not the implementations below. That would make the diff harder to read.

Also updated many of the comments.

91

I made a few things private.

385

Ah yes that was copied from the original GreedyPatternRewriteDriver. Removed it as it was not entirely accurate.

473–477

I removed this comment and the one for simplify. This is already documented in GreedyPatternRewriteDriver.h. On the apply... functions and the strictMode field in the config.

Is there some documentation to update?

I was thinking about Markdown files, like this: https://mlir.llvm.org/docs/PatternRewriter/#greedy-pattern-rewrite-driver

springerm updated this revision to Diff 492760.Jan 27 2023, 8:03 AM

update md file

springerm edited the summary of this revision. (Show Details)Jan 27 2023, 8:03 AM
mehdi_amini accepted this revision.Jan 27 2023, 8:06 AM
This revision is now accepted and ready to land.Jan 27 2023, 8:06 AM
This revision was landed with ongoing or failed builds.Jan 27 2023, 8:32 AM
This revision was automatically updated to reflect the committed changes.