gromero commented on a change in pull request #8940:
URL: https://github.com/apache/tvm/pull/8940#discussion_r703093613
##########
File path: apps/microtvm/zephyr/template_project/microtvm_api_server.py
##########
@@ -57,6 +57,19 @@
IS_TEMPLATE = not (API_SERVER_DIR / MODEL_LIBRARY_FORMAT_RELPATH).exists()
+# Maps a short, identifying microtvm device string to (target, zephyr_board).
+MICRO_DEVICES = {
+ "qemu_x86": ("host", "qemu_x86"),
Review comment:
OK for me to move it into the server side. Same comment applies here as
for the arduino devices above.
##########
File path: apps/microtvm/arduino/template_project/microtvm_api_server.py
##########
@@ -43,6 +43,19 @@
IS_TEMPLATE = not (API_SERVER_DIR / MODEL_LIBRARY_FORMAT_RELPATH).exists()
+# Maps a short, identifying microtvm device string to (target, arduino_board).
+MICRO_DEVICES = {
Review comment:
OK for me to move it into the server side. In fact I'm planing to add
that list as the choices for PROJECT_OPTIONS '{zephyr,arduino}_board` option
because currently the API doesn't do that. That's necessary for the TVMC +
micro targets work. So that change concur with what I'm planning.
##########
File path: apps/microtvm/reference-vm/README.md
##########
@@ -72,20 +72,20 @@ For example:
$ ./base-box-tool.py --provider virtualbox build zephyr
```
-2. **Run** release tests for each platform:
+2. **Run** release tests for each microTVM device:
Review comment:
I think that 'platform' here actually refers to PLATFORM (like `zephyr`
or `arduino`), so not related to MICROTVM_PLATFORM. Hence that's an occurrence
of 'platform' that is correct and should not be replace in the context of the
proposed change.
##########
File path: tests/micro/zephyr/conftest.py
##########
@@ -17,35 +17,42 @@
import datetime
import os
import pathlib
+import sys
import pytest
import tvm.contrib.utils
import tvm.target.target
-# The models that should pass this configuration. Maps a short, identifying
platform string to
-# (model, zephyr_board).
-PLATFORMS = {
- "qemu_x86": ("host", "qemu_x86"),
- "qemu_riscv32": ("host", "qemu_riscv32"),
- "qemu_riscv64": ("host", "qemu_riscv64"),
- "mps2_an521": ("mps2_an521", "mps2_an521"),
- "nrf5340dk": ("nrf5340dk", "nrf5340dk_nrf5340_cpuapp"),
- "stm32f746xx_disco": ("stm32f746xx", "stm32f746g_disco"),
- "stm32f746xx_nucleo": ("stm32f746xx", "nucleo_f746zg"),
- "stm32l4r5zi_nucleo": ("stm32l4r5zi", "nucleo_l4r5zi"),
- "zynq_mp_r5": ("zynq_mp_r5", "qemu_cortex_r5"),
-}
+TEMPLATE_PROJECT_DIR = (
+ pathlib.Path(__file__).parent
+ / ".."
+ / ".."
+ / ".."
+ / "apps"
+ / "microtvm"
+ / "zephyr"
+ / "template_project"
+).resolve()
+
+
+def zephyr_micro_devices() -> dict:
+ sys.path.insert(0, str(TEMPLATE_PROJECT_DIR))
+ try:
+ import microtvm_api_server
+ finally:
+ sys.path.pop(0)
+
+ return microtvm_api_server.MICRO_DEVICES
Review comment:
Same comment on importing directly the Arduino devices applies here.
Please see above.
##########
File path: tests/micro/arduino/conftest.py
##########
@@ -48,13 +35,23 @@
).resolve()
+def arduino_micro_devices() -> dict:
+ sys.path.insert(0, str(TEMPLATE_PROJECT_DIR))
+ try:
+ import microtvm_api_server
+ finally:
+ sys.path.pop(0)
+
+ return microtvm_api_server.MICRO_DEVICES
Review comment:
I'm ok with importing the list of devices directly here for now. But I
consider that a kind of shortcut to the API, however currently there is no way
to get it via the API info query. That's another change I'm planning to submit
soon because it's necessary for the TVMC + micro target work. Hence, only as a
reference, that's what I'm planning
https://github.com/gromero/tvm/commit/7ff1f17f31d30d806c1fd4a6cbf5e609766901e0
That change would allow something like:
```
import tvm.micro.project
```
and then query the boards via the API:
```
template = project.TemplateProject.from_directory(ZEPHYR_TEMPLATE_DIR)
boards = template.info()["zephyr_board"]
```
Anyways, I'm ok with importing directly for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]