diff --git a/mlir/docs/PassManagement.md b/mlir/docs/PassManagement.md --- a/mlir/docs/PassManagement.md +++ b/mlir/docs/PassManagement.md @@ -1328,7 +1328,7 @@ {-# external_resources: { mlir_reproducer: { - pipeline: "func.func(cse,canonicalize),inline", + pipeline: "builtin.module(func.func(cse,canonicalize),inline)", disable_threading: true, verify_each: true } @@ -1371,7 +1371,7 @@ {-# external_resources: { mlir_reproducer: { - pipeline: "func.func(canonicalize)", + pipeline: "builtin.module(func.func(canonicalize))", disable_threading: true, verify_each: true } diff --git a/mlir/lib/Pass/PassCrashRecovery.cpp b/mlir/lib/Pass/PassCrashRecovery.cpp --- a/mlir/lib/Pass/PassCrashRecovery.cpp +++ b/mlir/lib/Pass/PassCrashRecovery.cpp @@ -60,7 +60,7 @@ static void registerSignalHandler(); /// The textual description of the currently executing pipeline. - std::string pipeline; + std::string pipelineElements; /// The MLIR operation representing the IR before the crash. Operation *preCrashOperation; @@ -93,8 +93,8 @@ RecoveryReproducerContext::RecoveryReproducerContext( std::string passPipelineStr, Operation *op, PassManager::ReproducerStreamFactory &streamFactory, bool verifyPasses) - : pipeline(std::move(passPipelineStr)), preCrashOperation(op->clone()), - streamFactory(streamFactory), + : pipelineElements(std::move(passPipelineStr)), + preCrashOperation(op->clone()), streamFactory(streamFactory), disableThreads(!op->getContext()->isMultithreadingEnabled()), verifyPasses(verifyPasses) { enable(); @@ -118,6 +118,9 @@ } descOS << "reproducer generated at `" << stream->description() << "`"; + std::string pipeline = (preCrashOperation->getName().getStringRef() + "(" + + pipelineElements + ")") + .str(); AsmState state(preCrashOperation); state.attachResourcePrinter( "mlir_reproducer", [&](Operation *op, AsmResourceBuilder &builder) { @@ -470,9 +473,12 @@ } LogicalResult PassReproducerOptions::apply(PassManager &pm) const { - if (pipeline.has_value()) - if (failed(parsePassPipeline(*pipeline, pm))) + if (pipeline.has_value()) { + FailureOr reproPm = parsePassPipeline(*pipeline); + if (failed(reproPm)) return failure(); + static_cast(pm) = std::move(*reproPm); + } if (disableThreading.has_value()) pm.getContext()->disableMultithreading(*disableThreading); diff --git a/mlir/test/Pass/crash-recovery-dynamic-failure.mlir b/mlir/test/Pass/crash-recovery-dynamic-failure.mlir --- a/mlir/test/Pass/crash-recovery-dynamic-failure.mlir +++ b/mlir/test/Pass/crash-recovery-dynamic-failure.mlir @@ -15,4 +15,4 @@ // REPRO_LOCAL_DYNAMIC_FAILURE: module @inner_mod1 // REPRO_LOCAL_DYNAMIC_FAILURE: module @foo { -// REPRO_LOCAL_DYNAMIC_FAILURE: pipeline: "builtin.module(test-pass-failure)" +// REPRO_LOCAL_DYNAMIC_FAILURE: pipeline: "builtin.module(builtin.module(test-pass-failure))" diff --git a/mlir/test/Pass/crash-recovery.mlir b/mlir/test/Pass/crash-recovery.mlir --- a/mlir/test/Pass/crash-recovery.mlir +++ b/mlir/test/Pass/crash-recovery.mlir @@ -22,12 +22,12 @@ // REPRO: module @inner_mod1 // REPRO: module @foo { -// REPRO: pipeline: "builtin.module(test-module-pass,test-pass-crash)" +// REPRO: pipeline: "builtin.module(builtin.module(test-module-pass,test-pass-crash))" // REPRO_LOCAL: module @inner_mod1 // REPRO_LOCAL: module @foo { -// REPRO_LOCAL: pipeline: "builtin.module(test-pass-crash)" +// REPRO_LOCAL: pipeline: "builtin.module(builtin.module(test-pass-crash))" // REPRO_LOCAL_DYNAMIC: module @inner_mod1 // REPRO_LOCAL_DYNAMIC: module @foo { -// REPRO_LOCAL_DYNAMIC: pipeline: "builtin.module(test-pass-crash)" +// REPRO_LOCAL_DYNAMIC: pipeline: "builtin.module(builtin.module(test-pass-crash))" diff --git a/mlir/test/Pass/run-reproducer.mlir b/mlir/test/Pass/run-reproducer.mlir --- a/mlir/test/Pass/run-reproducer.mlir +++ b/mlir/test/Pass/run-reproducer.mlir @@ -1,3 +1,4 @@ +// RUN: mlir-opt %s -dump-pass-pipeline 2>&1 | FileCheck %s // RUN: mlir-opt %s -mlir-print-ir-before=cse 2>&1 | FileCheck -check-prefix=BEFORE %s func.func @foo() { @@ -12,7 +13,9 @@ {-# external_resources: { mlir_reproducer: { - pipeline: "func.func(cse,canonicalize)", + verify_each: true, + // CHECK: builtin.module(func.func(cse,canonicalize{ max-iterations=1 region-simplify=false top-down=false})) + pipeline: "builtin.module(func.func(cse,canonicalize{max-iterations=1 region-simplify=false top-down=false}))", disable_threading: true } }