tum-ei-eda / muriscv-nn

muRISCV-NN is a collection of efficient deep learning kernels for embedded platforms and microcontrollers.
Apache License 2.0
61 stars 6 forks source link

How to generate model data? #68

Open fumao13579 opened 3 months ago

fumao13579 commented 3 months ago

Hello, I need to run my own NN model. How can the model data in TVM Integration Tests, such as ic_input_data.cc, be generated? How should the VLEN and ELEN settings be adjusted?"

PhilippvK commented 3 months ago

Hey, sorry for the late response.

How can the model data in TVM Integration Tests, such as ic_input_data.cc, be generated

For TVM the generation of the Kernels (which call muRISCV-NN via the BYOC feature) is done here: https://github.com/tum-ei-eda/muriscv-nn/blob/0e70311f5e70a73e088c18dcc345e958e3d8b174/Integration/tvm/setup_tvm.sh#L53 This could also be extended for more than the four default models. However, the contents of aww_data etc. is model specific and needs to be generated by hand, In case you only want to run the model without checking the outputs, these files should not be required. Further, you also need to come up with a minimal main.c for each new model, as this is not generated by TVM.

Actually, there is an alternative approach for integrating muRISCV-NN with TVM or TFLM effortlessly for a given TFLite model: MLonMCU can automate all steps from the pre-trained model over generating the kernels, compiling the target software, running/benchmarking the model on the target and recently also verifying the outputs. You can learn more here (https://github.com/tum-ei-eda/mlonmcu) or by running the integrated benchmarks which are also powered by MLonMCU: https://github.com/tum-ei-eda/muriscv-nn/tree/master/Integration/MLonMCU

How should the VLEN and ELEN settings be adjusted?

These settings are target specific and in case of muRISCV-NN only relevant for configuring the Simulators used in Unit/Integration Tests (Spike). The kernels themself are VLEN-agnostic.