Skip to content

Commit 5795873

Browse files
committed
Merge remote-tracking branch 'origin/main' into lfm2_5_mlx
2 parents cc22995 + 1feb56c commit 5795873

101 files changed

Lines changed: 4814 additions & 847 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/docker/build.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ esac
9797
TORCH_VERSION=$(cat ci_commit_pins/pytorch.txt)
9898
BUILD_DOCS=1
9999

100-
if [[ "${GCC_VERSION:-}" == "11" && -z "${SKIP_PYTORCH:-}" ]]; then
101-
PYTORCH_BUILD_MAX_JOBS=6
102-
fi
103-
104100
# Copy requirements-lintrunner.txt from root to here
105101
cp ../../requirements-lintrunner.txt ./
106102

@@ -113,7 +109,6 @@ docker build \
113109
--build-arg "PYTHON_VERSION=${PYTHON_VERSION}" \
114110
--build-arg "MINICONDA_VERSION=${MINICONDA_VERSION}" \
115111
--build-arg "TORCH_VERSION=${TORCH_VERSION}" \
116-
--build-arg "PYTORCH_BUILD_MAX_JOBS=${PYTORCH_BUILD_MAX_JOBS:-}" \
117112
--build-arg "BUCK2_VERSION=${BUCK2_VERSION}" \
118113
--build-arg "LINTRUNNER=${LINTRUNNER:-}" \
119114
--build-arg "BUILD_DOCS=${BUILD_DOCS}" \
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
release/2.12
1+
release/2.11

.ci/docker/common/install_cache.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ init_sccache() {
7676
# This is the remote cache bucket
7777
export SCCACHE_BUCKET=ossci-compiler-cache-circleci-v2
7878
export SCCACHE_S3_KEY_PREFIX=executorch
79-
export SCCACHE_REGION=us-east-1
80-
export AWS_REGION=us-east-1
81-
export AWS_DEFAULT_REGION=us-east-1
8279
export SCCACHE_IDLE_TIMEOUT=0
8380
export SCCACHE_ERROR_LOG=/tmp/sccache_error.log
8481
export RUST_LOG=sccache::server=error

.ci/docker/common/install_pytorch.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,14 @@ install_pytorch_and_domains() {
2727
chown -R ci-user .
2828

2929
export _GLIBCXX_USE_CXX11_ABI=1
30-
if [[ "$(uname -m)" == "aarch64" ]]; then
31-
export BUILD_IGNORE_SVE_UNAVAILABLE=1
32-
fi
33-
if [[ -n "${PYTORCH_BUILD_MAX_JOBS:-}" ]]; then
34-
export MAX_JOBS="${PYTORCH_BUILD_MAX_JOBS}"
35-
fi
3630
# Then build and install PyTorch
3731
conda_run python setup.py bdist_wheel
3832
pip_install "$(echo dist/*.whl)"
3933

4034
# Grab the pinned audio and vision commits from PyTorch
4135
TORCHAUDIO_VERSION=release/2.11
4236
export TORCHAUDIO_VERSION
43-
TORCHVISION_VERSION=release/0.27
37+
TORCHVISION_VERSION=release/0.26
4438
export TORCHVISION_VERSION
4539

4640
install_domains

.ci/docker/ubuntu/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,9 @@ RUN bash ./install_cache.sh && rm install_cache.sh utils.sh
6262
ENV SCCACHE_BUCKET ossci-compiler-cache-circleci-v2
6363
ENV SCCACHE_S3_KEY_PREFIX executorch
6464
ENV SCCACHE_REGION us-east-1
65-
ENV AWS_REGION us-east-1
66-
ENV AWS_DEFAULT_REGION us-east-1
6765

6866
ARG TORCH_VERSION
6967
ARG SKIP_PYTORCH
70-
ARG PYTORCH_BUILD_MAX_JOBS
7168
COPY ./common/install_pytorch.sh install_pytorch.sh
7269
COPY ./common/utils.sh utils.sh
7370
RUN if [ -z "${SKIP_PYTORCH}" ]; then bash ./install_pytorch.sh; fi && rm install_pytorch.sh utils.sh

.ci/scripts/test_cortex_m_e2e.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ et_root_dir=$(realpath "${script_dir}/../..")
1919

2020
# Quantization is the default for the cortex-m55 target; run.sh's
2121
# arg parser only recognizes --no_quantize, so we omit any explicit flag.
22+
export ARM_FVP_INSTALL_I_AGREE_TO_THE_CONTAINED_EULA=True
2223
bash "${et_root_dir}/examples/arm/run.sh" \
2324
--model_name="${MODEL}" \
2425
--target=cortex-m55 \

.ci/scripts/test_riscv_qemu.sh

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# LICENSE file in the root directory of this source tree.
66

77
# CI wrapper: install RISC-V cross-compile + qemu-user tooling, then run the
8-
# RISC-V Phase 1 smoke test (export, cross-compile, qemu-user execution) via
8+
# RISC-V smoke test (export, cross-compile, qemu-user execution) via
99
# examples/riscv/run.sh. The bundled-IO comparison and Test_result: PASS
1010
# check are done by run.sh.
1111

@@ -14,5 +14,43 @@ set -eu
1414
script_dir=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
1515
et_root_dir=$(realpath "${script_dir}/../..")
1616

17+
model="add"
18+
xnnpack=false
19+
quantize=false
20+
verbose=false
21+
22+
usage() {
23+
cat <<EOF
24+
Usage: $(basename "$0") [options]
25+
Options:
26+
--model=<NAME> Which model to export and run (default: add)
27+
--xnnpack Enable the XNNPACK backend (AOT partitioner + runtime)
28+
--quantize Produce an 8-bit quantized model
29+
-h, --help Show this help
30+
EOF
31+
}
32+
33+
for arg in "$@"; do
34+
case $arg in
35+
--model=*) model="${arg#*=}" ;;
36+
--xnnpack) xnnpack=true ;;
37+
--quantize) quantize=true ;;
38+
--verbose) verbose=true ;;
39+
-h|--help) usage; exit 0 ;;
40+
*) echo "Unknown option: $arg" >&2; usage; exit 1 ;;
41+
esac
42+
done
43+
44+
run_extra_args=()
45+
if ${xnnpack}; then
46+
run_extra_args+=(--xnnpack)
47+
fi
48+
if ${quantize}; then
49+
run_extra_args+=(--quantize)
50+
fi
51+
if ${verbose}; then
52+
run_extra_args+=(--verbose)
53+
fi
54+
1755
bash "${et_root_dir}/examples/riscv/setup.sh"
18-
bash "${et_root_dir}/examples/riscv/run.sh"
56+
bash "${et_root_dir}/examples/riscv/run.sh" --model="${model}" "${run_extra_args[@]}"

.ci/scripts/test_zephyr.sh

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
# Copyright 2026 Arm Limited and/or its affiliates.
5+
#
6+
# This source code is licensed under the BSD-style license found in the
7+
# LICENSE file in the root directory of this source tree.
8+
9+
set -euo pipefail
10+
11+
SCRIPT_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
12+
EXECUTORCH_PROJ_ROOT="$(realpath "${SCRIPT_DIR}/../..")"
13+
ZEPHYR_README_PATH="zephyr/README.md"
14+
15+
ZEPHYR_SAMPLES_README_PATH="zephyr/samples/hello-executorch/README.md"
16+
TARGETS_ARG="${TARGET_LIST:-}"
17+
18+
usage() {
19+
cat <<EOF
20+
Usage: $0 [options]
21+
22+
Options:
23+
--zephyr-samples-readme-path <path> README containing test_<TARGET>* command blocks
24+
--targets <list> Comma-separated target list, e.g. ethos-u55,cortex-m55,ethos-u85
25+
-h, --help Show this help
26+
EOF
27+
}
28+
29+
while [[ $# -gt 0 ]]; do
30+
case "$1" in
31+
--targets)
32+
TARGETS_ARG="$2"
33+
shift 2
34+
;;
35+
--zephyr-samples-readme-path)
36+
ZEPHYR_SAMPLES_README_PATH="$2"
37+
shift 2
38+
;;
39+
-h|--help)
40+
usage
41+
exit 0
42+
;;
43+
*)
44+
echo "ERROR: Unknown argument: $1" >&2
45+
usage >&2
46+
exit 1
47+
;;
48+
esac
49+
done
50+
51+
if [[ -z "${TARGETS_ARG}" ]]; then
52+
echo "ERROR: --targets or TARGET_LIST must be set" >&2
53+
usage >&2
54+
exit 1
55+
fi
56+
57+
IFS=',' read -r -a TARGETS <<< "${TARGETS_ARG}"
58+
59+
export EXECUTORCH_PROJ_ROOT
60+
61+
cd "${EXECUTORCH_PROJ_ROOT}"
62+
63+
# Source utility scripts.
64+
. .ci/scripts/utils.sh
65+
. .ci/scripts/zephyr-utils.sh
66+
67+
run_target_test_blocks_from_readme() {
68+
local readme_path="$1"
69+
local target="$2"
70+
local resolved_readme_path marker markers
71+
72+
resolved_readme_path="$(_utils_path_from_root "${readme_path}")"
73+
markers="$(awk -v target="${target}" '
74+
{
75+
line = $0
76+
while (match(line, /<!--[[:space:]]*RUN[[:space:]]+[^>]*-->/)) {
77+
marker = substr(line, RSTART, RLENGTH)
78+
if (index(marker, "<!-- RUN test_" target) == 1) {
79+
print marker
80+
}
81+
line = substr(line, RSTART + RLENGTH)
82+
}
83+
}
84+
' "${resolved_readme_path}")"
85+
86+
if [[ -z "${markers}" ]]; then
87+
echo "ERROR: No test blocks matching <!-- RUN test_${target}* --> in ${readme_path}" >&2
88+
return 1
89+
fi
90+
91+
while IFS= read -r marker; do
92+
echo "---- ${target} ${marker} ----"
93+
run_command_block_from_readme "${readme_path}" "${marker}"
94+
done <<< "${markers}"
95+
}
96+
97+
# Check that zephyr/README.md and zephyr/executorch.yaml are in sync.
98+
verify_zephyr_readme
99+
100+
# Based on instructions in zephyr/README.md and the selected sample README.
101+
run_command_block_from_readme "${ZEPHYR_README_PATH}" "<!-- RUN install_reqs -->"
102+
103+
# Make sure to backup the zephyr_scratch folder if it exists to allow for local
104+
# testing that does not lose code/data.
105+
if [[ -d "zephyr_scratch" ]]; then
106+
mv "zephyr_scratch" "zephyr_scratch.backup.$(date +%Y%m%d%H%M%S)"
107+
fi
108+
mkdir -p zephyr_scratch/
109+
110+
cd zephyr_scratch
111+
export ZEPHYR_PROJ_ROOT="$(realpath "$(pwd)")"
112+
113+
echo "---- Zephyr SDK ----"
114+
# Use ZephyrSDK if on the disk (e.g. setup in the docker)
115+
# Check for a zephyr-sdk-0.17.4 directory and make a symlink if found in parent directories
116+
if sdk_dir=$(find ../../.. -maxdepth 4 -type d -name 'zephyr-sdk-0.17.4' -print -quit) && [ -n "${sdk_dir}" ]; then
117+
echo "---- Found pre downloaded Zephyr SDK in ${sdk_dir} ----"
118+
ln -s "${sdk_dir}" .
119+
fi
120+
121+
# Download and setup Zephyr SDK 0.17.4 if not already present
122+
if [ ! -d "zephyr-sdk-0.17.4" ]; then
123+
echo "---- Downloading Zephyr SDK ----"
124+
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.4/zephyr-sdk-0.17.4_linux-x86_64.tar.xz
125+
tar -xf zephyr-sdk-0.17.4_linux-x86_64.tar.xz
126+
rm -f zephyr-sdk-0.17.4_linux-x86_64.tar.xz*
127+
fi
128+
129+
./zephyr-sdk-0.17.4/setup.sh -c -t arm-zephyr-eabi
130+
export ZEPHYR_SDK_INSTALL_DIR=$(realpath ./zephyr-sdk-0.17.4)
131+
132+
cd ${ZEPHYR_PROJ_ROOT}
133+
134+
run_command_block_from_readme "${ZEPHYR_README_PATH}" "<!-- RUN west_init -->"
135+
136+
cp "${EXECUTORCH_PROJ_ROOT}/zephyr/executorch.yaml" zephyr/submanifests/
137+
138+
run_command_block_from_readme "${ZEPHYR_README_PATH}" "<!-- RUN west_config -->"
139+
140+
# Switch to executorch in this PR e.g. replace modules/lib/executorch with the
141+
# root folder of this repo instead of doing a re-checkout and figuring out the
142+
# correct commit hash.
143+
rm -Rf modules/lib/executorch
144+
ln -s "${EXECUTORCH_PROJ_ROOT}" modules/lib/executorch
145+
146+
# Setup git local user for Executorch git to allow
147+
# modules/lib/executorch/examples/arm/setup.sh to run inside CI later.
148+
if ! git config --get user.name >/dev/null 2>&1; then
149+
git config --global user.name "Github Executorch"
150+
fi
151+
if ! git config --get user.email >/dev/null 2>&1; then
152+
git config --global user.email "github_executorch@arm.com"
153+
fi
154+
155+
run_command_block_from_readme "${ZEPHYR_README_PATH}" "<!-- RUN install_executorch -->"
156+
run_command_block_from_readme "${ZEPHYR_README_PATH}" "<!-- RUN install_arm_tools -->"
157+
158+
for TARGET in "${TARGETS[@]}"; do
159+
TARGET="$(echo "${TARGET}" | xargs)"
160+
161+
echo "---- ${TARGET} ----"
162+
rm -Rf build
163+
164+
if [[ ${TARGET} == "ethos-u55" || ${TARGET} == "cortex-m55" ]]; then
165+
BOARD="corstone300"
166+
elif [[ ${TARGET} == "ethos-u85" ]]; then
167+
BOARD="corstone320"
168+
else
169+
echo "Fail unsupported target selection ${TARGET}"
170+
exit 1
171+
fi
172+
173+
echo "---- ${TARGET} Board ${BOARD} FVP setup ----"
174+
run_command_block_from_readme "${ZEPHYR_SAMPLES_README_PATH}" "<!-- RUN setup_${BOARD} -->"
175+
176+
# Run all blocks that match <!-- RUN test_${target}* -->
177+
run_target_test_blocks_from_readme "${ZEPHYR_SAMPLES_README_PATH}" "${TARGET}"
178+
done

.ci/scripts/utils.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ install_pytorch_and_domains() {
107107
local torch_release=$(cat version.txt)
108108
# Download key must match the upload key below (basename of dist/*.whl,
109109
# which always carries setup.py's resolved +gitHASH). Branch-ref pins
110-
# like `release/2.12` would otherwise produce `+gitrelease` here and
110+
# like `release/2.11` would otherwise produce `+gitrelease` here and
111111
# never hit the cache.
112112
local torch_short_hash=$(git rev-parse --short=7 HEAD)
113113
local torch_wheel_path="cached_artifacts/pytorch/executorch/pytorch_wheels/${system_name}/${python_version}"
@@ -132,9 +132,6 @@ install_pytorch_and_domains() {
132132
# (e.g. executorch's requirements-ci.txt).
133133
pip install -r requirements-build.txt
134134
git submodule update --init --recursive
135-
if [[ "$(uname -m)" == "aarch64" ]]; then
136-
export BUILD_IGNORE_SVE_UNAVAILABLE=1
137-
fi
138135
USE_DISTRIBUTED=1 python setup.py bdist_wheel
139136
pip install "$(echo dist/*.whl)"
140137

@@ -178,7 +175,7 @@ install_pytorch_and_domains() {
178175
# Grab the pinned audio and vision commits from PyTorch
179176
TORCHAUDIO_VERSION=release/2.11
180177
export TORCHAUDIO_VERSION
181-
TORCHVISION_VERSION=release/0.27
178+
TORCHVISION_VERSION=release/0.26
182179
export TORCHVISION_VERSION
183180

184181
install_domains

.github/workflows/_test_riscv.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,36 @@ on:
1212
required: false
1313
type: number
1414
default: 30
15+
model:
16+
description: 'Which model to run. Possible values are: add, mv2 (mobilenetv2)'
17+
required: false
18+
type: string
19+
default: 'add'
20+
xnnpack:
21+
description: 'Whether to enable XNNPACK'
22+
required: false
23+
type: boolean
24+
default: false
25+
quantize:
26+
description: 'Produce an 8-bit quantized model'
27+
required: false
28+
type: boolean
29+
default: false
30+
gcc-version:
31+
description: 'The version of GCC to use'
32+
required: false
33+
type: number
34+
docker-image:
35+
description: 'The docker image to use for this job'
36+
required: false
37+
type: string
1538

1639
jobs:
1740
run:
1841
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
1942
with:
2043
runner: linux.2xlarge
21-
docker-image: ci-image:executorch-ubuntu-22.04-gcc11
44+
docker-image: ${{ inputs.docker-image || 'ci-image:executorch-ubuntu-22.04-gcc11' }}
2245
submodules: 'recursive'
2346
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
2447
timeout: ${{ inputs.timeout }}
@@ -29,4 +52,5 @@ jobs:
2952
source .ci/scripts/utils.sh
3053
install_executorch "--use-pt-pinned-commit"
3154
32-
bash .ci/scripts/test_riscv_qemu.sh
55+
export GCC_VERSION=${{ inputs.gcc-version }}
56+
bash .ci/scripts/test_riscv_qemu.sh --model="${{ inputs.model }}" ${{ inputs.xnnpack && '--xnnpack' || '' }} ${{ inputs.quantize && '--quantize' || '' }}

0 commit comments

Comments
 (0)