[Mlir-commits] [mlir] [MLIR][Transform] apply_registered_pass op's options as a dict (PR #143159)

Maksim Levental llvmlistbot at llvm.org
Sun Jun 8 15:05:49 PDT 2025


================
@@ -214,6 +214,88 @@ def __init__(
         super().__init__(_get_op_results_or_values(operands), loc=loc, ip=ip)
 
 
+ at register_attribute_builder("ParamOperandIndexAttr")
+def _paramOperandIndexAttr(x: int, context) -> Attribute:
+    return Attribute.parse(f"#transform.param_operand_index<{x}>", context=context)
+
+
+ at _ods_cext.register_operation(_Dialect, replace=True)
+class ApplyRegisteredPassOp(ApplyRegisteredPassOp):
+    def __init__(
+        self,
+        result: Type,
+        pass_name: Union[str, StringAttr],
+        target: Union[Operation, Value, OpView],
+        *,
+        options: Dict[
+            Union[str, StringAttr],
+            Union[Attribute, Value, Operation, OpView],
+        ] = {},
----------------
makslevental wrote:

> IMO, the default Python-bindings should reflect the syntax of the normal ops as much as possible. This is so that the Python using the bindings by default looks very similar to normal syntax.

Ya I agree with this being a valuable design goal.

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


More information about the Mlir-commits mailing list