[Mlir-commits] [mlir] [MLIR][Python] Add optional arguments to PassManager IR printing (PR #89301)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Mon Apr 22 01:01:57 PDT 2024
================
@@ -44,8 +44,23 @@ MlirLogicalResult mlirPassManagerRunOnOp(MlirPassManager passManager,
return wrap(unwrap(passManager)->run(unwrap(op)));
}
-void mlirPassManagerEnableIRPrinting(MlirPassManager passManager) {
- return unwrap(passManager)->enableIRPrinting();
+void mlirPassManagerEnableIRPrinting(MlirPassManager passManager,
+ bool shouldPrintBeforePass,
+ bool shouldPrintAfterPass,
+ bool printModuleScope,
+ bool printAfterOnlyOnChange,
+ bool printAfterOnlyOnFailure) {
+ auto shouldPrintBeforeFn = [shouldPrintBeforePass](Pass *, Operation *) {return shouldPrintBeforePass;};
+ auto shouldPrintAfterFn = [shouldPrintAfterPass](Pass *, Operation *) {return shouldPrintAfterPass;};
----------------
ftynse wrote:
Can't we actually take a C function pointer instead? On the Python side, we can then do a dispatch based on the actual type and accept bool as well as a `py::function`.
https://github.com/llvm/llvm-project/pull/89301
More information about the Mlir-commits
mailing list