Skip to content

Commit d6affa5

Browse files
committed
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 <[email protected]> Change-Id: I5e11b1aca19460845e330b84d0696513c400c0f0
1 parent 041b7d6 commit d6affa5

File tree

5 files changed

+83
-23
lines changed

5 files changed

+83
-23
lines changed

.ci/scripts/setup-arm_baremetal.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# Copyright 2024 Arm Limited and/or its affiliates.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# NB: This function could be used to install Arm dependencies
8+
# Setup arm example environment (including TOSA tools)
9+
git config --global user.email "[email protected]"
10+
git config --global user.name "Github Executorch"
11+
bash examples/arm/setup.sh --i-agree-to-the-contained-eula

.ci/scripts/test_arm_baremetal.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
# Copyright 2024 Arm Limited and/or its affiliates.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
TEST_SUITE=$1
8+
9+
if [[ -z "${TEST_SUITE:-}" ]]; then
10+
echo "Missing test suite name, exiting..."
11+
exit 1
12+
else
13+
echo "Run Arm baremetal test suite ${TEST_SUITE}"
14+
fi
15+
16+
TEST_SUITE_NAME="$(basename "$0") ${TEST_SUITE}"
17+
18+
test_pytest() {
19+
echo "${TEST_SUITE_NAME}: Run pytest"
20+
21+
source examples/arm/ethos-u-scratch/setup_path.sh
22+
23+
# Run arm baremetal pytest tests without Corstone-300/Corstone-320 FVP
24+
pytest -c /dev/null -v -n auto backends/arm/test
25+
}
26+
27+
test_pytest_ethosu_fvp() {
28+
echo "${TEST_SUITE_NAME}: Run pytest with fvp"
29+
30+
source examples/arm/ethos-u-scratch/setup_path.sh
31+
32+
# Prepare Corstone-3x0 FVP for pytest
33+
examples/arm/run.sh --model_name=add --build_only
34+
backends/arm/test/setup_testing.sh
35+
36+
# Run arm baremetal pytests with Corstone-300/Corstone-320 FVP
37+
pytest -c /dev/null -v -n auto backends/arm/test -p executorch.backends.arm.test.common --arm_quantize_io --arm_run_corstone300
38+
}
39+
40+
test_run_ethosu_fvp() {
41+
echo "${TEST_SUITE_NAME}: Test ethos-u delegate examples with run.sh"
42+
43+
source examples/arm/ethos-u-scratch/setup_path.sh
44+
45+
# TOSA quantized
46+
echo "${TEST_SUITE_NAME}: Test ethos-u target TOSA"
47+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=TOSA --model_name=mv2
48+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=TOSA --model_name=esdr
49+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=TOSA --model_name=emformer_join
50+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=TOSA --model_name=w2l
51+
52+
# Ethos-U55
53+
echo "${TEST_SUITE_NAME}: Test ethos-u target Ethos-U55"
54+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=ethos-u55-128 --model_name=mv2
55+
56+
# Ethos-U85
57+
echo "${TEST_SUITE_NAME}: Test ethos-u target Ethos-U85"
58+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=ethos-u85-128 --model_name=mv2
59+
}
60+
61+
${TEST_SUITE}

.ci/scripts/utils.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ install_flatc_from_source() {
5555
popd || return
5656
}
5757

58-
install_arm() {
59-
# NB: This function could be used to install Arm dependencies
60-
# Setup arm example environment (including TOSA tools)
61-
git config --global user.email "[email protected]"
62-
git config --global user.name "Github Executorch"
63-
bash examples/arm/setup.sh --i-agree-to-the-contained-eula
64-
65-
# Test tosa_reference flow
66-
source examples/arm/ethos-u-scratch/setup_path.sh
67-
}
68-
6958
build_executorch_runner_buck2() {
7059
# Build executorch runtime with retry as this step is flaky on macos CI
7160
retry buck2 build //examples/portable/executor_runner:executor_runner

.github/workflows/pull.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,11 @@ jobs:
354354
EXECUTORCH_BUILD_ARM_BAREMETAL=ON \
355355
.ci/scripts/setup-linux.sh "${BUILD_TOOL}"
356356
357-
source .ci/scripts/utils.sh
358357
# Install Arm dependencies
359-
install_arm
360-
361-
# Run pytest with coverage
362-
pytest -c /dev/null -v -n auto --cov=./ --cov-report=xml backends/arm/test
363-
358+
.ci/scripts/setup-arm_baremetal.sh
359+
360+
# Run pytest
361+
.ci/scripts/test_arm_baremetal.sh test_pytest
364362
365363
test-llama-runner-qnn-linux:
366364
name: test-llama-runner-qnn-linux

.github/workflows/trunk.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,15 @@ jobs:
146146
source .ci/scripts/utils.sh
147147
install_executorch
148148
149-
install_arm
150-
151149
# Increase number of files user can monitor to bypass buck failures.
152150
# Hopefully this is high enough for this setup.
153151
sudo sysctl fs.inotify.max_user_watches=1048576 # 1024 * 1024
154152
153+
.ci/scripts/setup-arm_baremetal.sh
154+
155155
# Test ethos-u delegate examples with run.sh
156-
PYTHON_EXECUTABLE=python bash examples/arm/run.sh examples/arm/ethos-u-scratch/
156+
.ci/scripts/test_arm_baremetal.sh test_run_ethosu_fvp
157+
157158
158159
test-arm-reference-delegation:
159160
name: test-arm-reference-delegation
@@ -172,10 +173,10 @@ jobs:
172173
source .ci/scripts/utils.sh
173174
install_executorch
174175
175-
install_arm
176+
.ci/scripts/setup-arm_baremetal.sh
176177
177-
# Run arm unit tests
178-
pytest -c /dev/null -v -n auto --cov=./ --cov-report=xml backends/arm/test
178+
# Run arm pytest tests with Corstone3x0 FVP testing
179+
.ci/scripts/test_arm_baremetal.sh test_pytest_ethosu_fvp
179180
180181
test-coreml-delegate:
181182
name: test-coreml-delegate

0 commit comments

Comments
 (0)