[Mlir-commits] [mlir] Add optional arguments to passmanger ir printing (PR #89301)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Apr 18 14:05:06 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 4759890f859277cd798648a9a333573cd088d98a caff7d49bd0536ad083c0fd8e6f8a1c24514dd18 -- mlir/include/mlir-c/Pass.h mlir/lib/Bindings/Python/Pass.cpp mlir/lib/CAPI/IR/Pass.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/include/mlir-c/Pass.h b/mlir/include/mlir-c/Pass.h
index 47edaecd5ed..edc94a074a6 100644
--- a/mlir/include/mlir-c/Pass.h
+++ b/mlir/include/mlir-c/Pass.h
@@ -75,12 +75,10 @@ MLIR_CAPI_EXPORTED MlirLogicalResult
mlirPassManagerRunOnOp(MlirPassManager passManager, MlirOperation op);
/// Enable mlir-print-ir-after-all.
-MLIR_CAPI_EXPORTED void
-mlirPassManagerEnableIRPrinting(MlirPassManager passManager,
- bool shouldPrintBeforePass,
- bool shouldPrintAfterPass,
- bool printAfterOnlyOnChange,
- bool printAfterOnlyOnFailure);
+MLIR_CAPI_EXPORTED void mlirPassManagerEnableIRPrinting(
+ MlirPassManager passManager, bool shouldPrintBeforePass,
+ bool shouldPrintAfterPass, bool printAfterOnlyOnChange,
+ bool printAfterOnlyOnFailure);
// Enable timing of passes
MLIR_CAPI_EXPORTED void
diff --git a/mlir/lib/Bindings/Python/Pass.cpp b/mlir/lib/Bindings/Python/Pass.cpp
index 60694fa0078..c65d9ca5ef0 100644
--- a/mlir/lib/Bindings/Python/Pass.cpp
+++ b/mlir/lib/Bindings/Python/Pass.cpp
@@ -74,27 +74,23 @@ void mlir::python::populatePassManagerSubmodule(py::module &m) {
"Releases (leaks) the backing pass manager (testing)")
.def(
"enable_ir_printing",
- [](PyPassManager &passManager,
- bool print_before_pass,
- bool print_after_pass,
- bool print_after_only_on_change,
- bool print_after_only_on_failure) {
- mlirPassManagerEnableIRPrinting(passManager.get(),
- print_before_pass,
- print_after_pass,
- print_after_only_on_change,
- print_after_only_on_failure);
+ [](PyPassManager &passManager, bool print_before_pass,
+ bool print_after_pass, bool print_after_only_on_change,
+ bool print_after_only_on_failure) {
+ mlirPassManagerEnableIRPrinting(
+ passManager.get(), print_before_pass, print_after_pass,
+ print_after_only_on_change, print_after_only_on_failure);
},
- "print_before_pass"_a = true, "print_after_pass"_a = true,
- "print_after_only_on_change"_a = true, "print_after_only_on_failure"_a = false,
+ "print_before_pass"_a = true, "print_after_pass"_a = true,
+ "print_after_only_on_change"_a = true,
+ "print_after_only_on_failure"_a = false,
"Enable mlir-print-ir-after-all.")
.def(
"enable_timing",
[](PyPassManager &PyPassManager) {
mlirPassManagerEnableTiming(PyPassManager.get());
},
- "Enable timing of passes"
- )
+ "Enable timing of passes")
.def(
"enable_verifier",
[](PyPassManager &passManager, bool enable) {
diff --git a/mlir/lib/CAPI/IR/Pass.cpp b/mlir/lib/CAPI/IR/Pass.cpp
index a499b1cdbf5..f0c9ef5f95a 100644
--- a/mlir/lib/CAPI/IR/Pass.cpp
+++ b/mlir/lib/CAPI/IR/Pass.cpp
@@ -45,18 +45,20 @@ MlirLogicalResult mlirPassManagerRunOnOp(MlirPassManager passManager,
}
void mlirPassManagerEnableIRPrinting(MlirPassManager passManager,
- bool shouldPrintBeforePass,
- bool shouldPrintAfterPass,
- bool printAfterOnlyOnChange,
- bool printAfterOnlyOnFailure) {
- auto shouldPrintBeforeFn = [shouldPrintBeforePass](Pass *, Operation *) {return shouldPrintBeforePass;};
- auto shouldPrintAfterFn = [shouldPrintAfterPass](Pass *, Operation *) {return shouldPrintAfterPass;};
-
- return unwrap(passManager)->enableIRPrinting(shouldPrintBeforeFn,
- shouldPrintAfterFn,
- true,
- printAfterOnlyOnChange,
- printAfterOnlyOnFailure);
+ bool shouldPrintBeforePass,
+ bool shouldPrintAfterPass,
+ bool printAfterOnlyOnChange,
+ bool printAfterOnlyOnFailure) {
+ auto shouldPrintBeforeFn = [shouldPrintBeforePass](Pass *, Operation *) {
+ return shouldPrintBeforePass;
+ };
+ auto shouldPrintAfterFn = [shouldPrintAfterPass](Pass *, Operation *) {
+ return shouldPrintAfterPass;
+ };
+
+ return unwrap(passManager)
+ ->enableIRPrinting(shouldPrintBeforeFn, shouldPrintAfterFn, true,
+ printAfterOnlyOnChange, printAfterOnlyOnFailure);
}
void mlirPassManagerEnableTiming(MlirPassManager passManager) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/89301
More information about the Mlir-commits
mailing list