Skip to content

Commit ee45572

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 ee45572

File tree

5 files changed

+71
-20
lines changed

5 files changed

+71
-20
lines changed

.ci/scripts/setup-arm_baremetal.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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
12+
13+
# Test tosa_reference flow
14+
source examples/arm/ethos-u-scratch/setup_path.sh

.ci/scripts/test_arm_baremetal.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
# Run arm baremetal pytest tests without FVP
21+
pytest -c /dev/null -v -n auto backends/arm/test
22+
}
23+
24+
test_pytest_ethosu_fvp() {
25+
echo "${TEST_SUITE_NAME}: Run pytest with fvp"
26+
# Run arm baremetal pytest tests with FVP
27+
pytest -c /dev/null -v -n auto backends/arm/test -p executorch.backends.arm.test.common --arm_quantize_io --arm_run_corstone300
28+
}
29+
30+
test_run_ethosu_fvp() {
31+
echo "${TEST_SUITE_NAME}: Test ethos-u delegate examples with run.sh"
32+
33+
# TOSA quantized
34+
echo "${TEST_SUITE_NAME}: Test ethos-u target TOSA"
35+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=TOSA --model_name=mv2
36+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=TOSA --model_name=esdr
37+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=TOSA --model_name=emformer_join
38+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=TOSA --model_name=w2l
39+
40+
# Ethos-U55
41+
echo "${TEST_SUITE_NAME}: Test ethos-u target Ethos-U55"
42+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=ethos-u55-128 --model_name=mv2
43+
44+
# Ethos-U85
45+
echo "${TEST_SUITE_NAME}: Test ethos-u target Ethos-U85"
46+
PYTHON_EXECUTABLE=python bash examples/arm/run.sh --target=ethos-u85-128 --model_name=mv2
47+
}
48+
49+
${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: 3 additions & 5 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
358+
.ci/scripts/setup-arm_baremetal.sh
363359
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: 5 additions & 4 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
149+
.ci/scripts/setup-arm_baremetal.sh
150150
151151
# Increase number of files user can monitor to bypass buck failures.
152152
# Hopefully this is high enough for this setup.
153153
sudo sysctl fs.inotify.max_user_watches=1048576 # 1024 * 1024
154154
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
177178
# Run arm unit tests
178-
pytest -c /dev/null -v -n auto --cov=./ --cov-report=xml backends/arm/test
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)