()
| 591 | |
| 592 | |
| 593 | def test_two_matmul(): |
| 594 | # Same as Figure 2(a) in TASO paper. |
| 595 | @tvm.script.ir_module |
| 596 | class MatMul2: |
| 597 | @R.function |
| 598 | def main( |
| 599 | a: R.Tensor((32, 16), "float32"), |
| 600 | b: R.Tensor((16, 48), "float32"), |
| 601 | c: R.Tensor((48, 32), "float32"), |
| 602 | ) -> R.Tensor: |
| 603 | with R.dataflow(): |
| 604 | lv0 = R.call_dps_packed("matmul", (a, b), R.Tensor((32, 48), dtype="float32")) |
| 605 | lv1 = R.call_dps_packed("matmul", (lv0, c), R.Tensor((32, 32), dtype="float32")) |
| 606 | R.output(lv1) |
| 607 | return lv1 |
| 608 | |
| 609 | with PatternContext() as ctx: |
| 610 | is_call_dps_packed("matmul") >> is_call_dps_packed("matmul") |
| 611 | dfb = MatMul2["main"].body.blocks[0] |
| 612 | assert ctx.match_dfb(dfb) |
| 613 | |
| 614 | with PatternContext() as ctx: |
| 615 | is_call_dps_packed("matmul").has_shape([32, 48]) >> is_call_dps_packed("matmul").has_shape( |
| 616 | [32, 32] |
| 617 | ) |
| 618 | dfb = MatMul2["main"].body.blocks[0] |
| 619 | assert ctx.match_dfb(dfb) |
| 620 | |
| 621 | with PatternContext() as ctx: |
| 622 | is_call_dps_packed("matmul") >> is_call_dps_packed("matmul") >> is_call_dps_packed("matmul") |
| 623 | dfb = MatMul2["main"].body.blocks[0] |
| 624 | # Three MatMul cannot match |
| 625 | assert not ctx.match_dfb(dfb) |
| 626 | |
| 627 | |
| 628 | def test_concat_mm_split(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…