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

Commit fd48dd9

Browse files
authored
[MLIR][Python] Add the --mlir-print-ir-tree-dir to the C and Python API (#117339)
1 parent a3f680b commit fd48dd9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

mlir/lib/Bindings/Python/Pass.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,21 @@ void mlir::python::populatePassManagerSubmodule(py::module &m) {
7676
"enable_ir_printing",
7777
[](PyPassManager &passManager, bool printBeforeAll,
7878
bool printAfterAll, bool printModuleScope, bool printAfterChange,
79-
bool printAfterFailure) {
79+
bool printAfterFailure,
80+
std::optional<std::string> optionalTreePrintingPath) {
81+
std::string treePrintingPath = "";
82+
if (optionalTreePrintingPath.has_value())
83+
treePrintingPath = optionalTreePrintingPath.value();
8084
mlirPassManagerEnableIRPrinting(
8185
passManager.get(), printBeforeAll, printAfterAll,
82-
printModuleScope, printAfterChange, printAfterFailure);
86+
printModuleScope, printAfterChange, printAfterFailure,
87+
mlirStringRefCreate(treePrintingPath.data(),
88+
treePrintingPath.size()));
8389
},
8490
"print_before_all"_a = false, "print_after_all"_a = true,
8591
"print_module_scope"_a = false, "print_after_change"_a = false,
8692
"print_after_failure"_a = false,
93+
"tree_printing_dir_path"_a = py::none(),
8794
"Enable IR printing, default as mlir-print-ir-after-all.")
8895
.def(
8996
"enable_verifier",

0 commit comments

Comments
 (0)