Arm(R) Ethos(TM)-U is a new class of machine learning processors, called a
microNPU, specifically designed to accelerate ML inference in area-constrained
embedded and IoT devices. This readme briefly describes how to integrate Ethos-U
related hardware and software into TFLM.
related hardware and software into TFLM. See also [Ethos-U ML Evaluation kit examples](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit).
To enable the Ethos-U software stack, add `CO_PROCESSOR=ethos_u` to the make
command line. See example below.
...
...
@@ -16,7 +16,7 @@ command line. See example below.
## Ethos-U custom operator
The TFLM runtime will dispatch workloads to Ethos-U when it encounters an
Ethos-U custom op in the tflite file. The Ethos-U custom op is added by a tool
called Vela and contains information the Ethos-U hardware need to execute
called Ethos-U Vela and contains information the Ethos-U hardware need to execute
the workload. More info in the [Vela repo](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ethos-u-vela).
```
...
...
@@ -47,14 +47,19 @@ startup, before calling the TFLM API. More info in the [Ethos-U driver repo](htt
For even more info regarding Vela and Ethos-U, checkout [Ethos-U landing page](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ethos-u/+/refs/heads/master).
# Example 1
# Some examples of compiling a binary and running a network with Ethos-U support.
In order to run a test with Ethos-U55 enabled, a platform with corresponding hardware support is required. One such platform is the fixed virtual platform (FVP) based on Arm Corstone-300 software. See tensorflow/lite/micro/cortex_m_corstone_300/README.md for more info.
Compile a binary with Ethos-U support using the following command:
On top of that the .tflite model needs to be modified according subchapter "Ethos-U custom operator" above.
## Example using network tester
See tensorflow/lite/micro/examples/network_tester/README.md for more info.
```
make -f tensorflow/lite/micro/tools/make/Makefile network_tester_test CO_PROCESSOR=ethos_u \
# TODO(b/143715361): downloading first to allow for parallel builds.
readable_run make -f tensorflow/lite/micro/tools/make/Makefile OPTIMIZED_KERNEL_DIR=${OPTIMIZED_KERNEL_DIR}TARGET=${TARGET}TARGET_ARCH=${TARGET_ARCH} third_party_downloads
readable_run make -f tensorflow/lite/micro/tools/make/Makefile CO_PROCESSOR=ethos_u OPTIMIZED_KERNEL_DIR=${OPTIMIZED_KERNEL_DIR}TARGET=${TARGET}TARGET_ARCH=${TARGET_ARCH} third_party_downloads
# Avoid running tests in parallel.
readable_run make -f tensorflow/lite/micro/tools/make/Makefile clean
readable_run make -j$(nproc)-f tensorflow/lite/micro/tools/make/Makefile OPTIMIZED_KERNEL_DIR=${OPTIMIZED_KERNEL_DIR}TARGET=${TARGET}TARGET_ARCH=${TARGET_ARCH} build
readable_run make -f tensorflow/lite/micro/tools/make/Makefile OPTIMIZED_KERNEL_DIR=${OPTIMIZED_KERNEL_DIR}TARGET=${TARGET}TARGET_ARCH=${TARGET_ARCH}test
readable_run make -j$(nproc)-f tensorflow/lite/micro/tools/make/Makefile CO_PROCESSOR=ethos_u OPTIMIZED_KERNEL_DIR=${OPTIMIZED_KERNEL_DIR}TARGET=${TARGET}TARGET_ARCH=${TARGET_ARCH} build
readable_run make -f tensorflow/lite/micro/tools/make/Makefile CO_PROCESSOR=ethos_u OPTIMIZED_KERNEL_DIR=${OPTIMIZED_KERNEL_DIR}TARGET=${TARGET}TARGET_ARCH=${TARGET_ARCH}test