From 12a57bc1bd49e29f125e5d2be997823745e3fbb9 Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Fri, 22 Oct 2021 12:23:17 +0100 Subject: [PATCH 1/6] Fix Arm(R) Ethos(TM)-U55 NPU Demo app - Change tvmc arguments to -executor=aot -interface-api=c -unpacked-api=1 Change-Id: Ic8d97ce9b4b11dc4d23ab028ac6a7832bca3ebbb --- apps/microtvm/ethosu/run_demo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/microtvm/ethosu/run_demo.sh b/apps/microtvm/ethosu/run_demo.sh index de33bfe8d427..a95e17d05f57 100755 --- a/apps/microtvm/ethosu/run_demo.sh +++ b/apps/microtvm/ethosu/run_demo.sh @@ -101,7 +101,7 @@ curl --retry 64 -sSL ${mobilenet_url} | gunzip | tar -xvf - ./mobilenet_v1_1.0_2 # Compile model for Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU tvmc compile --target="ethos-u -accelerator_config=ethos-u55-256, \ - c -runtime=c --link-params -mcpu=cortex-m55 --executor=aot --interface-api=c --unpacked-api=1" \ + c -runtime=c --link-params -mcpu=cortex-m55 -executor=aot -interface-api=c -unpacked-api=1" \ --pass-config tir.disable_vectorize=1 ./mobilenet_v1_1.0_224_quant.tflite --output-format=mlf tar -xvf module.tar From 11292280afa0344ce64b341823ed3bb89b5bee7c Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Fri, 22 Oct 2021 12:26:45 +0100 Subject: [PATCH 2/6] Fix Arm(R) Ethos(TM)-U55 NPU Demo app - Add a CI test for the Arm(R) Ethos(TM)-U55 NPU Demo app Change-Id: I8c535e6be573ae2cb2223dcbb10c7a9e4180799d --- apps/microtvm/ethosu/Makefile | 2 +- apps/microtvm/ethosu/run_demo.sh | 28 ++++++++++++++++++++++++++++ tests/scripts/task_cpp_unittest.sh | 7 +++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/apps/microtvm/ethosu/Makefile b/apps/microtvm/ethosu/Makefile index 65cf6524bc0c..370799972de6 100644 --- a/apps/microtvm/ethosu/Makefile +++ b/apps/microtvm/ethosu/Makefile @@ -28,7 +28,7 @@ CMSIS_PATH ?= ${ETHOSU_PATH}/cmsis ETHOSU_PLATFORM_PATH ?= ${ETHOSU_PATH}/core_platform CORSTONE_300_PATH = ${ETHOSU_PLATFORM_PATH}/targets/corstone-300 PKG_COMPILE_OPTS = -g -Wall -O2 -Wno-incompatible-pointer-types -Wno-format -mcpu=cortex-m55 -mthumb -mfloat-abi=hard -std=gnu99 -CMAKE = cmake +CMAKE ?= cmake CC = arm-none-eabi-gcc AR = arm-none-eabi-ar RANLIB = arm-none-eabi-ranlib diff --git a/apps/microtvm/ethosu/run_demo.sh b/apps/microtvm/ethosu/run_demo.sh index a95e17d05f57..dc219aa2b659 100755 --- a/apps/microtvm/ethosu/run_demo.sh +++ b/apps/microtvm/ethosu/run_demo.sh @@ -32,6 +32,10 @@ Usage: run_demo.sh [--ethosu_driver_path ETHOSU_DRIVER_PATH] Set path to CMSIS. --ethosu_platform_path ETHOSU_PLATFORM_PATH Set path to Arm(R) Ethos(TM)-U core platform. +--fvp_path FVP_PATH + Set path to FVP. +--cmake_path + Set path to cmake. EOF } @@ -79,6 +83,30 @@ while (( $# )); do fi ;; + --fvp_path) + if [ $# -gt 1 ] + then + export PATH="$2/models/Linux64_GCC-6.4:$PATH" + shift 2 + else + echo 'ERROR: --fvp_path requires a non-empty argument' >&2 + show_usage >&2 + exit 1 + fi + ;; + + --cmake_path) + if [ $# -gt 1 ] + then + export CMAKE="$2" + shift 2 + else + echo 'ERROR: --cmake_path requires a non-empty argument' >&2 + show_usage >&2 + exit 1 + fi + ;; + -*|--*) echo "Error: Unknown flag: $1" >&2 show_usage >&2 diff --git a/tests/scripts/task_cpp_unittest.sh b/tests/scripts/task_cpp_unittest.sh index 3df7b580d79d..24c552e87169 100755 --- a/tests/scripts/task_cpp_unittest.sh +++ b/tests/scripts/task_cpp_unittest.sh @@ -45,3 +45,10 @@ cd apps/bundle_deploy rm -rf build make test_dynamic test_static cd ../.. + +# Test Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU demo app +if test -f "/opt/arm/FVP_Corstone_SSE-300_Ethos-U55/models/Linux64_GCC-6.4/FVP_Corstone_SSE-300_Ethos-U55" && pip3 list | grep vela; then + cd apps/microtvm/ethosu + ./run_demo.sh --fvp_path /opt/arm/FVP_Corstone_SSE-300_Ethos-U55 --cmake_path /opt/arm/cmake/bin/cmake +fi +cd ../.. From 8754008e66e19bfa9aa4b37022d9f2afc2ad0c82 Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Fri, 22 Oct 2021 14:46:29 +0100 Subject: [PATCH 3/6] Fix Arm(R) Ethos(TM)-U55 NPU Demo app - pip install tvm/python so that tvmc works from command line Change-Id: Ieb6ec71dd3950f7d4657793f0d02a8078667b9d9 --- tests/scripts/task_cpp_unittest.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/scripts/task_cpp_unittest.sh b/tests/scripts/task_cpp_unittest.sh index 24c552e87169..dff5b2a40cdd 100755 --- a/tests/scripts/task_cpp_unittest.sh +++ b/tests/scripts/task_cpp_unittest.sh @@ -48,6 +48,7 @@ cd ../.. # Test Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU demo app if test -f "/opt/arm/FVP_Corstone_SSE-300_Ethos-U55/models/Linux64_GCC-6.4/FVP_Corstone_SSE-300_Ethos-U55" && pip3 list | grep vela; then + sudo pip3 install -e python cd apps/microtvm/ethosu ./run_demo.sh --fvp_path /opt/arm/FVP_Corstone_SSE-300_Ethos-U55 --cmake_path /opt/arm/cmake/bin/cmake fi From 50823bec683192163559f66031d45b54fde2e8a8 Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Fri, 22 Oct 2021 20:39:30 +0100 Subject: [PATCH 4/6] Fix Arm(R) Ethos(TM)-U55 NPU Demo app - Changes task_cpp_unittest.sh addressing comments Change-Id: I10decdcdcec3b61e27bacfac7e94e1449a22b1b7 --- tests/scripts/task_cpp_unittest.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/scripts/task_cpp_unittest.sh b/tests/scripts/task_cpp_unittest.sh index dff5b2a40cdd..3eaf97469d7f 100755 --- a/tests/scripts/task_cpp_unittest.sh +++ b/tests/scripts/task_cpp_unittest.sh @@ -47,9 +47,11 @@ make test_dynamic test_static cd ../.. # Test Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU demo app -if test -f "/opt/arm/FVP_Corstone_SSE-300_Ethos-U55/models/Linux64_GCC-6.4/FVP_Corstone_SSE-300_Ethos-U55" && pip3 list | grep vela; then +FVP_PATH="/opt/arm/FVP_Corstone_SSE-300_Ethos-U55" +VELA_INSTALLED=$(pip3 list | grep vela) +if [ -d $FVP_PATH ] && [ -n "$VELA_INSTALLED" ]; then sudo pip3 install -e python cd apps/microtvm/ethosu - ./run_demo.sh --fvp_path /opt/arm/FVP_Corstone_SSE-300_Ethos-U55 --cmake_path /opt/arm/cmake/bin/cmake + ./run_demo.sh --fvp_path $FVP_PATH --cmake_path /opt/arm/cmake/bin/cmake + cd ../../.. fi -cd ../.. From 7061172b6a1b57a7147ce19afbaecacaa00ff93c Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Fri, 22 Oct 2021 21:37:22 +0100 Subject: [PATCH 5/6] Fix Arm(R) Ethos(TM)-U55 NPU Demo app - Avoid installing TVM python and all its dependencies Change-Id: Iaa4dd5429871f02961cac12476f9dc46091bcb34 --- apps/microtvm/ethosu/run_demo.sh | 4 +++- tests/scripts/task_cpp_unittest.sh | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/microtvm/ethosu/run_demo.sh b/apps/microtvm/ethosu/run_demo.sh index dc219aa2b659..5d9efb359b24 100755 --- a/apps/microtvm/ethosu/run_demo.sh +++ b/apps/microtvm/ethosu/run_demo.sh @@ -128,7 +128,9 @@ mobilenet_url='https://storage.googleapis.com/download.tensorflow.org/models/mob curl --retry 64 -sSL ${mobilenet_url} | gunzip | tar -xvf - ./mobilenet_v1_1.0_224_quant.tflite # Compile model for Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU -tvmc compile --target="ethos-u -accelerator_config=ethos-u55-256, \ +# An alternative to using "python3 -m tvm.driver.tvmc" is to call +# "tvmc" directly once TVM has been pip installed. +python3 -m tvm.driver.tvmc compile --target="ethos-u -accelerator_config=ethos-u55-256, \ c -runtime=c --link-params -mcpu=cortex-m55 -executor=aot -interface-api=c -unpacked-api=1" \ --pass-config tir.disable_vectorize=1 ./mobilenet_v1_1.0_224_quant.tflite --output-format=mlf tar -xvf module.tar diff --git a/tests/scripts/task_cpp_unittest.sh b/tests/scripts/task_cpp_unittest.sh index 3eaf97469d7f..9dd19702cebd 100755 --- a/tests/scripts/task_cpp_unittest.sh +++ b/tests/scripts/task_cpp_unittest.sh @@ -48,9 +48,8 @@ cd ../.. # Test Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU demo app FVP_PATH="/opt/arm/FVP_Corstone_SSE-300_Ethos-U55" -VELA_INSTALLED=$(pip3 list | grep vela) -if [ -d $FVP_PATH ] && [ -n "$VELA_INSTALLED" ]; then - sudo pip3 install -e python +VELA_INSTALLED="$(pip3 list | grep vela)" +if test -d $FVP_PATH && test -n "$VELA_INSTALLED"; then cd apps/microtvm/ethosu ./run_demo.sh --fvp_path $FVP_PATH --cmake_path /opt/arm/cmake/bin/cmake cd ../../.. From 06a076da12234687d1d5296d4f676874dae57e48 Mon Sep 17 00:00:00 2001 From: Grant Watson Date: Mon, 25 Oct 2021 17:50:14 +0100 Subject: [PATCH 6/6] Fix Arm(R) Ethos(TM)-U55 NPU Demo app - Change the way we test for Vela being installed Change-Id: Ieacb8ca9b4dd2af6821e579094ce86359c2da7f0 --- tests/scripts/task_cpp_unittest.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/scripts/task_cpp_unittest.sh b/tests/scripts/task_cpp_unittest.sh index 9dd19702cebd..0022e084c1a9 100755 --- a/tests/scripts/task_cpp_unittest.sh +++ b/tests/scripts/task_cpp_unittest.sh @@ -48,8 +48,7 @@ cd ../.. # Test Arm(R) Cortex(R)-M55 CPU and Ethos(TM)-U55 NPU demo app FVP_PATH="/opt/arm/FVP_Corstone_SSE-300_Ethos-U55" -VELA_INSTALLED="$(pip3 list | grep vela)" -if test -d $FVP_PATH && test -n "$VELA_INSTALLED"; then +if test -d $FVP_PATH && pip3 list | grep vela; then cd apps/microtvm/ethosu ./run_demo.sh --fvp_path $FVP_PATH --cmake_path /opt/arm/cmake/bin/cmake cd ../../..