@@ -254,3 +254,39 @@ def testReplicateOp(module: Module):
254254 # CHECK: %[[FIRST:.+]] = pdl_match
255255 # CHECK: %[[SECOND:.+]] = pdl_match
256256 # CHECK: %{{.*}} = replicate num(%[[FIRST]]) %[[SECOND]]
257+
258+
259+ @run
260+ def testApplyRegisteredPassOp (module : Module ):
261+ sequence = transform .SequenceOp (
262+ transform .FailurePropagationMode .Propagate , [], transform .AnyOpType .get ()
263+ )
264+ with InsertionPoint (sequence .body ):
265+ mod = transform .ApplyRegisteredPassOp (
266+ transform .AnyOpType .get (), "canonicalize" , sequence .bodyTarget
267+ )
268+ mod = transform .ApplyRegisteredPassOp (
269+ transform .AnyOpType .get (), "canonicalize" , mod , options = ("top-down=false" ,)
270+ )
271+ max_iter = transform .param_constant (
272+ transform .AnyParamType .get (), StringAttr .get ("max-iterations=10" )
273+ )
274+ max_rewrites = transform .param_constant (
275+ transform .AnyParamType .get (), StringAttr .get ("max-num-rewrites=1" )
276+ )
277+ transform .ApplyRegisteredPassOp (
278+ transform .AnyOpType .get (),
279+ "canonicalize" ,
280+ mod ,
281+ options = ("top-down=false" , max_iter , "test-convergence=true" , max_rewrites ),
282+ )
283+ transform .YieldOp ()
284+ # CHECK-LABEL: TEST: testApplyRegisteredPassOp
285+ # CHECK: transform.sequence
286+ # CHECK: %{{.*}} = apply_registered_pass "canonicalize" to {{.*}} : (!transform.any_op) -> !transform.any_op
287+ # CHECK: %{{.*}} = apply_registered_pass "canonicalize" with options = "top-down=false" to {{.*}} : (!transform.any_op) -> !transform.any_op
288+ # CHECK: %[[MAX_ITER:.+]] = transform.param.constant
289+ # CHECK: %[[MAX_REWRITE:.+]] = transform.param.constant
290+ # CHECK: %{{.*}} = apply_registered_pass "canonicalize"
291+ # CHECK-SAME: with options = "top-down=false" %[[MAX_ITER]]
292+ # CHECK-SAME: "test-convergence=true" %[[MAX_REWRITE]] to %{{.*}} : (!transform.any_param, !transform.any_param, !transform.any_op) -> !transform.any_op
0 commit comments