Missing file in uTVM demo?

I am trying to replicate the uTVM demo on STM32 board using https://github.com/areusch/microtvm-blogpost-eval/tree/experimental-blogpost

In the repo https://github.com/areusch/utvm-mbed-runtime main.cpp there is dependency on tvm/runtime/micro/micro_rpc_server.h header file which I am unable to find in the current version of tvm. I tried to replace the header file with utvm_runtime.h but this throws me a compilation error for main.cpp. Can anybody help me with this?

Any suggestion is welcomed :slight_smile:

Thanks

1 Like

You might want to pivot to use the example zephyr runtime in the tests directory.

tvm/tests/micro/qemu/zephyr-runtime

or

project_dir = os.path.join(whereveryourtimelives/tvm/tests/micro/qemu", “zephyr-runtime”)

While that gets things to build for me, it seems we crash after loading up the binary to run.

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 2000 kHz
Info : STLINK V2J37M26 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.230039
Warn : Silicon bug: single stepping may enter pending exception handler!
Info : stm32f7x.cpu: hardware has 8 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f7x.cpu       hla_target little stm32f7x.cpu       running

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08001398 msp: 0x2002f560
Info : device id = 0x10016449
Info : flash size = 1024 kbytes
auto erase enabled
wrote 32768 bytes from file /tmp/tvm-debug-mode-tempdirs/2020-12-07T16-42-17___8mb9x31b/00000/build/runtime/zephyr/zephyr.hex in 0.889880s (35.960 KiB/s)

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08001398 msp: 0x2002f560
verified 30240 bytes in 0.157406s (187.612 KiB/s)

Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked
Traceback (most recent call last):
  File "./new-utvm-st-ocd-test.py", line 78, in <module>
    with tvm.micro.Session(binary=micro_binary, flasher=flasher) as session:
  File "/home/tgall/tvm/tvm/python/tvm/micro/session.py", line 142, in __enter__
    int(timeouts.session_established_timeout_sec * 1e6),
  File "/home/tgall/tvm/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
    raise get_last_ffi_error()
tvm._ffi.base.TVMError: MicroSessionTimeoutError: session start handshake failed after 10s

hey @aakah18151, apologies for the confusion. The June µTVM blogpost is now no longer current as we’ve done a fairly extensive refactor of the µTVM code to make it portable. however, if you want to run the June demo, you should be able to do this with the utvm-blogpost-1 branch of utvm-mbed-runtime (see the README.md in microtvm-blogpost-eval) and with an older version of TVM, say 89359907d.

The master branch of microtvm-blogpost-eval should contain instructions for running against the tvm main branch. Note that autotuning is not yet working at HEAD, but is waiting on PRs to merge.

Let me know if this helps!

Andrew

1 Like

Hi, @areusch, it seems like both the utvm-mbed-runtime and utvm-zephyr-runtime repo hasn’t been updated since summer, while GitHub - areusch/tvm at utvm-vm have been updated through November. If I were to try running uTVM on STM32F board, which of the three repo should I be looking? Thank you for your help!

hi @kwmaeng,

apologies for the confusion. I’ve updated both the utvm-mbed-runtime and utvm-zephyr-runtime repos to reflect that they’re archival for now. a future design change to TVM may bring them back, but I will post up about that if it happens.

To replicate the µTVM demo with the Nucleo F746ZG board, check out the instructions included at https://github.com/areusch/microtvm-blogpost-eval. There is also a Zephyr runtime included there.

Andrew

Hey @tgall_foo , @areusch Thanks for the suggestions. Following your post, I was able to get the demo running on STM32 board. I will have to go through the uTVM flow to dig a little deeper. Do we have any sort of documentation which can tell me the uTVM flow apart from the blogpost. I want to understand how can we target other boards to uTVM. What I understood so far is as long as the target support JTAG, uTVM should run on it. Is my assumption right?

Hey @aakah18151, great to hear you were able to get things working! I have been working on some µTVM design documentation which may help to explain this. It’s now in PR 7164. Unfortunately I don’t currently have a step-by-step guide to adding new targets.

Our platform requirements have somewhat changed from our initial blog post, but you’re right that for production deployment you only need the ability to program a device e.g. with JTAG. For TVM’s device-aware optimization flow (autotvm) you now need a UART-like communication channel. It should be possible to provide this using e.g. semihosting, but we haven’t proved this out yet.

Perhaps have a look at the design doc in that PR or at the microTVM tutorial at tvmconf this year as a starting point.