You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/10/28 23:49:09 UTC

[GitHub] [tvm-rfcs] mehrdadh commented on a change in pull request #43: [RFC][TVMC] Add support for micro targets

mehrdadh commented on a change in pull request #43:
URL: https://github.com/apache/tvm-rfcs/pull/43#discussion_r738836247



##########
File path: rfcs/0021-tvmc_add_support_for_micro_targets.md
##########
@@ -0,0 +1,461 @@
+- Feature Name: tvmc_add_support_for_micro_targets
+- Start Date: 2021-10-09
+- RFC PR: [apache/tvm-rfcs#0000](https://github.com/apache/tvm-rfcs/pull/0000)
+- GitHub Issue: [apache/tvm#0000](https://github.com/apache/tvm/issues/0000)
+
+# Summary
+
+This RFC obsoletes RFC **[0]**.
+
+This RFC depends on RFC **[1]**.
+
+This RFC is about how TVMC (TVM CLI tool) can be extended to support microTVM
+targets, considering the variety of platforms supported by microTVM, like Zephyr
+and Arduino, and also considering future platforms, taking into account the use
+of custom/adhoc platforms provided by users at their convenience.
+
+The interface here proposed relies on the new Project API available on microTVM.
+
+PR [9229](https://github.com/apache/tvm/pull/9229) implements the interface in
+question **[2]**.
+
+**[0]** [RFC] TVMC: Add support for µTVM -- https://discuss.tvm.apache.org/t/rfc-tvmc-add-support-for-tvm/9049
+
+**[1]** [RFC][Project API] Extend metadata in ProjectOption -- https://github.com/apache/tvm-rfcs/pull/33

Review comment:
       maybe refer to the merged RFC now?
   https://github.com/apache/tvm-rfcs/blob/main/rfcs/0020-project_api_extend_metadata.md

##########
File path: rfcs/0021-tvmc_add_support_for_micro_targets.md
##########
@@ -0,0 +1,461 @@
+- Feature Name: tvmc_add_support_for_micro_targets
+- Start Date: 2021-10-09
+- RFC PR: [apache/tvm-rfcs#0000](https://github.com/apache/tvm-rfcs/pull/0000)
+- GitHub Issue: [apache/tvm#0000](https://github.com/apache/tvm/issues/0000)
+
+# Summary
+
+This RFC obsoletes RFC **[0]**.
+
+This RFC depends on RFC **[1]**.
+
+This RFC is about how TVMC (TVM CLI tool) can be extended to support microTVM
+targets, considering the variety of platforms supported by microTVM, like Zephyr
+and Arduino, and also considering future platforms, taking into account the use
+of custom/adhoc platforms provided by users at their convenience.
+
+The interface here proposed relies on the new Project API available on microTVM.
+
+PR [9229](https://github.com/apache/tvm/pull/9229) implements the interface in
+question **[2]**.
+
+**[0]** [RFC] TVMC: Add support for µTVM -- https://discuss.tvm.apache.org/t/rfc-tvmc-add-support-for-tvm/9049
+
+**[1]** [RFC][Project API] Extend metadata in ProjectOption -- https://github.com/apache/tvm-rfcs/pull/33
+
+**[2]** [TVMC] Add new micro context -- https://github.com/apache/tvm/pull/9229
+
+# Motivation
+
+Currently if a microTVM user wants to compile, build, flash, and run a model for
+a micro target available on a supported microTVM platform -- like Zephyr and
+Arduino -- it's necessary to drive the process end-to-end via Python scripts.
+This is ok when creating tests and developing or experimenting with new microTVM
+code, for example, but for some users that just want to try a new model of
+interest on a micro target that way can be slow.
+
+TVMC is a command-line driver for TVM (`tvmc`) that allows users to control the
+compilation and execution of models on a plethora of targets, using only the
+CLI, however it currently does not support microTVM targets, so it can not drive
+a similar workflow (compile, run, etc) on microcontrollers.
+
+This RFC proposes to extend TVMC to support the microTVM targets and platforms
+so one can easily use `tvmc` to **compile**, **build** (a device image with the
+compiled model of interest), **flash**, and **run** a model on a micro target
+using only a command-line interface.
+
+# Guide-level explanation
+[guide-level-explanation]: #guide-level-explanation
+
+Micro targets have unique requirements which justifies the creation of a new
+context in `tvmc` called `micro` to accommodate them.
+
+For instance, a given micro target can exist in more than one supported
+platform, like the STM32F746 MCU that can be supported by `Zephyr` and by
+`FreeRTOS`. Hence a platform must be selected in addition to the MCU and/or the
+board.
+
+Moreover, the build and flash steps, although might not be totally exclusive on
+micro targets, are quite specific (like using the toolchain and the flash tool
+supported by the platform), so much it justifies them to exist inside the new
+micro context, i.e. under `tvmc micro`.
+
+In that sense, the following subcommands are available under `tvmc micro`:
+
+**1. create-project**
+
+**2. build**
+
+**3. flash**
+
+`create-project` purpose is for creating a project directory based on **(a)** an
+already compiled model kept in a Model Library Format (MLF) archive and **(b)**
+a template associated to a platform, like Zephyr, allowing one to specify
+several options specific to the selected platform, like the board name and extra
+files to be included in the project directory to will be created based on the
+template directory. For convenience, an alias (`create`) will exist for this
+subcommand.
+
+`build` can be used for building a firmware image ready to be flashed to the
+board specified. For example, if Zephyr platform is selected build a
+`zephyr.{elf,hex}` image. Pertinent options for 'build' given the platform
+selected as an option under 'build' will become available.
+
+`flash` can be used for effectively flashing, to the selected board, the
+firmware built. Again, pertinent options for 'flash' context considering the

Review comment:
       change to `built firmware`?

##########
File path: rfcs/0021-tvmc_add_support_for_micro_targets.md
##########
@@ -0,0 +1,461 @@
+- Feature Name: tvmc_add_support_for_micro_targets
+- Start Date: 2021-10-09
+- RFC PR: [apache/tvm-rfcs#0000](https://github.com/apache/tvm-rfcs/pull/0000)
+- GitHub Issue: [apache/tvm#0000](https://github.com/apache/tvm/issues/0000)
+
+# Summary
+
+This RFC obsoletes RFC **[0]**.
+
+This RFC depends on RFC **[1]**.
+
+This RFC is about how TVMC (TVM CLI tool) can be extended to support microTVM
+targets, considering the variety of platforms supported by microTVM, like Zephyr
+and Arduino, and also considering future platforms, taking into account the use
+of custom/adhoc platforms provided by users at their convenience.
+
+The interface here proposed relies on the new Project API available on microTVM.
+
+PR [9229](https://github.com/apache/tvm/pull/9229) implements the interface in
+question **[2]**.
+
+**[0]** [RFC] TVMC: Add support for µTVM -- https://discuss.tvm.apache.org/t/rfc-tvmc-add-support-for-tvm/9049
+
+**[1]** [RFC][Project API] Extend metadata in ProjectOption -- https://github.com/apache/tvm-rfcs/pull/33
+
+**[2]** [TVMC] Add new micro context -- https://github.com/apache/tvm/pull/9229
+
+# Motivation
+
+Currently if a microTVM user wants to compile, build, flash, and run a model for
+a micro target available on a supported microTVM platform -- like Zephyr and
+Arduino -- it's necessary to drive the process end-to-end via Python scripts.
+This is ok when creating tests and developing or experimenting with new microTVM
+code, for example, but for some users that just want to try a new model of
+interest on a micro target that way can be slow.
+
+TVMC is a command-line driver for TVM (`tvmc`) that allows users to control the
+compilation and execution of models on a plethora of targets, using only the
+CLI, however it currently does not support microTVM targets, so it can not drive
+a similar workflow (compile, run, etc) on microcontrollers.
+
+This RFC proposes to extend TVMC to support the microTVM targets and platforms
+so one can easily use `tvmc` to **compile**, **build** (a device image with the
+compiled model of interest), **flash**, and **run** a model on a micro target
+using only a command-line interface.
+
+# Guide-level explanation
+[guide-level-explanation]: #guide-level-explanation
+
+Micro targets have unique requirements which justifies the creation of a new
+context in `tvmc` called `micro` to accommodate them.
+
+For instance, a given micro target can exist in more than one supported
+platform, like the STM32F746 MCU that can be supported by `Zephyr` and by
+`FreeRTOS`. Hence a platform must be selected in addition to the MCU and/or the
+board.
+
+Moreover, the build and flash steps, although might not be totally exclusive on
+micro targets, are quite specific (like using the toolchain and the flash tool
+supported by the platform), so much it justifies them to exist inside the new
+micro context, i.e. under `tvmc micro`.
+
+In that sense, the following subcommands are available under `tvmc micro`:
+
+**1. create-project**
+
+**2. build**
+
+**3. flash**
+
+`create-project` purpose is for creating a project directory based on **(a)** an
+already compiled model kept in a Model Library Format (MLF) archive and **(b)**
+a template associated to a platform, like Zephyr, allowing one to specify
+several options specific to the selected platform, like the board name and extra
+files to be included in the project directory to will be created based on the
+template directory. For convenience, an alias (`create`) will exist for this
+subcommand.
+
+`build` can be used for building a firmware image ready to be flashed to the
+board specified. For example, if Zephyr platform is selected build a
+`zephyr.{elf,hex}` image. Pertinent options for 'build' given the platform
+selected as an option under 'build' will become available.
+
+`flash` can be used for effectively flashing, to the selected board, the
+firmware built. Again, pertinent options for 'flash' context considering the
+platform selected will be made available for the user, like for example options
+regarding the serial port number to be used when flashing the image to the
+board.
+
+`build` and `flash` subcommads are intended to help with debugging inference
+flows built on top of Project API infrastructure. Hence they’re not intended to
+replace the user’s workflow (e.g. users can still build and flash independently
+of these subcommands).
+
+For all these subcommads (1, 2, and 3) the platform template can be selected
+among the default platforms (`zephyr` and `arduino`) or can be a custom one, in
+that case the platform template must be selected instead. Upon selecting the
+template platform option `-d TEMPLATE_DIR` will become available and one can so
+specify the adhoc template dir (which must contain an adhoc Project API server
+as per the Project API specification).
+
+A **key-value pair** is used to specify the options specific to the platforms.
+If the option is of type 'bool' the values available are 'true' and 'false'.
+Details on project option types are described in **RFC-0020**.

Review comment:
       add link for `RFC-0020`?




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org