-
Notifications
You must be signed in to change notification settings - Fork 608
Arm backend: Test TOSA, Ethos-U55 and Ethos-U85 on github #6888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
freddan80
merged 2 commits into
pytorch:main
from
zingo:Arm-backend-Test-TOSA,-Ethos-U55-and-Ethos-U85-on-github
Jan 8, 2025
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 "[email protected]" | ||
git config --global user.name "Github Executorch" | ||
bash examples/arm/setup.sh --i-agree-to-the-contained-eula |
This file contains hidden or 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 |
---|---|---|
|
@@ -59,17 +59,6 @@ install_flatc_from_source() { | |
popd || return | ||
} | ||
|
||
install_arm() { | ||
# NB: This function could be used to install Arm dependencies | ||
# Setup arm example environment (including TOSA tools) | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github Executorch" | ||
bash examples/arm/setup.sh --i-agree-to-the-contained-eula | ||
|
||
# Test tosa_reference flow | ||
source examples/arm/ethos-u-scratch/setup_path.sh | ||
} | ||
|
||
build_executorch_runner_buck2() { | ||
# Build executorch runtime with retry as this step is flaky on macos CI | ||
retry buck2 build //examples/portable/executor_runner:executor_runner | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to do this? I tried to run this script to repro a build issue and unknowingly set the name and email incorrectly on several github commits.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch sorry about that.
It just followed along when moved from install_arm() in
.ci/scripts/utils.sh (in the same patch)
I'm not sure if it is needed when running in the CI nowdays, some time back the examples/arm/setup.sh did some git cloning of Vela and other repos and I assume it might have been needed then. Ot it could be related to the patch scripts that was used for Vela patches.