Skip to content

Commit 6edf2eb

Browse files
authored
[MLIR] Print more user-friendly error message when generating local reproducer and threading is enabled (#144905)
1 parent 6c0ac88 commit 6edf2eb

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

mlir/lib/Pass/PassManagerOptions.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ LogicalResult mlir::applyPassManagerCLOptions(PassManager &pm) {
146146
if (!options.isConstructed())
147147
return failure();
148148

149+
if (options->reproducerFile.getNumOccurrences() && options->localReproducer &&
150+
pm.getContext()->isMultithreadingEnabled()) {
151+
emitError(UnknownLoc::get(pm.getContext()))
152+
<< "Local crash reproduction may not be used without disabling "
153+
"mutli-threading first.";
154+
return failure();
155+
}
156+
149157
// Generate a reproducer on crash/failure.
150158
if (options->reproducerFile.getNumOccurrences())
151159
pm.enableCrashReproducerGeneration(options->reproducerFile,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Test that attempting to create a local crash reproducer without disabling threading
2+
// prints an error from the pass manager (as opposed to crashing with a stack trace).
3+
4+
// RUN: mlir-opt --verify-diagnostics --mlir-pass-pipeline-local-reproducer \
5+
// RUN: --mlir-pass-pipeline-crash-reproducer=%t %s
6+
7+
// expected-error@unknown {{Local crash reproduction may not be used without disabling mutli-threading first.}}

0 commit comments

Comments
 (0)