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

Function _check_elementwise

tests/python/tvmscript/test_tvmscript_complete.py:160–190  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

158
159
160def _check_elementwise(func):
161 A, B, C = [func.buffer_map[x] for x in func.params]
162
163 root_block = func.body.block
164 assert len(root_block.reads) == 0
165 assert len(root_block.writes) == 0
166
167 block1 = func.body.block.body[0].body.body.block
168 assert isinstance(block1, tvm.tirx.SBlock)
169 vi, vj = [x.var for x in block1.iter_vars]
170
171 tvm.ir.assert_structural_equal(
172 block1.reads,
173 [tvm.tirx.BufferRegion(A, [Range.from_min_extent(vi, 1), Range.from_min_extent(vj, 1)])],
174 )
175 tvm.ir.assert_structural_equal(
176 block1.writes,
177 [tvm.tirx.BufferRegion(B, [Range.from_min_extent(vi, 1), Range.from_min_extent(vj, 1)])],
178 )
179
180 block2 = func.body.block.body[1].body.body.block
181 assert isinstance(block2, tvm.tirx.SBlock)
182 vi, vj = [x.var for x in block2.iter_vars]
183 tvm.ir.assert_structural_equal(
184 block2.reads,
185 [tvm.tirx.BufferRegion(B, [Range.from_min_extent(vi, 1), Range.from_min_extent(vj, 1)])],
186 )
187 tvm.ir.assert_structural_equal(
188 block2.writes,
189 [tvm.tirx.BufferRegion(C, [Range.from_min_extent(vi, 1), Range.from_min_extent(vj, 1)])],
190 )
191
192
193def test_complete_with_root():

Callers 2

test_complete_with_rootFunction · 0.70

Calls 1

from_min_extentMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…