This repo contains:
- a script that converts the raw output provided by Vela into C that directly invokes the Ethos driver
- A proof-of-concept example output for the MLPerf Tiny KWS model
- A snapshot of the ethos driver and a customer toolchain file to compile it for Ambiqsuite-compatible binaries
- A neuralspot-compatible wrapper that gets that compiling
- Only single-command-stream models are supported. Any model that requires CPU fallback will fail to convert.
- Only GCC (arm-none-eabi-gcc, specifically) is supported
- This has not been tested on real hardware. We only know that it compiles.
- Compile the model using Vela
- Convert the resulting raw output file (a serialized numpy file) into C
- Compile the resulting C as needed (at minimum you need a main() and a pointer to the Ethos register base)
pip install ethos-u-vela
vela --accelerator-config ethos-u85-256 ../clean/model_perf_tests/models/kws/kws_ref_model_aligned.tflite --output-format raw
python vela_raw_to_c.py ../output/kws_ref_model_aligned_vela.npz --out-dir . --prefix foo
The repo contains contains a pre-built ethos static lib ready for linking into a C project, but if you need to modify something, here is how to compile
$> rm -rf build
$> cmake -B build \\n -DCMAKE_TOOLCHAIN_FILE=./arm-none-eabi-gcc.cmake \\n -DTARGET_CPU=cortex-m55 \\n -DETHOSU_TARGET_NPU_CONFIG=ethos-u85-256 \\n -DCMSIS_PATH=../../clean/neuralSPOT/extern/CMSIS/CMSIS_5-5.9.0\ncmake --build build -j
This example is designed to compile in neuralSPOT, but it should be pretty straightforward to compile into bare metal C. To compile the example:
$> cp -R example/vela ../neuralSPOT/apps/experiments
$> cd ../neuralSPOT
$> make EXAMPLE=experiments/vela