Adding instructions on how to run CMSIS-NN opt kernels using mbed

Change-Id: I31812627f95de1f8dea5704d5880cc1ffcd132cc
This commit is contained in:
Fredrik Knutsson 2019-06-25 09:46:23 +02:00
parent c6177ea274
commit 206e5bbdb4

View File

@ -366,17 +366,46 @@ optimizations and link it with the microlite lib.
To utilize the CMSIS-NN optimized kernels, choose your target, e.g. Bluepill,
and build with:
make -f tensorflow/lite/experimental/micro/tools/make/Makefile TAGS=cmsis-nn
TARGET=bluepill test
```
make -f tensorflow/lite/experimental/micro/tools/make/Makefile TAGS=cmsis-nn TARGET=bluepill test
```
That will build the microlite lib including CMSIS-NN optimized kernels based on
the version downloaded by 'download_dependencies.sh', so make sure you have run
this script. If you want to utilize another version of CMSIS, clone it to a
custom location run the following command:
make -f tensorflow/lite/experimental/micro/tools/make/Makefile
CMSIS_PATH=<CUSTOM_LOCATION> TAGS=cmsis-nn TARGET=bluepill test (--- Under
development, it will build, but test will fail ---)
```
make -f tensorflow/lite/experimental/micro/tools/make/Makefile CMSIS_PATH=<CUSTOM_LOCATION> TAGS=cmsis-nn TARGET=bluepill test
```
To test the optimized kernel(s) on your target platform using mbed (depthwise
conv in this example), follow these steps:
1. Clone CMSIS to a custom location (<CUSTOM_LOCATION>) url:
https://github.com/ARM-software/CMSIS_5.git Make sure you're on the
development branch.
2. Generate the project for depthwise conv mbed test:
```
make -f tensorflow/lite/experimental/micro/tools/make/Makefile TAGS=cmsis-nn CMSIS_PATH=<CUSTOM_LOCATION> generate_depthwise_conv_test_mbed_project
```
3. Go to the generated mbed folder:
```
cd tensorflow/lite/experimental/micro/tools/make/gen/linux_x86_64/prj/depthwise_conv_test/mbed
```
4. Follow the steps in README_MBED.md to setup the environment. Or simply do:
```
mbed config root .
mbed deploy
python -c 'import fileinput, glob;
for filename in glob.glob("mbed-os/tools/profiles/*.json"):
for line in fileinput.input(filename, inplace=True):
print(line.replace("\"-std=gnu++98\"","\"-std=gnu++11\", \"-fpermissive\""))'
```
7. Compile and flash. The 'auto' flag requires your target to be plugged in.
```
mbed compile -m auto -t GCC_ARM -f --source . --source <CUSTOM_LOCATION>/CMSIS/NN/Include --source <CUSTOM_LOCATION>/CMSIS/NN/Source/ConvolutionFunctions --source <CUSTOM_LOCATION>/CMSIS/DSP/Include --source <CUSTOM_LOCATION>/CMSIS/Core/Include -j8
```
## Goals