[Mlir-commits] [mlir] d511a5d - [mlir] Include anchor op in reproducer pipeline string
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Nov 3 08:45:02 PDT 2022
Author: rkayaith
Date: 2022-11-03T11:44:57-04:00
New Revision: d511a5d47166b024a4ce5e4202bf83400acef05c
URL: https://github.com/llvm/llvm-project/commit/d511a5d47166b024a4ce5e4202bf83400acef05c
DIFF: https://github.com/llvm/llvm-project/commit/d511a5d47166b024a4ce5e4202bf83400acef05c.diff
LOG: [mlir] Include anchor op in reproducer pipeline string
Including the anchor op ensures that all pass manager settings are fully
specified, and makes the string consistent with the printed form.
Depends on D134622
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D134623
Added:
Modified:
mlir/docs/PassManagement.md
mlir/lib/Pass/PassCrashRecovery.cpp
mlir/test/Pass/crash-recovery-dynamic-failure.mlir
mlir/test/Pass/crash-recovery.mlir
mlir/test/Pass/run-reproducer.mlir
Removed:
################################################################################
diff --git a/mlir/docs/PassManagement.md b/mlir/docs/PassManagement.md
index ed225a84afb7c..9842cb9214461 100644
--- a/mlir/docs/PassManagement.md
+++ b/mlir/docs/PassManagement.md
@@ -1328,7 +1328,7 @@ module {
{-#
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 @@ module {
{-#
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
index 98ea35cf02c3b..a98a1f1f6e475 100644
--- a/mlir/lib/Pass/PassCrashRecovery.cpp
+++ b/mlir/lib/Pass/PassCrashRecovery.cpp
@@ -60,7 +60,7 @@ struct RecoveryReproducerContext {
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 @@ llvm::ManagedStatic<llvm::SmallSetVector<RecoveryReproducerContext *, 1>>
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 @@ void RecoveryReproducerContext::generate(std::string &description) {
}
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 @@ void PassReproducerOptions::attachResourceParser(ParserConfig &config) {
}
LogicalResult PassReproducerOptions::apply(PassManager &pm) const {
- if (pipeline.has_value())
- if (failed(parsePassPipeline(*pipeline, pm)))
+ if (pipeline.has_value()) {
+ FailureOr<OpPassManager> reproPm = parsePassPipeline(*pipeline);
+ if (failed(reproPm))
return failure();
+ static_cast<OpPassManager &>(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
index bcf49ad978996..69e087d5aa83a 100644
--- a/mlir/test/Pass/crash-recovery-dynamic-failure.mlir
+++ b/mlir/test/Pass/crash-recovery-dynamic-failure.mlir
@@ -15,4 +15,4 @@ module @inner_mod1 {
// 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
index cb586d8b5dcbc..e636064d26e34 100644
--- a/mlir/test/Pass/crash-recovery.mlir
+++ b/mlir/test/Pass/crash-recovery.mlir
@@ -22,12 +22,12 @@ module @inner_mod1 {
// 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
index 6627033d8be7d..496471d032a52 100644
--- 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 @@ func.func @bar() {
{-#
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
}
}
More information about the Mlir-commits
mailing list