()
| 167 | |
| 168 | |
| 169 | def 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 | |
| 196 | def test_vm_goto(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…