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

Ryan Thomas Lynch llvmlistbot at llvm.org
Mon Jun 3 10:09:59 PDT 2024


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

I have 3 reasons to disagree.

1. This is already done in greedy rewriter.
https://github.com/llvm/llvm-project/blob/ffec63b6a54f719976443cc17b6226030be17c52/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp#L760-L769

2. I disagree that match failure should be eliminated from a release build. For example, in my use case, we use `notifyMatchFailure` on patterns that we _must_ run to support conversions that lower from higher-level to lower-level dialects. I consider a failure to match a required lowering pattern as something more helpful to the user than just emitting "failure to legalize operation explicitly marked illegal".

3. Even if we only notify match failure in a non-release build, my understanding of the `LLVM_DEBUG` macro is that it only runs if the command line option `--debug` or `--debug-only=<debug type>" is specified.

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


More information about the Mlir-commits mailing list