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/02/02 20:43:18 UTC

[GitHub] [tvm] areusch edited a comment on pull request #7392: Fix rand_r() proper inclusion

areusch edited a comment on pull request #7392:
URL: https://github.com/apache/tvm/pull/7392#issuecomment-771968417


   @cbalint13 it is a little bit more complicated than just specifying the Compiler implementation when cross-compiling. when using DefaultCompiler, there is assumption that all of the code needed to run the _platform_ (I.e. SoC startup code, peripheral config) lives in a `main.cc` or in a library you supply to `build_static_runtime(extra_libs=)`. on POSIX systems, this assumption doesn't impose much on the build, but in a bare metal deployment situation it's much different.
   
   to increase compatibility with the many dev boards out there, we compile against a cross-platform deployment framework (Zephyr). most cross-platform bare-metal deployment frameworks include their own build system to determine which sources to include and the compiler config e.g. cflags, ldflags. Zephyr does this from CMakeLists.txt and prj.conf. making it convention to include this config in TVM Python scripts would mean that convention is to replicate the build system from the RTOS you're using.
   
   unfortunately we kind of built out this Compiler abstraction without paying too much attention to that, so it's kind of the wrong level of abstraction to use here. the long-term solution to this problem is to replace Compiler with something more "project-level," where "project" roughly refers to the startup code, RTOS, and other application specific code you need to run models on a bare metal device. See #6 on the [µTVM M2 roadmap](https://discuss.tvm.apache.org/t/tvm-microtvm-m2-roadmap/8821).
   
   to address your question B: you are still welcome to instantiate a Compiler impl of your choice and this doesn't need to live in the TVM source tree. until the project API refactor is done, happy to include additional impls into the TVM tree so long as they can be tested (see `tests/micro/qemu/test_zephyr.py`).
   
   in the short term, I think it would be great to change DefaultCompiler to error when you try to compile a file with a cortex-m target. that would be adjusting the logic [here](https://github.com/apache/tvm/blob/main/python/tvm/micro/compiler.py#L101). want to take a shot at that?


----------------------------------------------------------------
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.

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