Skip to content

Commit ff0ba0d

Browse files
authored
Merge branch 'main' into fix-coreml-duplicate-ops-registration
2 parents a1552b0 + a89a05a commit ff0ba0d

297 files changed

Lines changed: 13409 additions & 3983 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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ case "${IMAGE_NAME}" in
8989
OS_VERSION=24.04
9090
GCC_VERSION=14
9191
;;
92+
executorch-ubuntu-26.04-gcc15)
93+
LINTRUNNER=""
94+
OS_VERSION=26.04
95+
GCC_VERSION=15
96+
;;
9297
*)
9398
echo "Invalid image name ${IMAGE_NAME}"
9499
exit 1

.ci/docker/common/install_docs_reqs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ if [ -n "$BUILD_DOCS" ]; then
1515
curl --retry 3 --retry-all-errors -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
1616
sudo apt-get install -y nodejs
1717

18-
curl --retry 3 --retry-all-errors -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
19-
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
18+
curl --retry 3 --retry-all-errors -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/yarn-archive-keyring.gpg
19+
echo "deb [signed-by=/usr/share/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
2020

2121
apt-get update
2222
apt-get install -y --no-install-recommends yarn

.ci/docker/common/install_linter.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,3 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"
1313
# NB: Install all linter dependencies, the caching of lintrunner init could be
1414
# done after Executorch becomes public
1515
pip_install -r requirements-lintrunner.txt
16-
17-
# Install google-java-format
18-
curl -L --retry 3 --retry-all-errors https://github.com/google/google-java-format/releases/download/v1.23.0/google-java-format_linux-x86-64 > /opt/google-java-format
19-
chmod +x /opt/google-java-format

.ci/scripts/unittest-macos-cmake.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,19 @@ set -eux
1212
export TORCHINDUCTOR_CACHE_DIR="$(mktemp -d "${RUNNER_TEMP:-/tmp}/torchinductor_cache_XXXXXX")"
1313
trap 'rm -rf "${TORCHINDUCTOR_CACHE_DIR}"' EXIT
1414

15-
# Run pytest with coverage
16-
${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml
15+
# TODO(SS-JIA): AOTI tests hang on macOS CI runners — the thread blocks in
16+
# native C/C++ code (dlopen / inductor compilation) so faulthandler cannot
17+
# even produce a traceback. Diagnosis ongoing in #19886.
18+
AOTI_SKIPS=(
19+
--ignore=examples/models/llama3_2_vision/preprocess/test_preprocess.py
20+
--ignore=examples/models/llama3_2_vision/vision_encoder/test/test_vision_encoder.py
21+
--ignore=examples/models/llama3_2_vision/text_decoder/test/test_text_decoder.py
22+
--deselect=extension/llm/modules/test/test_position_embeddings.py::TilePositionalEmbeddingTest::test_tile_positional_embedding_aoti
23+
--deselect=extension/llm/modules/test/test_position_embeddings.py::TiledTokenPositionalEmbeddingTest::test_tiled_token_positional_embedding_aoti
24+
--deselect=extension/llm/modules/test/test_attention.py::AttentionTest::test_attention_aoti
25+
)
26+
27+
${CONDA_RUN} pytest -n auto --cov=./ --cov-report=xml "${AOTI_SKIPS[@]}"
1728
# Run gtest
1829
LLVM_PROFDATA="xcrun llvm-profdata" LLVM_COV="xcrun llvm-cov" \
1930
${CONDA_RUN} test/run_oss_cpp_tests.sh

.github/scripts/propose_ghstack_orig_pr.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,9 @@ def extract_stack_from_body(pr_body: str) -> List[int]:
5252
"""
5353

5454
prs = []
55-
ghstack_begin = (
56-
"Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):"
57-
)
5855
ghstack_begin_seen = False
5956
for line in pr_body.splitlines():
60-
if ghstack_begin in line:
57+
if line.startswith("Stack from [ghstack]"):
6158
ghstack_begin_seen = True
6259
if not ghstack_begin_seen:
6360
continue
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI Run Decision
2+
3+
# Single source of truth for "should this commit force-run all CI jobs
4+
# regardless of path filter?". Used by per-job ``if:`` gates in pull.yml
5+
# and trunk.yml so the sampling logic isn't repeated per job.
6+
#
7+
# Returns ``is-full-run = 'true'`` for:
8+
# - workflow_dispatch (manual run)
9+
# - ciflow/* tag pushes (maintainer-forced full run)
10+
# - push events at every 4th commit by depth from main's root
11+
# (deterministic 25% sample, hard cap of 4 commits between samples)
12+
#
13+
# Returns ``is-full-run = 'false'`` for:
14+
# - pull_request / pull_request_target (use path filter instead)
15+
# - push events not matching any of the above (path-filtered runs)
16+
#
17+
# See ``viable-strict-gate.yml``: viable/strict only advances on
18+
# commits where this is true, so the path-filtered fast path doesn't
19+
# silently advance partial signal.
20+
21+
on:
22+
workflow_call:
23+
outputs:
24+
is-full-run:
25+
description: "'true' if this commit should run all CI jobs regardless of path filter; 'false' otherwise."
26+
value: ${{ jobs.decide.outputs.is-full-run }}
27+
28+
permissions:
29+
contents: read
30+
31+
jobs:
32+
decide:
33+
runs-on: ubuntu-latest
34+
outputs:
35+
is-full-run: ${{ steps.compute.outputs.is-full-run }}
36+
steps:
37+
# Full history needed to compute commit depth via
38+
# `git rev-list --first-parent --count`. The --first-parent flag
39+
# follows only the linear main-branch history through merge
40+
# commits, so the count maps 1:1 to pushes on main regardless of
41+
# how many commits were in any merged PR.
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0
46+
47+
- name: Compute is-full-run
48+
id: compute
49+
env:
50+
EVENT_NAME: ${{ github.event_name }}
51+
REF: ${{ github.ref }}
52+
SHA: ${{ github.sha }}
53+
run: |
54+
set -eu
55+
56+
IS_FULL=false
57+
58+
case "$EVENT_NAME" in
59+
workflow_dispatch)
60+
IS_FULL=true
61+
;;
62+
esac
63+
64+
case "$REF" in
65+
refs/tags/ciflow/*)
66+
IS_FULL=true
67+
;;
68+
esac
69+
70+
# Depth-based 25% sample on push: every 4th commit on the
71+
# linear main-branch history (depth %% 4 == 0). --first-parent
72+
# is required — plain `git rev-list --count` would walk all
73+
# merge parents, so the count would jump by (1 + PR_size) at
74+
# each merge commit and the sample rate would be unpredictable.
75+
# Hard guarantees with --first-parent:
76+
# - Exactly 25% of pushes on main are sampled.
77+
# - At most 3 non-sampled commits between any two samples.
78+
# Re-runs of the same commit always have the same outcome.
79+
if [ "$IS_FULL" = "false" ] && [ "$EVENT_NAME" = "push" ]; then
80+
DEPTH=$(git rev-list --first-parent --count "$SHA")
81+
if [ $((DEPTH % 4)) -eq 0 ]; then
82+
IS_FULL=true
83+
fi
84+
echo "Depth: $DEPTH (first-parent; depth %% 4 = $((DEPTH % 4)))"
85+
fi
86+
87+
echo "Event: $EVENT_NAME"
88+
echo "Ref: $REF"
89+
echo "SHA: $SHA"
90+
echo "is-full-run: $IS_FULL"
91+
echo "is-full-run=$IS_FULL" >> "$GITHUB_OUTPUT"

.github/workflows/_get-changed-files.yml

Lines changed: 64 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,24 @@ name: Get Changed Files
22

33
on:
44
workflow_call:
5+
inputs:
6+
include-push-diff:
7+
description: |
8+
When true, on push events the output is the diff between
9+
`github.event.before` and `github.sha` (computed via the
10+
GitHub Compare API). Default is false: push events emit '*',
11+
matching the historical behavior.
12+
type: boolean
13+
required: false
14+
default: false
515
outputs:
616
changed-files:
7-
description: "List of changed files (space-separated) or '*' if not in a PR"
17+
description: "Space-separated list of changed files for PR events (and push events when include-push-diff=true); '*' otherwise."
818
value: ${{ jobs.get-changed-files.outputs.changed-files }}
919

20+
permissions:
21+
contents: read
22+
1023
jobs:
1124
get-changed-files:
1225
runs-on: ubuntu-latest
@@ -18,26 +31,65 @@ jobs:
1831
id: get-files
1932
env:
2033
GH_TOKEN: ${{ github.token }}
34+
INCLUDE_PUSH_DIFF: ${{ inputs.include-push-diff }}
2135
run: |
22-
# Check if we're in a pull request context
23-
if [ "${{ github.event_name }}" = "pull_request" ] || [ "${{ github.event_name }}" = "pull_request_target" ]; then
24-
echo "Running in PR context"
36+
set -eu
2537
26-
# Get the PR number from the github context
27-
PR_NUMBER="${{ github.event.number }}"
38+
EVENT_NAME="${{ github.event_name }}"
39+
REPO="${{ github.repository }}"
2840
29-
# Use gh CLI to get changed files in the PR with explicit repo
30-
CHANGED_FILES=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/files --paginate --jq '.[] | select(.status != "removed") | .filename' | tr '\n' ' ' | sed 's/ $//')
41+
# PR context: list files modified by the PR.
42+
if [ "$EVENT_NAME" = "pull_request" ] || [ "$EVENT_NAME" = "pull_request_target" ]; then
43+
echo "Running in PR context"
44+
PR_NUMBER="${{ github.event.number }}"
45+
CHANGED_FILES=$(gh api "repos/$REPO/pulls/$PR_NUMBER/files" --paginate \
46+
--jq '.[] | select(.status != "removed") | .filename' | tr '\n' ' ' | sed 's/ $//')
3147
3248
if [ -z "$CHANGED_FILES" ]; then
3349
echo "No changed files found, setting to '*'"
3450
CHANGED_FILES="*"
3551
fi
36-
3752
echo "Changed files: $CHANGED_FILES"
3853
echo "changed-files=$CHANGED_FILES" >> "$GITHUB_OUTPUT"
54+
exit 0
55+
fi
3956
40-
else
41-
echo "Not in PR context, setting changed files to '*'"
42-
echo "changed-files=*" >> "$GITHUB_OUTPUT"
57+
# Push context with opt-in: diff between previous tip and new
58+
# tip via the GitHub Compare API. This is what lets path-
59+
# filtered jobs skip on push commits that don't touch their
60+
# relevant paths. Callers must explicitly request this with
61+
# `include-push-diff: true` because some workflows (e.g.
62+
# lint.yml) historically rely on the '*' value to take a
63+
# broader code path.
64+
if [ "$EVENT_NAME" = "push" ] && [ "$INCLUDE_PUSH_DIFF" = "true" ]; then
65+
BEFORE="${{ github.event.before }}"
66+
AFTER="${{ github.sha }}"
67+
ZERO_SHA="0000000000000000000000000000000000000000"
68+
69+
if [ -z "$BEFORE" ] || [ "$BEFORE" = "$ZERO_SHA" ]; then
70+
echo "No 'before' SHA on push event (tag/branch creation or initial push); setting changed files to '*'"
71+
echo "changed-files=*" >> "$GITHUB_OUTPUT"
72+
exit 0
73+
fi
74+
75+
echo "Running in push context: comparing $BEFORE..$AFTER"
76+
CHANGED_FILES=$(gh api "repos/$REPO/compare/$BEFORE...$AFTER" --paginate \
77+
--jq '.files[]? | select(.status != "removed") | .filename' 2>/dev/null \
78+
| tr '\n' ' ' | sed 's/ $//' || echo "")
79+
80+
if [ -z "$CHANGED_FILES" ]; then
81+
echo "Compare returned empty; setting changed files to '*'"
82+
echo "changed-files=*" >> "$GITHUB_OUTPUT"
83+
exit 0
84+
fi
85+
86+
echo "Changed files: $CHANGED_FILES"
87+
echo "changed-files=$CHANGED_FILES" >> "$GITHUB_OUTPUT"
88+
exit 0
4389
fi
90+
91+
# Default for non-PR events (push without opt-in,
92+
# workflow_dispatch, schedule, etc.): no diff. Emit '*' to
93+
# preserve the historical behavior.
94+
echo "Event '$EVENT_NAME' (or include-push-diff=false): emitting '*'"
95+
echo "changed-files=*" >> "$GITHUB_OUTPUT"

.github/workflows/_unittest.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
python-version: '3.11'
5050
submodules: 'recursive'
5151
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
52+
timeout: 120
5253
script: |
5354
set -eux
5455
# This is needed to get the prebuilt PyTorch wheel from S3

.github/workflows/docker-builds.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +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,
4647
]
4748
include:
4849
- docker-image-name: executorch-ubuntu-22.04-gcc11-aarch64

.github/workflows/lint.yml

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -125,49 +125,3 @@ jobs:
125125
uses: ./.github/workflows/_link_check.yml
126126
with:
127127
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
128-
129-
android-java-format:
130-
runs-on: ubuntu-latest
131-
permissions:
132-
contents: read
133-
steps:
134-
- uses: actions/checkout@v4
135-
with:
136-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
137-
138-
- uses: actions/setup-java@v4
139-
with:
140-
distribution: 'temurin'
141-
java-version: '17'
142-
143-
- name: Check Java formatting
144-
run: |
145-
GOOGLE_JAVA_FORMAT_VERSION="1.24.0"
146-
curl -sSfL "https://github.com/google/google-java-format/releases/download/v${GOOGLE_JAVA_FORMAT_VERSION}/google-java-format-${GOOGLE_JAVA_FORMAT_VERSION}-all-deps.jar" \
147-
-o /tmp/google-java-format.jar
148-
149-
FILES_NEEDS_FORMAT=$(find extension/android/executorch_android/src/main/java/org/pytorch/executorch \
150-
extension/android/executorch_android/src/main/java/org/pytorch/executorch/extension/llm \
151-
extension/android/executorch_android/src/main/java/org/pytorch/executorch/annotations \
152-
extension/android/executorch_android/src/androidTest/java/org/pytorch/executorch \
153-
extension/benchmark/android/benchmark/app/src/main/java/org/pytorch/minibench \
154-
extension/benchmark/android/benchmark/app/src/androidTest/java/org/pytorch/minibench \
155-
-type f -name "*.java" 2>/dev/null | \
156-
xargs -r java -jar /tmp/google-java-format.jar -n)
157-
158-
if [ -n "$FILES_NEEDS_FORMAT" ]; then
159-
echo "Warning: The following files need formatting:"
160-
echo "$FILES_NEEDS_FORMAT"
161-
echo ""
162-
echo "Please use google-java-format from https://github.com/google/google-java-format/releases/"
163-
echo ""
164-
echo "To fix, run one of these commands:"
165-
echo " # Using xargs (recommended):"
166-
echo " find <paths> -type f -name '*.java' | xargs google-java-format -i"
167-
echo ""
168-
echo " # Or format specific files:"
169-
echo "$FILES_NEEDS_FORMAT" | while IFS= read -r file; do
170-
echo " google-java-format -i \"$file\""
171-
done
172-
exit 1
173-
fi

0 commit comments

Comments
 (0)