[Mlir-commits] [mlir] [MLIR][Python][NO MERGE] Support Python-defined passes in MLIR (PR #157369)

Maksim Levental llvmlistbot at llvm.org
Sun Sep 7 20:13:10 PDT 2025


================
@@ -157,6 +159,44 @@ void mlir::python::populatePassManagerSubmodule(nb::module_ &m) {
           "pipeline"_a,
           "Add textual pipeline elements to the pass manager. Throws a "
           "ValueError if the pipeline can't be parsed.")
+      .def(
+          "add_python_pass",
+          [](PyPassManager &passManager, const std::string &name,
+             const std::string &argument, const std::string &description,
+             const std::string &opName, const nb::callable &run) {
----------------
makslevental wrote:

Ya 100% that's a good idea (like you have in your PR). But I don't think you actually need to make them kw - you just have to make them have default args. Anyway either form is good with me.

https://github.com/llvm/llvm-project/pull/157369


More information about the Mlir-commits mailing list