Skip to content

[MLIR] Print more user-friendly error message when generating local reproducer and threading is enabled #144905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions mlir/lib/Pass/PassManagerOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions mlir/test/mlir-opt/local-reproducer-with-threading.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +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).

// 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.