-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arm backend: Test TOSA, Ethos-U55 and Ethos-U85 on github
This will run some more models in the github test flow and also enable some unit tests to use Corston3x0 FVP. This structure up the Arm backend testing into separate runable scripts in the same structure as other backends. Signed-off-by: Zingo Andersen <zingo.andersen@arm.com> Change-Id: I5e11b1aca19460845e330b84d0696513c400c0f0
- Loading branch information
Showing
9 changed files
with
181 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
# Copyright 2024 Arm Limited and/or its affiliates. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# NB: This function could be used to install Arm dependencies | ||
# Setup arm example environment (including TOSA tools) | ||
git config --global user.email "github_executorch@arm.com" | ||
git config --global user.name "Github Executorch" | ||
bash examples/arm/setup.sh --i-agree-to-the-contained-eula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/bin/bash | ||
# Copyright 2024 Arm Limited and/or its affiliates. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
set -e | ||
|
||
script_dir=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) | ||
|
||
# Executorch root | ||
et_root_dir=$(cd ${script_dir}/../../.. && pwd) | ||
cd "${et_root_dir}" | ||
pwd | ||
|
||
|
||
TEST_SUITE=$1 | ||
|
||
help() { | ||
echo "Usage:" | ||
echo " $0 <TESTNAME>" | ||
echo " where <TESTNAME> can be any of:" | ||
# This will list all lines in this file that is starting with test_ remove () { and print it as a list. | ||
# e,g, "test_pytest() { # Test ops and other things" -> test_pytest # Test ops and other things | ||
echo "all # run all tests" | ||
grep "^test_" $0 | sed 's/([^)]*)[[:space:]]*{*//g' | ||
exit | ||
} | ||
|
||
if [[ -z "${TEST_SUITE:-}" ]]; then | ||
echo "Missing test suite name, exiting..." | ||
help | ||
else | ||
echo "Run Arm baremetal test suite ${TEST_SUITE}" | ||
fi | ||
|
||
TEST_SUITE_NAME="$(basename "$0") ${TEST_SUITE}" | ||
|
||
all() { # Run all tests | ||
# This will list all lines in this file that is starting with test_ remove () { and add this script name in | ||
# front of it and execute it in a sub shell | ||
# e.g. from this file: | ||
# | ||
# test_pytest() { # Test ops and other things | ||
# bla bla bla | ||
# } | ||
# test_pytest_ethosu_fvp() { # Same as test_pytest but ... | ||
# bla bla bla | ||
# } | ||
#... | ||
# become a small script: | ||
# ---- | ||
# backends/arm/test/test_arm_baremetal.sh test_pytest # Test ops and other things | ||
# backends/arm/test/test_arm_baremetal.sh test_pytest_ethosu_fvp # Same as test_pytest but ... | ||
# ... | ||
# ---- | ||
# That is executed | ||
echo "${TEST_SUITE_NAME}: Run all tests" | ||
grep "^test_" backends/arm/test/test_arm_baremetal.sh | sed 's/([^)]*)[[:space:]]*{*//g' | sed "s|^|$0 |" | sh | ||
} | ||
|
||
test_pytest() { # Test ops and other things | ||
echo "${TEST_SUITE_NAME}: Run pytest" | ||
cd "${et_root_dir}" | ||
source examples/arm/ethos-u-scratch/setup_path.sh | ||
|
||
# Run arm baremetal pytest tests without FVP | ||
pytest --verbose --color=yes --numprocesses=auto backends/arm/test/ | ||
} | ||
|
||
test_pytest_ethosu_fvp() { # Same as test_pytest but also sometime verify using Corstone FVP | ||
echo "${TEST_SUITE_NAME}: Run pytest with fvp" | ||
|
||
source examples/arm/ethos-u-scratch/setup_path.sh | ||
|
||
# Prepare Corstone-3x0 FVP for pytest | ||
examples/arm/run.sh --model_name=add --build_only | ||
backends/arm/test/setup_testing.sh | ||
|
||
# Run arm baremetal pytest tests with FVP | ||
pytest --verbose --color=yes --numprocesses=auto backends/arm/test/ --arm_quantize_io --arm_run_corstoneFVP | ||
} | ||
|
||
test_run_ethosu_fvp() { # End to End model tests | ||
echo "${TEST_SUITE_NAME}: Test ethos-u delegate examples with run.sh" | ||
|
||
source examples/arm/ethos-u-scratch/setup_path.sh | ||
|
||
# TOSA quantized | ||
echo "${TEST_SUITE_NAME}: Test ethos-u target TOSA" | ||
examples/arm/run.sh --target=TOSA --model_name=mv2 | ||
examples/arm/run.sh --target=TOSA --model_name=lstm | ||
examples/arm/run.sh --target=TOSA --model_name=edsr | ||
|
||
# Ethos-U55 | ||
echo "${TEST_SUITE_NAME}: Test ethos-u target Ethos-U55" | ||
examples/arm/run.sh --target=ethos-u55-128 --model_name=mv2 | ||
examples/arm/run.sh --target=ethos-u55-128 --model_name=lstm --reorder_inputs=1,0,2 | ||
|
||
# Ethos-U85 | ||
echo "${TEST_SUITE_NAME}: Test ethos-u target Ethos-U85" | ||
examples/arm/run.sh --target=ethos-u85-128 --model_name=mv2 | ||
examples/arm/run.sh --target=ethos-u85-128 --model_name=lstm --reorder_inputs=1,0,2 | ||
} | ||
|
||
${TEST_SUITE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters