[Mlir-commits] [mlir] MLIR Rewriters: add new listener to emit match failures to user, enhance docs (PR #94130)

Mehdi Amini llvmlistbot at llvm.org
Mon Jun 3 19:13:28 PDT 2024


================
@@ -1620,6 +1620,8 @@ void ConversionPatternRewriterImpl::notifyMatchFailure(
     if (config.notifyCallback)
       config.notifyCallback(diag);
   });
+  if (config.listener)
+    config.listener->notifyMatchFailure(loc, reasonCallback);
----------------
joker-eph wrote:

>  then can you help me explain why in the documentation?

It is meant as a zero-cost (in production) debugging feature, like assertions or every other "-debug" enabled messages. If you feel this needs a clarification in the documentation, we can do this of course.

The greedyRewriterAddition smells wrong to me, I'll follow up with @matthias-springer on this.

The current setup for patterns is that failure to match isn't a problem and is expected: there may be other patterns that will succeed. So there messages aren't meant to be useful to any end users right now.


Note that we could revisit the design, I'm pointing out what the consensus was in the core team when we designed the feature.

https://github.com/llvm/llvm-project/pull/94130


More information about the Mlir-commits mailing list