[Mlir-commits] [mlir] [MLIR][Python][NFC] Refine the docstring of `PassManager.add(callable, ..)` (PR #173945)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Dec 29 18:56:03 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Twice (PragmaTwice)
<details>
<summary>Changes</summary>
This PR expands the docstring for `PassManager.run(callable, ..)` by adding descriptions for each parameter, making it easier for users to understand. No functional change.
---
Full diff: https://github.com/llvm/llvm-project/pull/173945.diff
1 Files Affected:
- (modified) mlir/lib/Bindings/Python/Pass.cpp (+13-1)
``````````diff
diff --git a/mlir/lib/Bindings/Python/Pass.cpp b/mlir/lib/Bindings/Python/Pass.cpp
index 572afa902746d..cdf01fff28cf2 100644
--- a/mlir/lib/Bindings/Python/Pass.cpp
+++ b/mlir/lib/Bindings/Python/Pass.cpp
@@ -224,7 +224,19 @@ void mlir::python::populatePassManagerSubmodule(nb::module_ &m) {
},
"run"_a, "name"_a.none() = nb::none(), "argument"_a.none() = "",
"description"_a.none() = "", "op_name"_a.none() = "",
- "Add a python-defined pass to the pass manager.")
+ R"(
+ Add a python-defined pass to the current pipeline of the pass manager.
+
+ Args:
+ run: A callable with signature ``(op: ir.Operation, pass_: ExternalPass) -> None``.
+ Called when the pass executes. It receives the operation to be processed and
+ the current ``ExternalPass`` instance.
+ Use ``pass_.signal_pass_failure()`` to signal failure.
+ name: The name of the pass. Defaults to ``run.__name__``.
+ argument: The command-line argument for the pass. Defaults to empty.
+ description: The description of the pass. Defaults to empty.
+ op_name: The name of the operation this pass operates on.
+ It will be a generic operation pass if not specified.)")
.def(
"run",
[](PyPassManager &passManager, PyOperationBase &op) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/173945
More information about the Mlir-commits
mailing list