-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App #8922
Conversation
Change-Id: I719b176bb98253aacb59af766d4eeacbad142297
9887474
to
5d34b28
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the late review, I've been through and have some change suggestions, otherwise this is a great demonstration of the power of TVM in embedded 😸
neat! :) would be interested to discuss about perhaps creating apps/microtvm/ethosu e.g. project API impl. also have one question about the Python deps. |
Changes to address review comments. Change-Id: Ic15ebf3ee0d79a94ad442a83b9db5b3c5f57eaf1
@Mousius Thanks for all the great comments & suggestions. |
@areusch Thanks for the comments. |
Lets keep this demo for a user seeking to integrate inference to an already existing project rather than generating a new one. However, that does not preclude us creating another demo using project API for other usecases. |
@Mousius PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@grant-arm I just have one set of suggestion 😸 thanks for working through this with me.
Refactored convert_image.py Change-Id: I2e6e9dc6722f683182e2bd101c19b36f214c0151
Thanks for the suggestions @Mousius . Could you please take a look again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit but I don't think it effects the overall demo so more than happy to see this landed.
header_file.write( | ||
"#include <tvmgen_default.h>\n" | ||
+ f"const size_t {tensor_name}_len = {tensor_data.size};\n" | ||
+ f'uint8_t {tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need +
es here (see: https://github.com/apache/tvm/blob/main/python/tvm/micro/interface_api.py#L59-L66)
header_file.write( | |
"#include <tvmgen_default.h>\n" | |
+ f"const size_t {tensor_name}_len = {tensor_data.size};\n" | |
+ f'uint8_t {tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "' | |
header_file.write( | |
"#include <tvmgen_default.h>\n" | |
f"const size_t {tensor_name}_len = {tensor_data.size};\n" | |
f'uint8_t {tensor_name}[] __attribute__((section("{section}"), aligned(16))) = "' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @grant-arm @Mousius @leandron @areusch . This is merged now. |
@grant-arm just to follow-up on my comment, to use the Project API we essentially need to write a |
How to run a model only on bare metal Arm® Cortex®-M55 CPU not Ethos(TM)-U55 NPU ? |
@JKANG94 Currently we compile for offloading Conv2D & Depthwise Conv to Ethos(TM)-U55 NPU
In order to compile for Arm(R) Cortex(R)-M55 CPU only, we would use:
Please note though that if you try this with the current demo and MobileNet v1, when you come to building the project, the linker will complain that the ITCM memory region has overflowed. This is due to the generated code not placing params in any specific section and the linker defaulting to placing them in ITCM. We have WIP to address this. (Please refer to the USMP RFC for pinning constant buffers on different memories) |
I just ran "run_demo.sh", but there was a error " File "/workcode/tvm/tvm/python/tvm/relay/build_module.py", line 371, in build |
@JKANG94 thanks for pointing this out. #9218 changes the command line arguments required by tvmc which breaks the existing Arm(R) Cortex(R)-M55 CPU and Arm(R) Ethos(TM)-U55 NPU Demo App. #9323 fixes the demo app. In addition, we plan to enable running the demo app on CI so that we can catch these types of problems in future. |
@grant-arm Using tvmc, I got operator implementations produced by tvm in codegen folder. I want to deploy these to cortext-m devices standalonely, how to get tvm c runtime static library and tvm c GraphExecutor static library? |
Hi @JKANG94 , probably the most useful reference is the Makefile in Since we compile with |
|
Hope that helps. |
…e#8922) This commit adds a demo application that uses TVM to run a model on bare metal Arm® Cortex®-M55 CPU and Arm® Ethos™-U55 NPU. The demo demonstrates running Mobilenet_v1 TFLite model on the Fixed Virtual Platform (FVP) of the Arm(R) Corstone(TM)-300 reference package.
…e#8922) This commit adds a demo application that uses TVM to run a model on bare metal Arm® Cortex®-M55 CPU and Arm® Ethos™-U55 NPU. The demo demonstrates running Mobilenet_v1 TFLite model on the Fixed Virtual Platform (FVP) of the Arm(R) Corstone(TM)-300 reference package.
This PR adds a demo application that uses TVM to run a model on bare metal Arm® Cortex®-M55 CPU and Arm® Ethos™-U55 NPU
This PR is blocked on merging #8795 , #8806, #8811, #8849 and #8854. Since this is built on top of all those PR branches, this contains the accumulation of contents of the all the PRs.