Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit 984c538

Browse files
authored
[MLIR] [Python] align python ir printing with mlir-print-ir-after-all (#107522)
When using the `enable_ir_printing` API from Python, it invokes IR printing with default args, printing the IR before each pass and printing IR after pass only if there have been changes. This PR attempts to align the `enable_ir_printing` API with the documentation
1 parent 7b827eb commit 984c538

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

mlir/lib/Bindings/Python/Pass.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,17 @@ void mlir::python::populatePassManagerSubmodule(py::module &m) {
7474
"Releases (leaks) the backing pass manager (testing)")
7575
.def(
7676
"enable_ir_printing",
77-
[](PyPassManager &passManager) {
78-
mlirPassManagerEnableIRPrinting(passManager.get());
77+
[](PyPassManager &passManager, bool printBeforeAll,
78+
bool printAfterAll, bool printModuleScope, bool printAfterChange,
79+
bool printAfterFailure) {
80+
mlirPassManagerEnableIRPrinting(
81+
passManager.get(), printBeforeAll, printAfterAll,
82+
printModuleScope, printAfterChange, printAfterFailure);
7983
},
80-
"Enable mlir-print-ir-after-all.")
84+
"print_before_all"_a = false, "print_after_all"_a = true,
85+
"print_module_scope"_a = false, "print_after_change"_a = false,
86+
"print_after_failure"_a = false,
87+
"Enable IR printing, default as mlir-print-ir-after-all.")
8188
.def(
8289
"enable_verifier",
8390
[](PyPassManager &passManager, bool enable) {

0 commit comments

Comments
 (0)