tvm
tvm copied to clipboard
[Bug] MicroTVM Compilation fails for ARM Cortex-M4 ,with CMSIS-NN=false
Expected behavior
I wanted to port MicroTVM as easily as possible on a cortex-m4 (float)-based stm32g474 to test the inference speed of the MCU that was not optimized. Simplest HelloWorld model porting (predicted_sine_model.tflite) is selected under the option to remove CMSIS-NN (no CMSIS-NN) and bare metal (no zephyr)
Actual behavior
My source file is from:9. Bring microTVM to your own development environment Jupyter notebook: micro_custom_ide
First I changed the CMSIS option, USE_CMSIS_NN = False ,so that the TVMSystemLibEntryPoint() function is missing, which is Github issue #10237 .I followed this link to solve the problem, but this issue only solved the arduino-based python generated file, so I manually changed the runtime to: RUNTIME = Runtime("crt", {"system-lib": True})
After solving this problem (the main difference is default_lib0.c), a new problem arises: the generated tvmgen_default_run() and tvmgen_default___tvm_main__() function definitions are contradictory.
Environment
colab:micro_custom_ide.ipynb
pip install apache-tvm==0.13.dev295
ARM Keil MDK 5(In order to port to another MCU that only supports keil, I had to do without ST cubeide) ARM Compiler 6 C11 C++11
Files
script:copy_ipynb_file.txt model:sine_model.zip keil project:G474_MicroTVM_Helloworld.zip
This is my first time raising an issue, and the English may not be written well, if there is something bad about the question, please let me know, thank you
@mehrdadh , @mkatanbaf , @guberti , @tqchen
I am also experiencing this issue although I am just trying to get something working on x86 currently
I use the command
python -m tvm.driver.tvmc compile test.onnx --verbose --target='c -keys=cpu' --runtime=crt --runtime-crt-system-lib=1 --executor=aot --executor-aot-interface-api=c --executor-aot-unpacked-api=1 --pass-config tir.disable_vectorize=1 --output-format=mlf --output=model_tvm.tar
I can manually fix it by changing/removing the conflicts, but it is quite annoying.
@theicett we both seem to have encountered this problem and raised bugs on github and on the discuss forums. Not sure why no-one has replied to us, but it seems the microTVM section is much less popular. Do you know if it is struggling to find a maintainer or something?
@tomhepworth I also tried TFLM and ST XCubeAI before using microtvm, the former has a lot more problems than Microtvm (because my cross-compilation environment doesn't support C++ very well), and the latter is closed-source. MicroTVM is as much less popular as TFLM, but at least it can be used. I haven't contributed to any projects on GitHub, can we try changing its generated script source code to fix these issues?
I guess we could! I would like to understand the source better anyway but I expect it will take me some time to know what is going on
BTW, microTVM and VTA have been deprecated on 0.19.0, see https://discuss.tvm.apache.org/t/phasing-out-legacy-components/17703/22