Skip to content

Commit

Permalink
[mlir][core] Fix inline pass default pipeline dump
Browse files Browse the repository at this point in the history
The inliner pass performs canonicalization when created programtically, run with `mlir-opt` with default options, or when explicitly specified. However, when running the pipeline resulting from a `-dump-pass-pipeline` on a default inline pass, the canonicalization is not performed as part of the inlining. This is because the default value for the `default-pipeline` option of the inline pass is an empty string, and this is selected during the dumping. When `InlinerPass::initializeOptions` detects the empty string, it sets the `defaultPipeline` to `nullptr`, which was previously set to canonicalize in the `InlinerPass` constructor, thus the canonicalization is not performed.

The added test checks if the inline pass performs canonicalization by default, and that the dumped `default-pipeline` is set to `canonicalize`.

Fixes: #60960

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D145066
  • Loading branch information
wpmed92 authored and jpienaar committed Mar 11, 2023
1 parent 1ab46e5 commit 9b8d944
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mlir/include/mlir/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def Inliner : Pass<"inline"> {
let constructor = "mlir::createInlinerPass()";
let options = [
Option<"defaultPipelineStr", "default-pipeline", "std::string",
/*default=*/"", "The default optimizer pipeline used for callables">,
/*default=*/"\"canonicalize\"", "The default optimizer pipeline used for callables">,
ListOption<"opPipelineList", "op-pipelines", "OpPassManager",
"Callable operation specific optimizer pipelines (in the form "
"of `dialect.op(pipeline)`)">,
Expand Down
2 changes: 2 additions & 0 deletions mlir/test/Transforms/inlining-dump-default-pipeline.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// RUN: mlir-opt %s -pass-pipeline="builtin.module(inline)" -dump-pass-pipeline 2>&1 | FileCheck %s
// CHECK: builtin.module(inline{default-pipeline=canonicalize max-iterations=4 })

0 comments on commit 9b8d944

Please sign in to comment.