[Mlir-commits] [mlir] [MLIR] Print more user-friendly error message when generating local reproducer and threading is enabled (PR #144905)
Artemiy Bulavin
llvmlistbot at llvm.org
Fri Jun 20 03:15:24 PDT 2025
https://github.com/abulavin updated https://github.com/llvm/llvm-project/pull/144905
>From b5826708debcb41787d565bc608cb18eb0823919 Mon Sep 17 00:00:00 2001
From: Artemiy Bulavin <artemiyb at graphcore.ai>
Date: Thu, 19 Jun 2025 13:37:21 +0000
Subject: [PATCH 1/3] Print more user-friendly error message when generating
local reproducer and threading is enabled
fixup: remove module in test
---
mlir/lib/Pass/PassManagerOptions.cpp | 8 ++++++++
mlir/test/mlir-opt/local-reproducer-with-threading.mlir | 5 +++++
2 files changed, 13 insertions(+)
create mode 100644 mlir/test/mlir-opt/local-reproducer-with-threading.mlir
diff --git a/mlir/lib/Pass/PassManagerOptions.cpp b/mlir/lib/Pass/PassManagerOptions.cpp
index dd119a75f4069..305bf72bb4799 100644
--- a/mlir/lib/Pass/PassManagerOptions.cpp
+++ b/mlir/lib/Pass/PassManagerOptions.cpp
@@ -146,6 +146,14 @@ LogicalResult mlir::applyPassManagerCLOptions(PassManager &pm) {
if (!options.isConstructed())
return failure();
+ if (options->reproducerFile.getNumOccurrences() && options->localReproducer &&
+ pm.getContext()->isMultithreadingEnabled()) {
+ emitError(UnknownLoc::get(pm.getContext()))
+ << "Local crash reproduction may not be used without disabling "
+ "mutli-threading first.";
+ return failure();
+ }
+
// Generate a reproducer on crash/failure.
if (options->reproducerFile.getNumOccurrences())
pm.enableCrashReproducerGeneration(options->reproducerFile,
diff --git a/mlir/test/mlir-opt/local-reproducer-with-threading.mlir b/mlir/test/mlir-opt/local-reproducer-with-threading.mlir
new file mode 100644
index 0000000000000..10ebaed1c63da
--- /dev/null
+++ b/mlir/test/mlir-opt/local-reproducer-with-threading.mlir
@@ -0,0 +1,5 @@
+// Test that attempting to create a local crash reproducer without disabling threading
+// prints an error from the pass manager (as opposed to crashing with a stack trace).
+
+// RUN: mlir-opt --mlir-pass-pipeline-local-reproducer --mlir-pass-pipeline-crash-reproducer=%t 2>&1 %s | FileCheck %s
+// CHECK: error: Local crash reproduction may not be used without disabling mutli-threading first.
>From cfebe51a6323f09fe0ad026b9129a6ddfc79c5d4 Mon Sep 17 00:00:00 2001
From: Artemiy Bulavin <artemiyb at graphcore.ai>
Date: Thu, 19 Jun 2025 16:11:29 +0000
Subject: [PATCH 2/3] fixup: supress mlit-opt status code in test
---
mlir/test/mlir-opt/local-reproducer-with-threading.mlir | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mlir/test/mlir-opt/local-reproducer-with-threading.mlir b/mlir/test/mlir-opt/local-reproducer-with-threading.mlir
index 10ebaed1c63da..e557f7ef3fdde 100644
--- a/mlir/test/mlir-opt/local-reproducer-with-threading.mlir
+++ b/mlir/test/mlir-opt/local-reproducer-with-threading.mlir
@@ -1,5 +1,9 @@
// Test that attempting to create a local crash reproducer without disabling threading
// prints an error from the pass manager (as opposed to crashing with a stack trace).
-// RUN: mlir-opt --mlir-pass-pipeline-local-reproducer --mlir-pass-pipeline-crash-reproducer=%t 2>&1 %s | FileCheck %s
+// We need to use `||` in the RUN command because lit will fail the test due to mlir-opt
+// returning non-zero status for this test case, however this is the intended behaviour.
+
+// RUN: mlir-opt --mlir-pass-pipeline-local-reproducer --mlir-pass-pipeline-crash-reproducer=%t %s 2>&1 || FileCheck --input-file %s %s
+
// CHECK: error: Local crash reproduction may not be used without disabling mutli-threading first.
>From b1bd26b4979b03853b3eeac441458d266e1e7d99 Mon Sep 17 00:00:00 2001
From: Artemiy Bulavin <artemiyb at graphcore.ai>
Date: Fri, 20 Jun 2025 10:14:48 +0000
Subject: [PATCH 3/3] fixup: use expected-error in the lit test
---
mlir/test/mlir-opt/local-reproducer-with-threading.mlir | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/mlir/test/mlir-opt/local-reproducer-with-threading.mlir b/mlir/test/mlir-opt/local-reproducer-with-threading.mlir
index e557f7ef3fdde..8e94f4edb91bf 100644
--- a/mlir/test/mlir-opt/local-reproducer-with-threading.mlir
+++ b/mlir/test/mlir-opt/local-reproducer-with-threading.mlir
@@ -1,9 +1,7 @@
// Test that attempting to create a local crash reproducer without disabling threading
// prints an error from the pass manager (as opposed to crashing with a stack trace).
-// We need to use `||` in the RUN command because lit will fail the test due to mlir-opt
-// returning non-zero status for this test case, however this is the intended behaviour.
+// RUN: mlir-opt --verify-diagnostics --mlir-pass-pipeline-local-reproducer \
+// RUN: --mlir-pass-pipeline-crash-reproducer=%t %s
-// RUN: mlir-opt --mlir-pass-pipeline-local-reproducer --mlir-pass-pipeline-crash-reproducer=%t %s 2>&1 || FileCheck --input-file %s %s
-
-// CHECK: error: Local crash reproduction may not be used without disabling mutli-threading first.
+// expected-error at unknown {{Local crash reproduction may not be used without disabling mutli-threading first.}}
More information about the Mlir-commits
mailing list