MCPcopy Create free account
hub / github.com/apache/tvm / test_inline_dataflow_block

Function test_inline_dataflow_block

tests/python/relax/test_inline_functions.py:88–119  ·  view source on GitHub ↗

Functions may be inlined within a dataflow block

()

Source from the content-addressed store, hash-verified

86
87
88def test_inline_dataflow_block():
89 """Functions may be inlined within a dataflow block"""
90
91 @I.ir_module
92 class Before:
93 @R.function(private=True)
94 def main(A: R.Tensor([16, 16], "int32")) -> R.Tensor([16, 32], "int32"):
95 with R.dataflow():
96 B = A * A
97 C = Before.subroutine(B)
98 D = C + C
99 R.output(D)
100 return D
101
102 @R.function(private=True)
103 def subroutine(B: R.Tensor([16, 16], "int32")) -> R.Tensor([16, 32], "int32"):
104 with R.dataflow():
105 C = R.concat([B, B], axis=1)
106 R.output(C)
107 return C
108
109 @R.function(private=True)
110 def expected(A: R.Tensor([16, 16], "int32")) -> R.Tensor([16, 32], "int32"):
111 with R.dataflow():
112 B = A * A
113 C = R.concat([B, B], axis=1)
114 D = C + C
115 R.output(D)
116 return D
117
118 after = Before["main"].inline_functions({"subroutine": Before["subroutine"]})
119 tvm.ir.assert_structural_equal(expected, after)
120
121
122def test_inline_non_dataflow_block_into_dataflow_block():

Callers

nothing calls this directly

Calls 1

inline_functionsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…