tum-ei-eda / mlonmcu

Tool for the deployment and analysis of TinyML applications on TFLM and MicroTVM backends
Apache License 2.0
29 stars 12 forks source link

CMSIS-NN Feature: Dependency resolution issue #25

Closed PhilippvK closed 1 year ago

PhilippvK commented 2 years ago

There is a flaw iin the current implementation of the cmsisnn issue:

A workaround for this issue is explicitly passing the value of cmsisnn.lib via the command line: --config cmsisnn.lib=/tmp/mlonmcu_env/deps/install/cmsisnn_x86_dbg/libmuriscv-nn.a

To tacke the issue we have to resolve one/both of these problems:

Another option which might be feasible is the following:

Instead of the actual value of cmsisnn.lib config/cache variable we just pass some sort of reference to tflm.optimized_kernel_libs which is then resolved when tflm.optimized_kernel_libs is accessed, e.g. in TfLiteFramework.get_cmake_args(). We should keep this in mind when tackling #15 as this might help to get rid of A. and B..


The issue would also apply to muriscvnn, as we it would be great if we could use the scalar version on other platforms as well for comparisons.

PhilippvK commented 2 years ago

An alternative approach would be building the libcmsis-nn.a (or libmuriscv-nn.a) on demand when compiling the target software with cmake. However I would prefer to have those libs prebuild to only link against them.

PhilippvK commented 2 years ago

I would like to build cmsis-nn, muriscv-nn,... together with the target software instead of pre-building them during mlonmcu setup as we do not have another choice for non-MLIF platforms (e.g. espidf and further platforms which might get added in the future). As those libs are quite small the increate of compile time should be negligible.

However to use those features in combination with the tflite-micro-compiler they needs to be a version of tflmc.exe built with e.g. muriscvnn support -> As long as we only execute the pre-interpreter on the host (x86) this should me possible as only one version of muriscvnn.lib would exists.

As mentioned in #17 a long term goal would be using TFLMC in the target architecture to get more accurate arena estimations and enable target-specific features (e.g. vext). This would not work out nice with the mentioned workaround...

PhilippvK commented 1 year ago

Closing because not meaningful