MCPcopy Index your code
hub / github.com/apache/tvm / test_vm_storage

Function test_vm_storage

tests/python/relax/test_vm_execbuilder.py:169–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

167
168
169def test_vm_storage():
170 dtype = tvm.DataType("float32")
171 shape = (4, 6)
172 ib = relax.ExecBuilder()
173 with ib.function("main", num_inputs=0):
174 ib.emit_call(
175 "vm.builtin.alloc_storage",
176 args=[
177 ib.vm_state(),
178 (24,),
179 ib.convert_constant(0),
180 dtype,
181 ib.convert_constant("global"),
182 ],
183 dst=ib.r(1),
184 )
185 ib.emit_call(
186 "vm.builtin.alloc_tensor", args=[ib.r(1), ib.imm(0), shape, dtype], dst=ib.r(2)
187 )
188 ib.emit_ret(ib.r(2))
189 ex = ib.get()
190 vm = relax.VirtualMachine(ex, tvm.cpu())
191 res = vm["main"]()
192 assert res.device == tvm.cpu()
193 assert res.shape == shape
194
195
196def test_vm_goto():

Callers

nothing calls this directly

Calls 9

functionMethod · 0.95
emit_callMethod · 0.95
vm_stateMethod · 0.95
convert_constantMethod · 0.95
rMethod · 0.95
immMethod · 0.95
emit_retMethod · 0.95
getMethod · 0.95
cpuMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…