[Mlir-commits] [mlir] [MLIR][Transform] apply_registered_pass op's options as a dict (PR #143159)
Adam Siemieniuk
llvmlistbot at llvm.org
Tue Jun 10 06:08:45 PDT 2025
================
@@ -248,3 +299,77 @@ module attributes {transform.with_named_sequence} {
transform.yield
}
}
+
+// -----
+
+/////////////////////////////////////////////////////////////////////
+// Check that the following cases are caugh in the generic format. //
+/////////////////////////////////////////////////////////////////////
+
+// Invalid due to param_operand_index occurences in options dict not being
+// one-to-one with the dynamic options provided as params:
+// param_operand_index out of bounds w.r.t. the number of options provided via params.
+
+"builtin.module"() ({
+ "transform.named_sequence"() <{function_type = (!transform.any_op) -> (), sym_name = "__transform_main"}> ({
+ ^bb0(%arg0: !transform.any_op):
+ %0 = "transform.structured.match"(%arg0) <{ops = ["func.func"]}> : (!transform.any_op) -> !transform.any_op
+ %1 = "transform.param.constant"() <{value = 10 : i64}> : () -> !transform.any_param
+ // expected-error @below {{dynamic option index 1 is out of bounds for the number of dynamic options: 1}}
+ %2 = "transform.apply_registered_pass"(%1, %0) <{
+ options = {"max-iterations" = #transform.param_operand_index<1 : i64>,
+ "test-convergence" = true,
+ "top-down" = false},
+ pass_name = "canonicalize"}>
+ : (!transform.any_param, !transform.any_op) -> !transform.any_op
+ "transform.yield"() : () -> ()
+ }) : () -> ()
+}) {transform.with_named_sequence} : () -> ()
+
+// -----
+
+// Invalid due to param_operand_index occurences in options dict not being
+// one-to-one with the dynamic options provided as params:
+// the first option-param is referred to twice and the second one not at all.
+// (The pretty-printed format supports this by passing in the same param twice.)
+
+"builtin.module"() ({
+ "transform.named_sequence"() <{function_type = (!transform.any_op) -> (), sym_name = "__transform_main"}> ({
+ ^bb0(%arg0: !transform.any_op):
+ %0 = "transform.structured.match"(%arg0) <{ops = ["func.func"]}> : (!transform.any_op) -> !transform.any_op
+ %1 = "transform.param.constant"() <{value = 10 : i64}> : () -> !transform.any_param
+ %2 = "transform.param.constant"() <{value = 1 : i64}> : () -> !transform.any_param
+ // expected-error @below {{dynamic option index 0 is already used in options}}
----------------
adam-smnk wrote:
Also, why can't the same value be used multiple times?
https://github.com/llvm/llvm-project/pull/143159
More information about the Mlir-commits
mailing list