Skip to content

Commit 5d4e389

Browse files
authored
Merge branch 'main' into re-land-asset-management
2 parents 428c1c4 + fcd42bc commit 5d4e389

File tree

547 files changed

+19653
-5760
lines changed

Some content is hidden

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

547 files changed

+19653
-5760
lines changed

.ci/docker/requirements-ci.txt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,21 @@ hypothesis==6.84.2
1616
parameterized==0.9.0
1717

1818
# Doc build requirements, same as https://github.com/pytorch/pytorch/blob/main/.ci/docker/requirements-docs.txt
19-
sphinx==5.3.0
19+
sphinx==7.2.6
20+
sphinxcontrib.katex==0.9.10
21+
breathe==4.36.0 # only if generating C++
22+
exhale==0.3.7 # only if generating C++ docs
23+
docutils==0.18.1,<0.21
24+
sphinx-design==0.6.1
25+
sphinxcontrib-mermaid==1.0.0
26+
myst-parser==3.0.1 # if want to contribute in markdown
27+
sphinx-gallery==0.14.0 # only if hosting interactive tutorials
28+
sphinx-sitemap==2.7.1
2029
sphinx-reredirects==0.1.4
21-
sphinx-gallery==0.14.0
22-
breathe==4.34.0
23-
exhale==0.2.3
24-
docutils==0.16
2530
matplotlib>=3.9.4
31+
sphinx-copybutton==0.5.2
2632
# PyTorch Theme
27-
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
28-
myst-parser==0.18.1
29-
sphinx_design==0.4.1
30-
sphinx-copybutton==0.5.0
33+
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@pytorch_sphinx_theme2#egg=pytorch_sphinx_theme2
3134

3235
# script unit test requirements
3336
yaspin==3.1.0

.ci/scripts/setup-openvino.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,17 @@ set -ex
1010
# shellcheck source=/dev/null
1111
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

13-
git clone https://github.com/openvinotoolkit/openvino.git
14-
cd openvino && git checkout releases/2025/1
15-
git submodule update --init --recursive
16-
sudo ./install_build_dependencies.sh
17-
mkdir build && cd build
18-
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON
19-
make -j$(nproc)
13+
# Download and install OpenVINO from release packages
14+
OPENVINO_VERSION="2025.3"
15+
OPENVINO_BUILD="2025.3.0.19807.44526285f24"
16+
OPENVINO_URL="https://storage.openvinotoolkit.org/repositories/openvino/packages/${OPENVINO_VERSION}/linux/openvino_toolkit_ubuntu22_${OPENVINO_BUILD}_x86_64.tgz"
2017

21-
cd ..
22-
cmake --install build --prefix dist
18+
curl -Lo /tmp/openvino_toolkit.tgz --retry 3 --fail ${OPENVINO_URL}
19+
tar -xzf /tmp/openvino_toolkit.tgz
20+
mv openvino_toolkit_ubuntu22_${OPENVINO_BUILD}_x86_64 openvino
2321

24-
source dist/setupvars.sh
25-
cd ../backends/openvino
22+
source openvino/setupvars.sh
23+
cd backends/openvino
2624
pip install -r requirements.txt
2725
cd scripts
2826
./openvino_build.sh --enable_python

.ci/scripts/test_backend_linux.sh renamed to .ci/scripts/test_backend.sh

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22
# Copyright (c) Meta Platforms, Inc. and affiliates.
33
# All rights reserved.
4+
# Copyright 2025 Arm Limited and/or its affiliates.
45
#
56
# This source code is licensed under the BSD-style license found in the
67
# LICENSE file in the root directory of this source tree.
@@ -10,16 +11,26 @@ SUITE=$1
1011
FLOW=$2
1112
ARTIFACT_DIR=$3
1213

13-
REPORT_FILE="$ARTIFACT_DIR/test-report-$FLOW-$SUITE.csv"
14+
REPORT_FILE="$ARTIFACT_DIR/test-report-$FLOW-$SUITE.json"
1415

1516
echo "Running backend test job for suite $SUITE, flow $FLOW."
1617
echo "Saving job artifacts to $ARTIFACT_DIR."
1718

18-
# The generic Linux job chooses to use base env, not the one setup by the image
1919
eval "$(conda shell.bash hook)"
2020
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
2121
conda activate "${CONDA_ENV}"
2222

23+
if [[ "$(uname)" == "Darwin" ]]; then
24+
bash .ci/scripts/setup-conda.sh
25+
eval "$(conda shell.bash hook)"
26+
CONDA_RUN_CMD="${CONDA_RUN} --no-capture-output"
27+
${CONDA_RUN_CMD} pip install awscli==1.37.21
28+
IS_MACOS=1
29+
else
30+
CONDA_RUN_CMD=""
31+
IS_MACOS=0
32+
fi
33+
2334
export PYTHON_EXECUTABLE=python
2435

2536
# CMake options to use, in addition to the defaults.
@@ -48,13 +59,23 @@ fi
4859
if [[ "$FLOW" == *arm* ]]; then
4960
# Setup ARM deps.
5061
.ci/scripts/setup-arm-baremetal-tools.sh
62+
source examples/arm/ethos-u-scratch/setup_path.sh
63+
64+
if [[ "$FLOW" == *ethos_u* ]]; then
65+
# Prepare a test runner binary that can run on the Corstone-3x0 FVPs
66+
backends/arm/scripts/build_executorch.sh
67+
backends/arm/test/setup_testing.sh
68+
fi
5169
fi
5270

53-
# We need the runner to test the built library.
54-
PYTHON_EXECUTABLE=python CMAKE_ARGS="$EXTRA_BUILD_ARGS" .ci/scripts/setup-linux.sh --build-tool cmake --build-mode Release --editable true
71+
if [[ $IS_MACOS -eq 1 ]]; then
72+
SETUP_SCRIPT=.ci/scripts/setup-macos.sh
73+
else
74+
SETUP_SCRIPT=.ci/scripts/setup-linux.sh
75+
fi
76+
CMAKE_ARGS="$EXTRA_BUILD_ARGS" ${CONDA_RUN_CMD} $SETUP_SCRIPT --build-tool cmake --build-mode Release --editable true
5577

5678
EXIT_CODE=0
57-
python -m executorch.backends.test.suite.runner $SUITE --flow $FLOW --report "$REPORT_FILE" || EXIT_CODE=$?
58-
79+
${CONDA_RUN_CMD} pytest -c /dev/nul -n auto backends/test/suite/$SUITE/ -m flow_$FLOW --json-report --json-report-file="$REPORT_FILE" || EXIT_CODE=$?
5980
# Generate markdown summary.
60-
python -m executorch.backends.test.suite.generate_markdown_summary "$REPORT_FILE" > ${GITHUB_STEP_SUMMARY:-"step_summary.md"} --exit-code $EXIT_CODE
81+
${CONDA_RUN_CMD} python -m executorch.backends.test.suite.generate_markdown_summary_json "$REPORT_FILE" > ${GITHUB_STEP_SUMMARY:-"step_summary.md"} --exit-code $EXIT_CODE

.ci/scripts/test_backend_macos.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.

.ci/scripts/test_llama.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ if [[ "${CUSTOM}" == "ON" ]]; then
237237
EXPORT_ARGS="${EXPORT_ARGS} model.use_sdpa_with_kv_cache=true"
238238
fi
239239
if [[ "${QE}" == "ON" ]]; then
240-
EXPORT_ARGS="${EXPORT_ARGS} quantization.embedding_quantize=\"8,1024\""
240+
EXPORT_ARGS="${EXPORT_ARGS} quantization.embedding_quantize=\"8,768\""
241241
fi
242242
if [[ "${MPS}" == "ON" ]]; then
243243
EXPORT_ARGS="${EXPORT_ARGS} backend.mps.enabled=true model.enable_dynamic_shape=false debug.verbose=true"

.ci/scripts/test_model.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,25 @@ prepare_artifacts_upload() {
4848
fi
4949
}
5050

51+
5152
build_cmake_executor_runner() {
5253
local backend_string_select="${1:-}"
5354
echo "Building executor_runner"
5455
rm -rf ${CMAKE_OUTPUT_DIR}
5556
mkdir ${CMAKE_OUTPUT_DIR}
57+
# Common options:
58+
COMMON="-DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE"
5659
if [[ "$backend_string_select" == "XNNPACK" ]]; then
5760
echo "Backend $backend_string_select selected"
58-
(cd ${CMAKE_OUTPUT_DIR} \
59-
&& cmake -DCMAKE_BUILD_TYPE=Release \
61+
cmake -DCMAKE_BUILD_TYPE=Release \
6062
-DEXECUTORCH_BUILD_XNNPACK=ON \
61-
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
63+
${COMMON} \
64+
-B${CMAKE_OUTPUT_DIR} .
6265
cmake --build ${CMAKE_OUTPUT_DIR} -j4
6366
else
6467
cmake -DCMAKE_BUILD_TYPE=Debug \
6568
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
66-
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
69+
${COMMON} \
6770
-B${CMAKE_OUTPUT_DIR} .
6871
cmake --build ${CMAKE_OUTPUT_DIR} -j4 --config Debug
6972
fi

.ci/scripts/test_openvino.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set -ex
1010
# shellcheck source=/dev/null
1111
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1212

13-
source openvino/dist/setupvars.sh
13+
source openvino/setupvars.sh
1414
cd backends/openvino/tests
1515
python test_runner.py --test_type ops
1616
python test_runner.py --test_type models

.ci/scripts/test_torchao_huggingface_checkpoints.sh

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -euxo pipefail
55
# Args / flags
66
# -------------------------
77
TEST_WITH_RUNNER=0
8+
USE_TORCHAO_KERNELS=0
89
MODEL_NAME=""
910

1011
# Parse args
@@ -22,10 +23,14 @@ while [[ $# -gt 0 ]]; do
2223
--test_with_runner)
2324
TEST_WITH_RUNNER=1
2425
;;
26+
--use_torchao_kernels)
27+
USE_TORCHAO_KERNELS=1
28+
;;
2529
-h|--help)
26-
echo "Usage: $0 <model_name> [--test_with_runner]"
30+
echo "Usage: $0 <model_name> [--test_with_runner] [--use_torchao_kernels]"
2731
echo " model_name: qwen3_4b | phi_4_mini"
2832
echo " --test_with_runner: build ET + run llama_main to sanity-check the export"
33+
echo " --use_torchao_kernels: use torchao kernels for linear and tied embedding"
2934
exit 0
3035
;;
3136
*)
@@ -42,6 +47,13 @@ fi
4247

4348
MODEL_OUT=model.pte
4449

50+
51+
# Default to XNNPACK
52+
BACKEND_ARGS="-X --xnnpack-extended-ops"
53+
if [[ "$USE_TORCHAO_KERNELS" -eq 1 ]]; then
54+
BACKEND_ARGS="--use-torchao-kernels"
55+
fi
56+
4557
case "$MODEL_NAME" in
4658
qwen3_4b)
4759
echo "Running Qwen3-4B export..."
@@ -58,12 +70,12 @@ case "$MODEL_NAME" in
5870
--output_name $MODEL_OUT \
5971
-kv \
6072
--use_sdpa_with_kv_cache \
61-
-X \
62-
--xnnpack-extended-ops \
6373
--max_context_length 1024 \
6474
--max_seq_length 1024 \
75+
--metadata '{"get_bos_id":199999, "get_eos_ids":[200020,199999]}' \
76+
--verbose \
6577
--dtype fp32 \
66-
--metadata '{"get_bos_id":199999, "get_eos_ids":[200020,199999]}'
78+
${BACKEND_ARGS}
6779
;;
6880

6981
phi_4_mini)
@@ -81,12 +93,12 @@ case "$MODEL_NAME" in
8193
--output_name $MODEL_OUT \
8294
-kv \
8395
--use_sdpa_with_kv_cache \
84-
-X \
85-
--xnnpack-extended-ops \
8696
--max_context_length 1024 \
8797
--max_seq_length 1024 \
98+
--metadata '{"get_bos_id":199999, "get_eos_ids":[200020,199999]}' \
99+
--verbose \
88100
--dtype fp32 \
89-
--metadata '{"get_bos_id":199999, "get_eos_ids":[200020,199999]}'
101+
${BACKEND_ARGS}
90102
;;
91103

92104
*)
@@ -104,6 +116,10 @@ if [[ $MODEL_SIZE -gt $EXPECTED_MODEL_SIZE_UPPER_BOUND ]]; then
104116
fi
105117

106118
# Install ET with CMake
119+
EXECUTORCH_BUILD_KERNELS_TORCHAO="OFF"
120+
if [[ "$USE_TORCHAO_KERNELS" -eq 1 ]]; then
121+
EXECUTORCH_BUILD_KERNELS_TORCHAO="ON"
122+
fi
107123
if [[ "$TEST_WITH_RUNNER" -eq 1 ]]; then
108124
echo "[runner] Building and testing llama_main ..."
109125
cmake -DPYTHON_EXECUTABLE=python \
@@ -120,6 +136,7 @@ if [[ "$TEST_WITH_RUNNER" -eq 1 ]]; then
120136
-DEXECUTORCH_BUILD_EXTENSION_LLM_RUNNER=ON \
121137
-DEXECUTORCH_BUILD_EXTENSION_LLM=ON \
122138
-DEXECUTORCH_BUILD_KERNELS_LLM=ON \
139+
-DEXECUTORCH_BUILD_KERNELS_TORCHAO=${EXECUTORCH_BUILD_KERNELS_TORCHAO} \
123140
-Bcmake-out .
124141
cmake --build cmake-out -j16 --config Release --target install
125142

.ci/scripts/utils.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,15 @@ build_executorch_runner_cmake() {
125125
clean_executorch_install_folders
126126
mkdir "${CMAKE_OUTPUT_DIR}"
127127

128-
pushd "${CMAKE_OUTPUT_DIR}" || return
129128
if [[ $1 == "Debug" ]]; then
130129
CXXFLAGS="-fsanitize=address,undefined"
131130
else
132131
CXXFLAGS=""
133132
fi
134-
CXXFLAGS="$CXXFLAGS" retry cmake -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" -DCMAKE_BUILD_TYPE="${1:-Release}" ..
135-
popd || return
133+
CXXFLAGS="$CXXFLAGS" retry cmake \
134+
-DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" \
135+
-DCMAKE_BUILD_TYPE="${1:-Release}" \
136+
-B${CMAKE_OUTPUT_DIR} .
136137

137138
if [ "$(uname)" == "Darwin" ]; then
138139
CMAKE_JOBS=$(( $(sysctl -n hw.ncpu) - 1 ))

.github/workflows/_test_backend.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
script: |
5858
set -eux
5959
60-
source .ci/scripts/test_backend_linux.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"
60+
source .ci/scripts/test_backend.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"
6161
6262
test-backend-macos:
6363
if: ${{ inputs.run-macos }}
@@ -81,4 +81,4 @@ jobs:
8181
# This is needed to get the prebuilt PyTorch wheel from S3
8282
${CONDA_RUN} --no-capture-output pip install awscli==1.37.21
8383
84-
source .ci/scripts/test_backend_macos.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"
84+
source .ci/scripts/test_backend.sh "${{ matrix.suite }}" "${{ matrix.flow }}" "${RUNNER_ARTIFACT_DIR}"

0 commit comments

Comments
 (0)