[Mlir-commits] [mlir] 9b8d944 - [mlir][core] Fix inline pass default pipeline dump

Jacques Pienaar llvmlistbot at llvm.org
Sat Mar 11 09:18:46 PST 2023


Author: Ahmed Harmouche
Date: 2023-03-11T09:18:11-08:00
New Revision: 9b8d9447f867dff29407fddeb4bed0f89bd4e9f7

URL: https://github.com/llvm/llvm-project/commit/9b8d9447f867dff29407fddeb4bed0f89bd4e9f7
DIFF: https://github.com/llvm/llvm-project/commit/9b8d9447f867dff29407fddeb4bed0f89bd4e9f7.diff

LOG: [mlir][core] Fix inline pass default pipeline dump

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: https://github.com/llvm/llvm-project/issues/60960

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D145066

Added: 
    mlir/test/Transforms/inlining-dump-default-pipeline.mlir

Modified: 
    mlir/include/mlir/Transforms/Passes.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Transforms/Passes.td b/mlir/include/mlir/Transforms/Passes.td
index d667ceaa37f47..1ed014af0c7e2 100644
--- a/mlir/include/mlir/Transforms/Passes.td
+++ b/mlir/include/mlir/Transforms/Passes.td
@@ -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)`)">,

diff  --git a/mlir/test/Transforms/inlining-dump-default-pipeline.mlir b/mlir/test/Transforms/inlining-dump-default-pipeline.mlir
new file mode 100644
index 0000000000000..e2c31867a8e04
--- /dev/null
+++ b/mlir/test/Transforms/inlining-dump-default-pipeline.mlir
@@ -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 })


        


More information about the Mlir-commits mailing list