[Mlir-commits] [mlir] [MLIR][Python] Support canonicalization hooks for Python-defined ops (PR #224806)

Maksim Levental llvmlistbot at llvm.org
Fri Sep 25 20:20:10 PDT 2026


================
@@ -2547,6 +2549,37 @@ void PyOpAdaptor::bind(nb::module_ &m) {
           "Returns the attributes of the adaptor.");
 }
 
+void PyDynamicOpDefinition::setGetCanonicalizationPatternsFn(
+    const nb::callable &fn) {
+  fn.inc_ref();
----------------
makslevental wrote:

this smells a little - do we really need this? this `fn` is typically gonna be a class method right? won't that stay alive by virtue of the class (op class) staying alive?

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


More information about the Mlir-commits mailing list