All Projects → tum-ei-eda → utvm_staticrt_codegen

tum-ei-eda / utvm_staticrt_codegen

Licence: Apache-2.0 license
This project contains a code generator that produces static C NN inference deployment code targeting tiny micro-controllers (TinyML) as replacement for other µTVM runtimes. This tools generates a runtime, which statically executes the compiled model. This reduces the overhead in terms of code size and execution time compared to having a dynamic …

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
CMake
9771 projects

Labels

Projects that are alternatives of or similar to utvm staticrt codegen

FaceRecognitionCpp
Large input size REAL-TIME Face Detector on Cpp. It can also support face verification using MobileFaceNet+Arcface with real-time inference. 480P Over 30FPS on CPU
Stars: ✭ 40 (+100%)
Mutual labels:  tvm
Nnvm
No description or website provided.
Stars: ✭ 1,639 (+8095%)
Mutual labels:  tvm
Tvm
Open deep learning compiler stack for cpu, gpu and specialized accelerators
Stars: ✭ 7,494 (+37370%)
Mutual labels:  tvm
tvm-vta
Open, Modular, Deep Learning Accelerator
Stars: ✭ 136 (+580%)
Mutual labels:  tvm

µTVM StaticRT CodeGen

This project contains a code generator that produces static C NN inference deployment code targeting tiny micro-controllers (TinyML) as replacement for other µTVM runtimes. This tools generates a runtime, which statically executes the compiled model. This reduces the overhead in terms of code size and execution time compared to having a dynamic on-device runtime.

Tool flow

Requirements

  • Install required system packages
  • Install required python packages
  • Clone TVM
  • Apply patches in tvm_patches/
  • Build TVM

For detailed commands see CI Config.

Building

The generator is a conventional CMake project.

mkdir build && cd build
cmake ..
cmake --build .

Usage

  • Point python to the TVM installation:

    export PYTHONPATH=../tvm/python:${PYTHONPATH}
    
  • Generate a graph.json, params.bin and kernels.c file for your model with µTVM. A complete example is shown in this µTVM example script.

  • Inspect kernels.c and determine the required workspace size by looking at the TVMBackendAllocWorkspace calls and picking the largest used byte size. If there are no calls, the size should be zero.

  • Execute the µTVM StaticRT CodeGen:

    ./utvm_staticrt_codegen graph.json params.bin staticrt.c $WORKSPACE_SIZE
    
  • Now the kernels.c and staticrt.c can be compiled together with some calling code into a complete application. An example is given in examples/target_src/.

For detailed commands see example full flow script.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].