It would be great to have a diagnostic that would fire in debug mode on pattern applications (e.g. the GreedyPatternRewriter).
At this time, patterns mostly exclusively
return failure which is not very informative when trying to understand why a pattern failed to apply.
OTOH (I think) using any of the existing diagnostics would generate a lot of spew.
Would it make sense to have some sort of silenceable diagnostic that could trigger selectively for such use cases?
Most things I have seen use the LLVM_DEBUG facility. Not saying it is great/best but does work.
In the manually written ones? E.g., rewriter.notifyMatchFailure is often used.
There was a design for an interactive pattern/pass/transformation debugger using
DebugActions (@mehdi_amini @ChiaHungDuan). The goal was to make debugging large pattern sets more tractable, e.g., by setting “breakpoints” on specific patterns.
Reviving that work is on the table, but I’m wondering what exactly you have in mind? A command-line option to select which pattern to enable diagnostics for?
I am working on a debugger indeed, but for this case I think that @jpienaar suggestion seems best: what’s missing from this? Haven’t we brought the debug of the greedy rewriter on par with dialect conversion?
thanks, had completely forgotten about