Skip to content

Commit e006cd0

Browse files
authored
Merge branch 'main' into toupstream/dynamic_adaptive
2 parents 0f7f225 + 6795a41 commit e006cd0

441 files changed

Lines changed: 22376 additions & 8437 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ esac
102102
TORCH_VERSION=$(cat ci_commit_pins/pytorch.txt)
103103
BUILD_DOCS=1
104104

105-
if [[ "${GCC_VERSION:-}" == "11" && -z "${SKIP_PYTORCH:-}" ]]; then
105+
if [[ -n "${GCC_VERSION:-}" && -z "${SKIP_PYTORCH:-}" ]]; then
106106
PYTORCH_BUILD_MAX_JOBS=6
107107
fi
108108

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# Copyright (c) Qualcomm Innovation Center, Inc.
3+
# All rights reserved
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
set -eux
9+
10+
source "$(dirname "${BASH_SOURCE[0]}")/../../backends/qualcomm/scripts/install_qnn_sdk.sh"
11+
12+
setup_android_ndk
13+
install_qnn
14+
install_hexagon_sdk
15+
16+
bash backends/qualcomm/scripts/build.sh \
17+
--build_direct_mode 3 --soc_model SM8750 \
18+
--skip_x86_64 --skip_linux_android \
19+
--release
20+
21+
ARTIFACT="build-direct/backends/qualcomm/libqnn_executorch_backend.so"
22+
if [ ! -f "${ARTIFACT}" ]; then
23+
echo "ERROR: direct-mode build did not produce ${ARTIFACT}" >&2
24+
exit 1
25+
fi
26+
27+
MAX_SIZE_BYTES=$((200 * 1024))
28+
ARTIFACT_SIZE=$(stat -c%s "${ARTIFACT}")
29+
if [ "${ARTIFACT_SIZE}" -gt "${MAX_SIZE_BYTES}" ]; then
30+
echo "ERROR: ${ARTIFACT} is ${ARTIFACT_SIZE} bytes, exceeds ${MAX_SIZE_BYTES}-byte (200 KiB) limit" >&2
31+
exit 1
32+
fi
33+
echo "PASSED: direct-mode build produced ${ARTIFACT} (${ARTIFACT_SIZE} bytes, under ${MAX_SIZE_BYTES}-byte limit)"

.ci/scripts/setup-webgpu-linux-deps.sh

Lines changed: 83 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,93 @@
55
# This source code is licensed under the BSD-style license found in the
66
# LICENSE file in the root directory of this source tree.
77

8+
# Vendor Dawn (Tint) + SwiftShader for the WebGPU backend CI WITHOUT hosting a
9+
# private prebuilt:
10+
# * Dawn : Google's official nightly prebuilt, downloaded directly from
11+
# github.com/google/dawn/releases (pinned tag+rev+sha256) -- the same
12+
# "fetch a pinned upstream prebuilt" pattern used for other CI deps.
13+
# * SwiftShader : built from source at a pinned rev compatible with the Dawn
14+
# above (the ossci prebuilt is from 2020, too old for current Dawn). No S3.
15+
# Dawn (Chrome's WebGPU impl; its WGSL compiler Tint is the spec reference) on
16+
# SwiftShader gives a headless, deterministic, spec-faithful CLI backend.
17+
#
18+
# Exports Dawn_DIR / VK_ICD_FILENAMES / LD_LIBRARY_PATH for the cmake build+run.
19+
# Local/rig override: set DAWN_PREBUILT_DIR=<dir containing lib64/cmake/Dawn> to
20+
# skip the Dawn download.
821
set -ex
922

10-
# SwiftShader: software Vulkan adapter for GPU-less CI (LunarG SDK not needed).
11-
install_swiftshader() {
12-
_https_amazon_aws=https://ossci-android.s3.amazonaws.com
13-
_swiftshader_archive=swiftshader-abe07b943-prebuilt.tar.gz
14-
_swiftshader_dir=/tmp/swiftshader
15-
mkdir -p $_swiftshader_dir
23+
# --- pinned versions (bump rev+sha together when upgrading Dawn) --------------
24+
DAWN_TAG="${DAWN_TAG:-v20260423.175430}"
25+
DAWN_REV="${DAWN_REV:-31e25af254ab572c77054edec4946d2244e184dd}"
26+
DAWN_SHA256="${DAWN_SHA256:-ac76fac090162dc1ecea5ed0f28a557bb8f49efc47faab01886105ace82b7b64}"
27+
# SwiftShader rev verified compatible with DAWN_REV (the old ossci prebuilt is
28+
# from 2020 and is incompatible with current Dawn -> no adapter / zero compute).
29+
SWIFTSHADER_REV="${SWIFTSHADER_REV:-9898204d91d6a60b6a08ad74fe4ac52a6913111b}"
1630

17-
_tmp_archive="/tmp/${_swiftshader_archive}"
31+
_dawn_dir="${DAWN_PREBUILT_DIR:-/tmp/dawn-ci}"
32+
_ss_dir=/tmp/swiftshader
1833

19-
curl --silent --show-error --location --fail --retry 3 --retry-all-errors \
20-
--output "${_tmp_archive}" "$_https_amazon_aws/${_swiftshader_archive}"
34+
# --- toolchain prereqs --------------------------------------------------------
35+
# Dawn dlopens the system Vulkan loader at runtime (libvulkan1). And the
36+
# ubuntu-latest prebuilt is built with a bleeding-edge GCC: it references
37+
# libstdc++ symbols newer than ubuntu-22.04's default (e.g. _M_replace_cold,
38+
# GCC 13+), so the static .a won't link against the stock runtime. Pull a current
39+
# libstdc++ from the ubuntu-toolchain-r PPA when the symbol floor isn't met. All
40+
# of this is scoped to the WebGPU CI job; newer libstdc++ is backward-compatible.
41+
if command -v apt-get >/dev/null 2>&1; then
42+
_SUDO=""; command -v sudo >/dev/null 2>&1 && _SUDO="sudo"
43+
${_SUDO} apt-get update -y || true
44+
${_SUDO} apt-get install -y libvulkan1 software-properties-common || true
45+
if ! strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 2>/dev/null \
46+
| grep -q "GLIBCXX_3.4.32"; then
47+
${_SUDO} add-apt-repository -y ppa:ubuntu-toolchain-r/test || true
48+
${_SUDO} apt-get update -y || true
49+
${_SUDO} apt-get install -y libstdc++6 || true # newest GCC runtime
50+
fi
51+
fi
2152

22-
tar -C "${_swiftshader_dir}" -xzf "${_tmp_archive}"
53+
# The native binaries / pybind lib run INSIDE the CI conda env, whose libstdc++
54+
# predates GLIBCXX_3.4.32 (the Dawn prebuilt's floor) -- the same wall ssjia hit
55+
# for the vulkan op tests. Upgrade the conda runtime libstdc++ so the loaded
56+
# libstdc++.so.6 (conda's, not the system one) satisfies Dawn at run time.
57+
if command -v conda >/dev/null 2>&1; then
58+
conda install -y -c conda-forge "libstdcxx-ng>=14" || true
59+
fi
60+
61+
# --- Dawn: official prebuilt from GitHub (no S3) ------------------------------
62+
mkdir -p "${_dawn_dir}"
63+
if [[ ! -d "${_dawn_dir}/lib64/cmake/Dawn" ]]; then
64+
_dawn_tar="/tmp/Dawn-${DAWN_REV}-ubuntu-latest-Release.tar.gz"
65+
curl --silent --show-error --location --fail --retry 3 --retry-all-errors \
66+
--output "${_dawn_tar}" \
67+
"https://github.com/google/dawn/releases/download/${DAWN_TAG}/Dawn-${DAWN_REV}-ubuntu-latest-Release.tar.gz"
68+
echo "${DAWN_SHA256} ${_dawn_tar}" | sha256sum -c -
69+
# archive top dir is Dawn-<rev>-ubuntu-latest-Release/{lib64,include,bin}
70+
tar -C "${_dawn_dir}" --strip-components=1 -xzf "${_dawn_tar}"
71+
fi
2372

24-
export VK_ICD_FILENAMES="${_swiftshader_dir}/swiftshader/build/Linux/vk_swiftshader_icd.json"
25-
export LD_LIBRARY_PATH="${_swiftshader_dir}/swiftshader/build/Linux/:${LD_LIBRARY_PATH}"
26-
export ETVK_USING_SWIFTSHADER=1
27-
}
73+
# --- SwiftShader: build from source at a pinned rev (no S3) -------------------
74+
# The old ossci prebuilt (swiftshader-abe07b943, 2020) is incompatible with the
75+
# current Dawn; build a matching modern SwiftShader instead. Self-contained
76+
# cmake build (vendored LLVM); the ICD lands under build/<OS>/.
77+
if [[ ! -d "${_ss_dir}/build" ]]; then
78+
if [[ ! -d "${_ss_dir}/.git" ]]; then
79+
git clone https://github.com/google/swiftshader "${_ss_dir}"
80+
fi
81+
git -C "${_ss_dir}" checkout "${SWIFTSHADER_REV}"
82+
# vk_swiftshader's deps are vendored in-tree; tolerate unreachable
83+
# disabled-feature submodules (angle, test-only) failing to fetch.
84+
git -C "${_ss_dir}" submodule update --init --recursive || true
85+
cmake -S "${_ss_dir}" -B "${_ss_dir}/build" -DCMAKE_BUILD_TYPE=Release \
86+
-DSWIFTSHADER_BUILD_TESTS=OFF -DSWIFTSHADER_BUILD_PVR=OFF \
87+
-DSWIFTSHADER_BUILD_BENCHMARKS=OFF
88+
cmake --build "${_ss_dir}/build" --parallel "$(nproc)" --target vk_swiftshader
89+
fi
90+
_ss_icd="$(find "${_ss_dir}/build" -name vk_swiftshader_icd.json 2>/dev/null | head -1)"
91+
[[ -n "${_ss_icd}" ]] || { echo "ERROR: SwiftShader ICD not found after build" >&2; exit 1; }
2892

29-
install_swiftshader
30-
bash backends/webgpu/scripts/setup-wgpu-native.sh
93+
_ss_libdir="$(dirname "${_ss_icd}")"
94+
export Dawn_DIR="${_dawn_dir}/lib64/cmake/Dawn"
95+
export VK_ICD_FILENAMES="${_ss_icd}"
96+
export LD_LIBRARY_PATH="${_ss_libdir}:${LD_LIBRARY_PATH:-}"
97+
export WEBGPU_USING_SWIFTSHADER=1

.ci/scripts/test_backend.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ if [[ "$FLOW" == *vulkan* ]]; then
5858
fi
5959

6060
if [[ "$FLOW" == *webgpu* ]]; then
61-
# Setup swiftshader (software Vulkan adapter for GPU-less runners) and wgpu-native,
62-
# which are required to build and run the WebGPU delegate.
61+
# Dawn (Tint) + SwiftShader, the spec-faithful headless WebGPU backend.
6362
source .ci/scripts/setup-webgpu-linux-deps.sh
6463

65-
EXTRA_BUILD_ARGS+=" -DEXECUTORCH_BUILD_WEBGPU=ON"
64+
EXTRA_BUILD_ARGS+=" -DEXECUTORCH_BUILD_WEBGPU=ON -DDawn_DIR=$Dawn_DIR"
6665
fi
6766

6867
if [[ "$FLOW" == *arm* ]]; then

.ci/scripts/test_cortex_m_e2e.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
set -eu
1515

1616
MODEL=$1
17+
TARGET=${2:-cortex-m55}
1718
script_dir=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
1819
et_root_dir=$(realpath "${script_dir}/../..")
1920

20-
# Quantization is the default for the cortex-m55 target; run.sh's
21+
# Quantization is the default for cortex-m targets; run.sh's
2122
# arg parser only recognizes --no_quantize, so we omit any explicit flag.
2223
export ARM_FVP_INSTALL_I_AGREE_TO_THE_CONTAINED_EULA=True
2324
bash "${et_root_dir}/examples/arm/run.sh" \
2425
--model_name="${MODEL}" \
25-
--target=cortex-m55 \
26+
--target="${TARGET}" \
2627
--bundleio

.ci/scripts/wheel/pre_build_script.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Copyright (c) Meta Platforms, Inc. and affiliates.
33
# All rights reserved.
44
#
5+
# Copyright 2026 Arm Limited and/or its affiliates.
6+
#
57
# This source code is licensed under the BSD-style license found in the
68
# LICENSE file in the root directory of this source tree.
79

@@ -57,6 +59,18 @@ fi
5759

5860
"${GITHUB_WORKSPACE}/${REPOSITORY}/install_requirements.sh" --example
5961

62+
# Enable VGF in pybind wheel builds when the platform-specific build input is
63+
# available from pip.
64+
if [[ "$UNAME_S" == "Linux" || "$UNAME_S" == "Darwin" ]]; then
65+
if python3 -m pip install -r \
66+
"${GITHUB_WORKSPACE}/${REPOSITORY}/backends/arm/requirements-arm-vgf-runtime.txt"; then
67+
export EXECUTORCH_PYBIND_ENABLE_VGF=ON
68+
echo "EXECUTORCH_PYBIND_ENABLE_VGF=ON" >> "${GITHUB_ENV}"
69+
else
70+
echo "VGF build dependency unavailable on this platform; building without VGF"
71+
fi
72+
fi
73+
6074
# Download Qualcomm QNN SDK on Linux x86_64 so the wheel build can include the
6175
# QNN backend. The SDK is large, so we download it here (outside CMake) rather
6276
# than during cmake configure.

.github/workflows/_test_cortex_m_e2e.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
description: 'JSON array of model names to run on the Corstone-300 FVP, e.g. ["mv2", "mv3"]'
1212
required: true
1313
type: string
14+
targets:
15+
description: 'JSON array of cortex-m target CPUs to build the runner for, e.g. ["cortex-m55", "cortex-m7", "cortex-m0plus"]'
16+
required: false
17+
type: string
18+
default: '["cortex-m55"]'
1419
timeout:
1520
description: 'Per-matrix-entry timeout in minutes'
1621
required: false
@@ -23,9 +28,10 @@ jobs:
2328
strategy:
2429
matrix:
2530
model: ${{ fromJSON(inputs.models) }}
31+
target: ${{ fromJSON(inputs.targets) }}
2632
fail-fast: false
2733
with:
28-
job-name: ${{ matrix.model }}
34+
job-name: ${{ matrix.model }}-${{ matrix.target }}
2935
runner: linux.2xlarge.memory
3036
docker-image: ci-image:executorch-ubuntu-22.04-arm-sdk
3137
submodules: 'recursive'
@@ -44,4 +50,4 @@ jobs:
4450
source examples/arm/arm-scratch/setup_path.sh
4551
4652
# Export and run model on FVP (run.sh internally builds the test runner).
47-
bash .ci/scripts/test_cortex_m_e2e.sh ${{ matrix.model }}
53+
bash .ci/scripts/test_cortex_m_e2e.sh "${{ matrix.model }}" "${{ matrix.target }}"

.github/workflows/cuda-windows.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- .github/workflows/cuda-windows.yml
1717
- backends/cuda/**
1818
- backends/aoti/**
19+
- extension/cuda/**
1920
workflow_dispatch:
2021

2122
concurrency:
@@ -49,6 +50,7 @@ jobs:
4950
(
5051
contains(needs.changed-files.outputs.changed-files, 'backends/cuda') ||
5152
contains(needs.changed-files.outputs.changed-files, 'backends/aoti') ||
53+
contains(needs.changed-files.outputs.changed-files, 'extension/cuda') ||
5254
contains(needs.changed-files.outputs.changed-files, '.github/workflows/cuda-windows.yml') ||
5355
needs.run-decision.outputs.is-full-run == 'true'
5456
)
@@ -150,6 +152,7 @@ jobs:
150152
(
151153
contains(needs.changed-files.outputs.changed-files, 'backends/cuda') ||
152154
contains(needs.changed-files.outputs.changed-files, 'backends/aoti') ||
155+
contains(needs.changed-files.outputs.changed-files, 'extension/cuda') ||
153156
contains(needs.changed-files.outputs.changed-files, '.github/workflows/cuda-windows.yml') ||
154157
needs.run-decision.outputs.is-full-run == 'true'
155158
)

.github/workflows/mlx.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- backends/mlx/**
1414
- extension/llm/export/**
1515
- extension/audio/**
16+
- examples/models/gemma4_31b/**
1617
- examples/models/parakeet/**
1718
- examples/models/voxtral_realtime/**
1819
- examples/models/qwen3_5_moe/**
@@ -77,6 +78,8 @@ jobs:
7778
backends/mlx/test/test_passes.py \
7879
backends/mlx/test/test_pattern_utils.py \
7980
backends/mlx/test/test_partitioner.py \
81+
backends/mlx/test/test_serialization_dedup.py \
82+
examples/models/gemma4_31b/quant/tests/test_pack_mlx.py \
8083
examples/models/gemma4_31b/tests/test_mlx_pipeline.py \
8184
-v
8285
echo "::endgroup::"
@@ -89,20 +92,16 @@ jobs:
8992
./cmake-out/backends/mlx/test/multi_thread_test_runner
9093
echo "::endgroup::"
9194
92-
echo "::group::Run gated_delta_rule op tests"
93-
${CONDA_RUN} python -m executorch.backends.mlx.model_ops.test_gated_delta_rule run -v
94-
echo "::endgroup::"
95-
96-
echo "::group::Run tq_norm op tests"
97-
${CONDA_RUN} python -m executorch.backends.mlx.model_ops.test_tq_norm run -v
98-
echo "::endgroup::"
99-
100-
echo "::group::Run tq4_compress op tests"
101-
${CONDA_RUN} python -m executorch.backends.mlx.model_ops.test_tq4_compress run -v
102-
echo "::endgroup::"
103-
104-
echo "::group::Run tq_dequant op tests"
105-
${CONDA_RUN} python -m executorch.backends.mlx.model_ops.test_tq_dequant run -v
95+
echo "::group::Run custom_kernel_ops op tests"
96+
# Run every custom_kernel_ops/**/test/test_*.py via its OpTestCase `run`
97+
# CLI. Recurses into per-format subpackages (e.g. gguf/test), so adding a
98+
# new op test file requires no change here.
99+
set -e
100+
for t in $(find backends/mlx/custom_kernel_ops -path '*/test/test_*.py' | sort); do
101+
mod="executorch.$(echo "${t%.py}" | tr '/' '.')"
102+
echo "--- ${mod} ---"
103+
${CONDA_RUN} python -m "${mod}" run -v
104+
done
106105
echo "::endgroup::"
107106
108107
test-mlx-qwen35-moe:

.github/workflows/pull.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,25 @@ jobs:
948948
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-sdk.sh
949949
PYTHON_EXECUTABLE=python bash .ci/scripts/test_model.sh ${{ matrix.model }} "cmake" "qnn"
950950
951+
test-qnn-direct-build-linux:
952+
name: test-qnn-direct-build-linux
953+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
954+
permissions:
955+
id-token: write
956+
contents: read
957+
with:
958+
runner: linux.2xlarge
959+
docker-image: ci-image:executorch-ubuntu-22.04-qnn-sdk
960+
submodules: 'recursive'
961+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
962+
timeout: 30
963+
script: |
964+
# The generic Linux job chooses to use base env, not the one setup by the image
965+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
966+
conda activate "${CONDA_ENV}"
967+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool cmake
968+
PYTHON_EXECUTABLE=python bash .ci/scripts/build-qnn-direct-sdk.sh
969+
951970
test-qnn-testsuite-linux:
952971
name: test-qnn-testsuite-linux
953972
permissions:

0 commit comments

Comments
 (0)