This is an archive of the discontinued LLVM Phabricator instance.

[mlir:GreedyPatternRewriter] Add debug logging for pattern rewriter actions
ClosedPublic

Authored by rriddle on Oct 19 2021, 9:08 PM.

Details

Summary

This effectively mirrors the logging in dialect conversion, which has proven
very useful for understanding the pattern application process.

Diff Detail

Event Timeline

rriddle created this revision.Oct 19 2021, 9:08 PM
rriddle requested review of this revision.Oct 19 2021, 9:08 PM
jpienaar accepted this revision.Oct 21 2021, 9:39 AM

Nice, thanks!

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

Could we print ops with regions just with regions elided? (I thought we had such an option)

This revision is now accepted and ready to land.Oct 21 2021, 9:39 AM
rriddle marked an inline comment as done.Oct 21 2021, 10:05 AM
rriddle added inline comments.
mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
177

We've talked about it before, but haven't actually added the option yet. I did some sneaky hacky thing in the lsp-server, but that technique doesn't apply well generally. I can look at adding a real option to skip regions in a followup (given that it is a common desire in many printing cases).

This revision was landed with ongoing or failed builds.Oct 21 2021, 10:15 AM
This revision was automatically updated to reflect the committed changes.
rriddle marked an inline comment as done.
mehdi_amini added inline comments.Oct 21 2021, 6:42 PM
mlir/docs/PatternRewriter.md
353

It's probably worth mentioning that this is enabled only in an assert build

This is really useful - thanks!

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

It would be great to have such an option and it could perhaps even be the default here. I've often wanted to dump funcs, fors, and ifs without their regions, and this would be useful for debugging in general. I can't see any such option on OpPrintingFlags at the moment.