This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add support for filtering patterns based on debug names and labels
ClosedPublic

Authored by rriddle on May 13 2021, 1:54 PM.

Details

Summary

This revision allows for attaching "debug labels" to patterns, and provides to FrozenRewritePatternSet for filtering patterns based on these labels (in addition to the debug name of the pattern). This will greatly simplify the ability to write tests targeted towards specific patterns (in cases where many patterns may interact), will also simplify debugging pattern application by observing how application changes when enabling/disabling specific patterns.

To enable better reuse of pattern rewrite options between passes, this revision also adds a new PassUtil.td file to the Rewrite/ library that will allow for passes to easily hook into a common interface for pattern debugging. Two options are used to seed this utility, disable-patterns and enable-patterns, which are used to enable the filtering behavior indicated above.

Depends On D102440

Diff Detail

Event Timeline

rriddle created this revision.May 13 2021, 1:54 PM
rriddle requested review of this revision.May 13 2021, 1:54 PM
mehdi_amini accepted this revision.May 21 2021, 12:26 PM
mehdi_amini added inline comments.
mlir/include/mlir/IR/PatternMatch.h
230

How sensitive are we to the size of this struct? Should we use SmallVector<StringRef, 0> or something like that here?

mlir/include/mlir/Pass/PassOptions.h
186

I don't understand how this cast works?
(also can this be a static_cast?)

This revision is now accepted and ready to land.May 21 2021, 12:26 PM
This revision was landed with ongoing or failed builds.Jun 2 2021, 12:05 PM
This revision was automatically updated to reflect the committed changes.
rriddle marked 2 inline comments as done.