| 117 | |
| 118 | |
| 119 | def test_vm_formalize(): |
| 120 | ib0 = relax.ExecBuilder() |
| 121 | ib1 = relax.ExecBuilder() |
| 122 | with ib0.function("func0", num_inputs=2): |
| 123 | ib0.emit_call("test.vm.add", args=[ib0.r(0), ib0.r(1)], dst=ib0.r(100)) |
| 124 | ib0.emit_call("test.vm.mul", args=[ib0.r(1), ib0.r(100)], dst=ib0.r(50)) |
| 125 | ib0.emit_ret(ib0.r(50)) |
| 126 | with ib1.function("func0", num_inputs=2): |
| 127 | ib1.emit_call("test.vm.add", args=[ib1.r(0), ib1.r(1)], dst=ib1.r(2)) |
| 128 | ib1.emit_call("test.vm.mul", args=[ib1.r(1), ib1.r(2)], dst=ib1.r(3)) |
| 129 | ib1.emit_ret(ib1.r(3)) |
| 130 | exec0 = ib0.get() |
| 131 | exec1 = ib1.get() |
| 132 | assert exec0.as_text() == exec1.as_text() |
| 133 | |
| 134 | |
| 135 | def test_vm_operand(): |