[Mlir-commits] [mlir] [MLIR][Python] Add bindings for PDL native rewrite function registering (PR #159926)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Tue Sep 23 00:27:59 PDT 2025


================
@@ -78,10 +119,48 @@ class PyFrozenRewritePatternSet {
 
 /// Create the `mlir.rewrite` here.
 void mlir::python::populateRewriteSubmodule(nb::module_ &m) {
+  nb::class_<MlirPatternRewriter>(m, "PatternRewriter");
   //----------------------------------------------------------------------------
-  // Mapping of the top-level PassManager
+  // Mapping of the PDLResultList and PDLModule
   //----------------------------------------------------------------------------
 #if MLIR_ENABLE_PDL_IN_PATTERNMATCH
+  nb::class_<MlirPDLResultList>(m, "PDLResultList")
+      .def(
+          "push_back",
----------------
ftynse wrote:

Nit: I think `append` will be more consistent with Python lists.

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


More information about the Mlir-commits mailing list