[Mlir-commits] [mlir] [MLIR][Python] Support dialect conversion in python bindings (PR #177782)

Maksim Levental llvmlistbot at llvm.org
Sun Jan 25 15:06:45 PST 2026


================
@@ -305,3 +307,14 @@ def _get_int_array_array_attr(
 
     # Turn the outer list into an ArrayAttr.
     return ArrayAttr.get(values)
+
+
+class OpAdaptor:
+    def __init__(
+        self, operands: _Sequence[Value], opview_or_attributes: OpView | OpAttributeMap
+    ) -> None:
+        self.operands = operands
+        if isinstance(opview_or_attributes, OpView):
+            self.attributes = opview_or_attributes.operation.attributes
+        else:
+            self.attributes = opview_or_attributes
----------------
makslevental wrote:

wouldn't it be better to put this in cpp? ie somewhere near `OpView` and `Operation`? also this is missing regions (and properties but we won't get into that lol)? although looking at some generated adaptors i don't know what regions is used for ....

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


More information about the Mlir-commits mailing list