()
| 502 | |
| 503 | |
| 504 | def test_call_dps_packed(): |
| 505 | @R.function |
| 506 | def foo(x: R.Tensor(("m", "n"), "float32")): |
| 507 | m, n = T.int64(), T.int64() |
| 508 | gv0 = R.call_dps_packed("test.op.identity", (x,), R.Tensor((m, n), dtype="float32")) |
| 509 | return gv0 |
| 510 | |
| 511 | foo_str = strip_whitespace( |
| 512 | dump_ast( |
| 513 | foo, |
| 514 | include_struct_info_annotations=False, |
| 515 | include_call_attrs=False, |
| 516 | ) |
| 517 | ) |
| 518 | assert foo_str.startswith('Function(params=[Var(name_hint="x")]') |
| 519 | |
| 520 | # call_dps_packed is an op in Relax and it takes an extern func as an argument |
| 521 | assert isinstance(foo.body, rx.SeqExpr) |
| 522 | tir_call = foo.body.blocks[0].bindings[0].value |
| 523 | tir_call_text = dump_ast( |
| 524 | tir_call, |
| 525 | include_struct_info_annotations=False, |
| 526 | include_call_attrs=False, |
| 527 | ) |
| 528 | assert_fields( |
| 529 | "Call", |
| 530 | { |
| 531 | "op": 'Op(name="relax.call_dps_packed")', |
| 532 | "args": """[ |
| 533 | ExternFunc(global_symbol="test.op.identity"), |
| 534 | Tuple(fields=[Var(name_hint="x")]) |
| 535 | ]""", |
| 536 | "sinfo_args": """[ |
| 537 | TensorStructInfo( |
| 538 | dtype=float32, |
| 539 | shape=ShapeExpr( |
| 540 | values=[ |
| 541 | PrimExpr(value=`m`), |
| 542 | PrimExpr(value=`n`) |
| 543 | ] |
| 544 | ) |
| 545 | ) |
| 546 | ]""", |
| 547 | }, |
| 548 | tir_call_text, |
| 549 | ) |
| 550 | assert strip_whitespace(tir_call_text) in foo_str |
| 551 | |
| 552 | |
| 553 | def test_operators(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…