Skip to content

Commit 4eac05e

Browse files
authored
Merge branch 'main' into bundled-proper
2 parents fc88e37 + 3707efa commit 4eac05e

132 files changed

Lines changed: 8493 additions & 481 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ case "${IMAGE_NAME}" in
8989
OS_VERSION=24.04
9090
GCC_VERSION=14
9191
;;
92-
executorch-ubuntu-26.04-gcc15)
92+
executorch-ubuntu-26.04-gcc14)
9393
LINTRUNNER=""
9494
OS_VERSION=26.04
95-
GCC_VERSION=15
95+
GCC_VERSION=14
9696
;;
9797
*)
9898
echo "Invalid image name ${IMAGE_NAME}"

.github/workflows/build-cadence-runner.yml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,45 @@ on:
1010
tags:
1111
- ciflow/nightly/*
1212
pull_request:
13+
pull_request_target:
14+
types: [labeled]
1315
workflow_dispatch:
1416

1517
concurrency:
16-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
18+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.sha }}
1719
cancel-in-progress: true
1820

1921
jobs:
22+
gate:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
run-cadence: ${{ steps.decide.outputs.run }}
26+
steps:
27+
- id: decide
28+
env:
29+
EVENT: ${{ github.event_name }}
30+
IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
31+
HAS_CLA: ${{ contains(github.event.pull_request.labels.*.name, 'CLA Signed') }}
32+
HAS_EXPORT: ${{ contains(github.event.pull_request.labels.*.name, 'meta-exported') }}
33+
run: |
34+
run=false
35+
case "${EVENT}" in
36+
push|schedule|workflow_dispatch)
37+
run=true
38+
;;
39+
pull_request)
40+
[ "${IS_FORK}" = "false" ] && run=true
41+
;;
42+
pull_request_target)
43+
if [ "${IS_FORK}" = "true" ] && [ "${HAS_CLA}" = "true" ] && [ "${HAS_EXPORT}" = "true" ]; then
44+
run=true
45+
fi
46+
;;
47+
esac
48+
echo "run=${run}" >> "${GITHUB_OUTPUT}"
49+
2050
cpu-build:
51+
if: github.event_name != 'pull_request_target'
2152
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
2253
permissions:
2354
id-token: write
@@ -44,6 +75,7 @@ jobs:
4475
4576
cpu-test:
4677
needs: cpu-build
78+
if: github.event_name != 'pull_request_target'
4779
permissions:
4880
id-token: write
4981
contents: read
@@ -56,19 +88,23 @@ jobs:
5688
# lives in _xtensa_build.yml. fusion_g3 is omitted until the upstream fusion_g3
5789
# <-> nnlib-FusionG3 API skew is fixed (its runner does not link).
5890
hifi-build:
91+
needs: gate
92+
if: needs.gate.outputs.run-cadence == 'true'
5993
permissions:
6094
id-token: write
6195
contents: read
6296
uses: ./.github/workflows/_xtensa_build.yml
6397
with:
6498
backend: hifi4
65-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
99+
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
66100

67101
vision-build:
102+
needs: gate
103+
if: needs.gate.outputs.run-cadence == 'true'
68104
permissions:
69105
id-token: write
70106
contents: read
71107
uses: ./.github/workflows/_xtensa_build.yml
72108
with:
73109
backend: vision
74-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
110+
ref: ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Copyright 2026 Arm Limited and/or its affiliates.
2+
#
3+
# This source code is licensed under the BSD-style license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
name: Build CMSIS Pack
7+
8+
on:
9+
schedule:
10+
# Nightly at 03:00 UTC, staggered after nightly.yml (02:00) so the
11+
# shared runner pool isn't hit by both at the same minute.
12+
- cron: 0 3 * * *
13+
release:
14+
# Build (and, for non-prerelease, publish) the pack when a GitHub
15+
# Release is created. The tag the release points at drives the pack
16+
# version via GITHUB_REF below.
17+
types: [published]
18+
push:
19+
branches:
20+
- main
21+
- release/*
22+
paths:
23+
- .github/workflows/build-cmsis-pack.yml
24+
- backends/arm/cmsis_pack/**
25+
- backends/arm/cmsis_pack/scripts/**
26+
- backends/arm/runtime/**
27+
- backends/cortex_m/**
28+
- kernels/portable/**
29+
- kernels/quantized/**
30+
- runtime/**
31+
- schema/**
32+
pull_request:
33+
paths:
34+
- .github/workflows/build-cmsis-pack.yml
35+
- backends/arm/cmsis_pack/**
36+
- backends/arm/cmsis_pack/scripts/**
37+
workflow_dispatch:
38+
inputs:
39+
version_override:
40+
description: 'Override pack version (e.g., 1.2.0). Leave empty to derive from version.txt'
41+
required: false
42+
type: string
43+
44+
concurrency:
45+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
46+
cancel-in-progress: true
47+
48+
jobs:
49+
build-cmsis-pack:
50+
name: build-cmsis-pack
51+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
52+
permissions:
53+
id-token: write
54+
contents: read
55+
with:
56+
runner: linux.2xlarge
57+
docker-image: ci-image:executorch-ubuntu-22.04-arm-sdk
58+
submodules: 'recursive'
59+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
60+
timeout: 60
61+
upload-artifact: cmsis-pack-artifact
62+
script: |
63+
set -eux
64+
65+
echo "::group::Setup environment"
66+
# The generic Linux job chooses to use base env, not the one setup by the image
67+
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
68+
conda activate "${CONDA_ENV}"
69+
70+
source .ci/scripts/utils.sh
71+
install_executorch "--use-pt-pinned-commit"
72+
echo "::endgroup::"
73+
74+
echo "::group::Install ARM toolchain"
75+
.ci/scripts/setup-arm-baremetal-tools.sh
76+
source examples/arm/arm-scratch/setup_path.sh
77+
echo "::endgroup::"
78+
79+
echo "::group::Cross-compile ExecuTorch for Cortex-M"
80+
# Stage 1: Build core ExecuTorch with arm-none-eabi-gcc
81+
# This generates required headers (flatbuffers, schema)
82+
backends/arm/scripts/build_executorch.sh
83+
CMAKE_BUILD_DIR="$(pwd)/cmake-out-arm"
84+
echo "::endgroup::"
85+
86+
echo "::group::Determine pack version"
87+
# Derive version from tag, input override, schedule (nightly), or version.txt
88+
BASE_VER="$(cat version.txt | sed 's/a0$//')"
89+
if [[ -n "${{ inputs.version_override || '' }}" ]]; then
90+
PACK_VERSION="${{ inputs.version_override }}"
91+
elif [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
92+
# Strip leading 'v' and any -rc suffix for release tags
93+
PACK_VERSION="${GITHUB_REF#refs/tags/v}"
94+
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
95+
PACK_VERSION="${BASE_VER}-nightly-$(date -u +%Y%m%d)"
96+
else
97+
PACK_VERSION="${BASE_VER}-dev"
98+
fi
99+
echo "Pack version: ${PACK_VERSION}"
100+
echo "::endgroup::"
101+
102+
echo "::group::Build CMSIS Pack"
103+
backends/arm/cmsis_pack/scripts/build_pack.sh \
104+
--executorch-root "$(pwd)" \
105+
--build-dir "${CMAKE_BUILD_DIR}" \
106+
--version "${PACK_VERSION}" \
107+
--output-dir "$(pwd)/artifacts-to-be-uploaded"
108+
echo "::endgroup::"
109+
110+
# Structural validation and consumer-build smoke are intentionally
111+
# not run in CI yet. See:
112+
# backends/arm/cmsis_pack/test/validate_pack.py (structural)
113+
# backends/arm/cmsis_pack/test/smoke/run.sh (cbuild via
114+
# AVH-MLOps)
115+
# for the local test drivers.
116+
117+
# Attach the pack to the GitHub Release when a non-prerelease release is
118+
# published. Prereleases still build + validate via the release trigger
119+
# but are not published.
120+
publish-cmsis-pack:
121+
if: github.event_name == 'release' && !github.event.release.prerelease
122+
needs: build-cmsis-pack
123+
runs-on: ubuntu-latest
124+
permissions:
125+
contents: write
126+
steps:
127+
- name: Download pack artifact
128+
uses: actions/download-artifact@v4
129+
with:
130+
name: cmsis-pack-artifact
131+
path: pack-output
132+
133+
- name: Upload to GitHub Release
134+
uses: softprops/action-gh-release@v2
135+
with:
136+
files: pack-output/*.pack
137+
tag_name: ${{ github.ref_name }}

.github/workflows/docker-builds.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
executorch-ubuntu-22.04-mediatek-sdk,
4444
executorch-ubuntu-22.04-clang12-android,
4545
executorch-ubuntu-24.04-gcc14,
46-
executorch-ubuntu-26.04-gcc15,
46+
executorch-ubuntu-26.04-gcc14,
4747
]
4848
include:
4949
- docker-image-name: executorch-ubuntu-22.04-gcc11-aarch64

.github/workflows/mlx.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
backends/mlx/test/test_pattern_utils.py \
8080
backends/mlx/test/test_partitioner.py \
8181
backends/mlx/test/test_serialization_dedup.py \
82+
backends/mlx/test/test_slot_recycling.py \
8283
examples/models/gemma4_31b/quant/tests/test_pack_mlx.py \
8384
examples/models/gemma4_31b/tests/test_mlx_pipeline.py \
8485
-v

.github/workflows/pull.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ jobs:
14001400
docker-image: ci-image:executorch-ubuntu-22.04-clang12
14011401
submodules: 'recursive'
14021402
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
1403-
timeout: 90
1403+
timeout: 120
14041404
script: |
14051405
set -eux
14061406

.lintrunner.toml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ exclude_patterns = [
196196

197197
# Kernel areas to onboard separately.
198198
'kernels/optimized/**',
199-
'kernels/portable/**',
200199

201200
# Runtime areas to onboard incrementally.
202201
'runtime/backend/**',
@@ -245,6 +244,23 @@ command = [
245244
'--extra-arg=--suppress=duplicateBranch:*kernels/test/*',
246245
'--extra-arg=--suppress=useStlAlgorithm:*kernels/test/*',
247246
'--extra-arg=--suppress=functionStatic:*kernels/test/*',
247+
# Portable kernels are referenced through generated registration tables,
248+
# which cppcheck CTU does not see as direct C++ calls.
249+
'--extra-arg=--suppress=unusedFunction:*kernels/portable/*',
250+
# Cppcheck does not parse several ExecuTorch macro idioms used heavily in
251+
# portable kernels, including empty macro arguments and printf-style macros
252+
# concatenated into string literals.
253+
'--extra-arg=--suppress=unknownMacro:*kernels/portable/*',
254+
'--extra-arg=--suppress=syntaxError:*kernels/portable/*',
255+
# Keep style-only portable-kernel findings scoped to this tree rather than
256+
# rewriting broad helper code for lint-only advice.
257+
'--extra-arg=--suppress=useStlAlgorithm:*kernels/portable/*',
258+
'--extra-arg=--suppress=variableScope:*kernels/portable/*',
259+
'--extra-arg=--suppress=constParameterReference:*kernels/portable/*',
260+
'--extra-arg=--suppress=constParameterPointer:*kernels/portable/*',
261+
'--extra-arg=--suppress=functionStatic:*kernels/portable/*',
262+
'--extra-arg=--suppress=knownConditionTrueFalse:*kernels/portable/*',
263+
'--extra-arg=--suppress=invalidFunctionArg:*kernels/portable/*',
248264
'--',
249265
'@{{PATHSFILE}}'
250266
]

backends/apple/coreml/runtime/delegate/ETCoreMLModel.mm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,15 @@ - (nullable instancetype)initWithAsset:(ETCoreMLAsset *)asset
194194
return nil;
195195
}
196196

197-
MLModel *mlModel = [MLModel modelWithContentsOfURL:asset.contentURL
197+
NSURL *contentURL = asset.contentURL;
198+
if (contentURL == nil) {
199+
ETCoreMLLogErrorAndSetNSError(error,
200+
ETCoreMLErrorCorruptedModel,
201+
"asset.contentURL is nil");
202+
return nil;
203+
}
204+
205+
MLModel *mlModel = [MLModel modelWithContentsOfURL:contentURL
198206
configuration:configuration
199207
error:error];
200208
if (!mlModel) {

backends/arm/TARGETS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ runtime.python_library(
100100
resources = [
101101
"vgf/shaders/grid_sampler.glsl",
102102
"vgf/shaders/grid_sampler.spirv.b64",
103+
"vgf/shaders/grid_sampler_sampler.glsl",
104+
"vgf/shaders/grid_sampler_sampler.spirv.b64",
105+
"vgf/shaders/grid_sampler_sampler_align_corners.glsl",
106+
"vgf/shaders/grid_sampler_sampler_align_corners.spirv.b64",
107+
"vgf/shaders/grid_sampler_sampler_int8.glsl",
108+
"vgf/shaders/grid_sampler_sampler_int8.spirv.b64",
109+
"vgf/shaders/grid_sampler_sampler_int8_align_corners.glsl",
110+
"vgf/shaders/grid_sampler_sampler_int8_align_corners.spirv.b64",
103111
],
104112
deps = [
105113
":arm_compile_spec",

backends/arm/_passes/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from .accumulate_index_put_pass import AccumulateIndexPutPass # noqa
1010
from .broadcast_args_pass import BroadcastArgsPass # noqa
1111
from .canonicalize_gather_pass import CanonicalizeGatherPass # noqa
12+
from .canonicalize_view_copy_permute_pass import CanonicalizeViewCopyPermutePass # noqa
1213
from .cast_int64_pass import CastInt64BuffersToInt32Pass # noqa
1314
from .cast_to_int32_pass import CastToInt32Pass # noqa
1415
from .constant_folding_pass import ConstantFoldingPass # noqa
@@ -170,6 +171,7 @@
170171
from .rewrite_le_lt_to_ge_gt_pass import RewriteLeLtToGeGtPass # noqa
171172
from .rewrite_matmul import RewriteMatmulPass # noqa
172173
from .rewrite_max_pool2d_pass import RewriteMaxPool2dPass # noqa
174+
from .rewrite_mxfp_linear import RewriteMXFPLinearPass # noqa
173175
from .rewrite_pad import RewritePadPass # noqa
174176
from .rewrite_slice import RewriteSlicePass # noqa
175177
from .rewrite_upsample import RewriteUpsamplePass # noqa

0 commit comments

Comments
 (0)