Skip to content

Commit ee75c2e

Browse files
authored
Merge branch 'main' into cuda-graph
2 parents 7c148f7 + de61304 commit ee75c2e

348 files changed

Lines changed: 42247 additions & 1822 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/scripts/build-qnn-sdk.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ set_up_aot() {
4040
-DEXECUTORCH_BUILD_EXTENSION_FLAT_TENSOR=ON \
4141
-DEXECUTORCH_BUILD_EXTENSION_NAMED_DATA_MAP=ON \
4242
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
43+
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \
44+
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED_AOT=ON \
4345
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
4446
-DPYTHON_EXECUTABLE=python3
4547
cmake --build $PWD --target "PyQnnManagerAdaptor" -j$(nproc)

.ci/scripts/setup-qnn-deps.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ source "$(dirname "${BASH_SOURCE[0]}")/../../backends/qualcomm/scripts/install_q
1111

1212
setup_libcpp 12
1313
setup_android_ndk
14-
install_qnn
14+
install_qnn
15+
pip install -r backends/qualcomm/requirements.txt

.ci/scripts/test_wheel_package_qnn.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ PY
177177
"$PIPBIN" install . --no-build-isolation
178178
popd > /dev/null
179179

180+
# Install qualcomm backend dependencies
181+
"$PIPBIN" install -r "$REPO_ROOT/backends/qualcomm/requirements.txt"
182+
180183
echo "=== [$LABEL] Import smoke tests ==="
181184
"$PYBIN" -c "import executorch; print('executorch imported successfully')"
182185
"$PYBIN" -c "import executorch.backends.qualcomm; print('executorch.backends.qualcomm imported successfully')"

.githooks/README.md

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,63 @@
11
# Git Hooks
22

3-
This directory contains Git hooks for the ExecuTorch repository.
3+
This directory contains Git hooks for the ExecuTorch repository. It is used as
4+
`core.hooksPath`, so git looks here instead of `.git/hooks/`.
45

5-
## Pre-commit Hook
6+
## Hooks
67

7-
The pre-commit hook automatically updates the PyTorch commit pin in `.ci/docker/ci_commit_pins/pytorch.txt` whenever `torch_pin.py` is modified.
8+
### pre-commit
89

9-
### How It Works
10+
Runs on every commit:
1011

11-
1. When you commit changes to `torch_pin.py`, the hook detects the change
12-
2. It parses the `NIGHTLY_VERSION` field (e.g., `dev20251004`)
13-
3. Converts it to a date string (e.g., `2025-10-04`)
14-
4. Fetches the corresponding commit hash from the PyTorch nightly branch at https://github.com/pytorch/pytorch/tree/nightly
15-
5. Updates `.ci/docker/ci_commit_pins/pytorch.txt` with the new commit hash
16-
6. Automatically stages the updated file for commit
12+
1. **torch_pin sync** — when `torch_pin.py` is staged, updates the PyTorch commit
13+
pin in `.ci/docker/ci_commit_pins/pytorch.txt` and syncs grafted c10 files.
14+
2. **lintrunner** — runs `lintrunner -a --revision HEAD^ --skip MYPY` on changed
15+
files. Auto-fixes formatting and blocks on lint errors. Soft-fails if lintrunner
16+
is not installed. Runs `lintrunner init` automatically when `.lintrunner.toml`
17+
changes.
1718

18-
### Installation
19+
### pre-push
1920

20-
To install the Git hooks, run:
21+
Delegates to `.git/hooks/pre-push` if one exists. This allows backend-specific
22+
pre-push hooks (e.g., ARM's license and commit message checks) to work alongside
23+
the repo-wide hooks.
24+
25+
## Installation
26+
27+
Hooks are installed automatically by `./install_executorch.sh`.
28+
29+
To install manually:
2130

2231
```bash
23-
.githooks/install.sh
32+
git config core.hooksPath .githooks
2433
```
2534

26-
This will copy the pre-commit hook to `.git/hooks/` and make it executable.
35+
### ARM backend pre-push
2736

28-
### Manual Usage
29-
30-
You can also run the update script manually at any time:
37+
ARM contributors should additionally install the ARM-specific pre-push hook:
3138

3239
```bash
33-
python .github/scripts/update_pytorch_pin.py
40+
cp backends/arm/scripts/pre-push .git/hooks/
3441
```
3542

36-
### Uninstalling
43+
## Bypassing
3744

38-
To remove the pre-commit hook:
45+
To skip hooks for a single commit or push:
3946

4047
```bash
41-
rm .git/hooks/pre-commit
48+
git commit --no-verify
49+
git push --no-verify
4250
```
4351

4452
## Troubleshooting
4553

46-
If the hook fails during a commit:
54+
If the torch_pin hook fails:
4755

4856
1. Check that Python 3 is available in your PATH
4957
2. Ensure you have internet connectivity to fetch commits from GitHub
5058
3. Verify that the `NIGHTLY_VERSION` in `torch_pin.py` is in the correct format (`devYYYYMMDD`)
51-
4. Make sure the corresponding nightly release exists in the PyTorch nightly branch
5259

53-
You can run the script manually to see detailed error messages:
60+
If lintrunner fails:
5461

55-
```bash
56-
python .github/scripts/update_pytorch_pin.py
57-
```
62+
1. Run `lintrunner init` to install linter tools
63+
2. Check that your virtual environment is activated

.githooks/install.sh

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

.githooks/pre-commit

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,68 @@ if git diff --cached --name-only | grep -q "^torch_pin.py$"; then
2727
fi
2828
fi
2929

30-
exit 0
30+
# --- lintrunner ---
31+
32+
if ! command -v lintrunner >/dev/null 2>&1; then
33+
echo "Warning: lintrunner not found. Skipping lint checks."
34+
echo "Install with: pip install lintrunner lintrunner-adapters && lintrunner init"
35+
exit 0
36+
fi
37+
38+
if [ ! -f .lintrunner.toml ]; then
39+
echo "Warning: .lintrunner.toml not found. Skipping lint checks."
40+
exit 0
41+
fi
42+
43+
git_dir=$(git rev-parse --git-dir)
44+
45+
# Portable hash: sha256sum (Linux) or shasum (macOS)
46+
if command -v sha256sum >/dev/null 2>&1; then
47+
toml_hash=$(sha256sum .lintrunner.toml | cut -d' ' -f1)
48+
else
49+
toml_hash=$(shasum -a 256 .lintrunner.toml | cut -d' ' -f1)
50+
fi
51+
stored_hash=""
52+
[ -f "${git_dir}/.lintrunner_init_hash" ] && stored_hash=$(cat "${git_dir}/.lintrunner_init_hash")
53+
54+
if [ "${toml_hash}" != "${stored_hash}" ]; then
55+
echo "Running lintrunner init..."
56+
if lintrunner init; then
57+
echo "${toml_hash}" > "${git_dir}/.lintrunner_init_hash"
58+
else
59+
echo "lintrunner init failed. Run 'lintrunner init' manually."
60+
exit 1
61+
fi
62+
fi
63+
64+
staged_files=$(git diff --cached --name-only --diff-filter=ACMR)
65+
66+
# Use HEAD^ if it exists (skip on initial commit)
67+
revision_flag="--revision HEAD^"
68+
if ! git rev-parse HEAD^ >/dev/null 2>&1; then
69+
revision_flag=""
70+
fi
71+
72+
lintrunner -a $revision_flag --skip MYPY
73+
lint_status=$?
74+
75+
# Check if lintrunner modified any staged files. If so, block the commit
76+
# so the user can review the changes before committing.
77+
files_modified=0
78+
while IFS= read -r path; do
79+
[ -z "${path}" ] && continue
80+
if ! git diff --quiet -- "${path}" 2>/dev/null; then
81+
files_modified=1
82+
break
83+
fi
84+
done <<< "${staged_files}"
85+
86+
if [ $files_modified -eq 1 ]; then
87+
echo "Lintrunner modified files. Review with 'git diff', then 'git add -u && git commit'."
88+
exit 1
89+
fi
90+
91+
if [ $lint_status -ne 0 ]; then
92+
echo "Lint errors found. Fix them and try again, or use 'git commit --no-verify' to skip."
93+
exit 1
94+
fi

.githooks/pre-push

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
# Delegate to local pre-push hook if present (e.g., ARM backend).
4+
# .githooks/ is set as core.hooksPath, so git won't look in .git/hooks/
5+
# automatically. This passthrough ensures local hooks still run.
6+
local_hook="$(git rev-parse --git-dir)/hooks/pre-push"
7+
if [ -x "$local_hook" ]; then
8+
"$local_hook" "$@"
9+
fi
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Test Cadence
2+
3+
permissions:
4+
id-token: write
5+
contents: read
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
docker-image:
11+
description: 'Docker image to use'
12+
required: false
13+
type: string
14+
default: ci-image:executorch-ubuntu-22.04-clang12
15+
runner:
16+
description: 'Runner type'
17+
required: false
18+
type: string
19+
default: linux.8xlarge.memory
20+
ref:
21+
description: 'Git ref to checkout'
22+
required: false
23+
type: string
24+
default: ${{ github.sha }}
25+
timeout:
26+
description: 'Job timeout in minutes'
27+
required: false
28+
type: number
29+
default: 90
30+
31+
jobs:
32+
test-aot:
33+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
34+
with:
35+
job-name: test-aot
36+
runner: ${{ inputs.runner }}
37+
docker-image: ${{ inputs.docker-image }}
38+
submodules: recursive
39+
ref: ${{ inputs.ref }}
40+
timeout: ${{ inputs.timeout }}
41+
script: |
42+
set -eux
43+
conda create -y -n cadence_test python=3.12 > /dev/null
44+
conda activate cadence_test
45+
46+
./install_requirements.sh > /dev/null
47+
pip install -e . --no-build-isolation > /dev/null
48+
pip install beartype later pyre_extensions pytest-xdist
49+
50+
python -m pytest backends/cadence/aot/tests/ -v -n auto
51+
52+
test-ops:
53+
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
54+
with:
55+
job-name: test-ops
56+
runner: ${{ inputs.runner }}
57+
docker-image: ${{ inputs.docker-image }}
58+
submodules: recursive
59+
ref: ${{ inputs.ref }}
60+
timeout: ${{ inputs.timeout }}
61+
download-artifact: cadence-runner-build
62+
script: |
63+
set -eux
64+
conda create -y -n cadence_test python=3.12 > /dev/null
65+
conda activate cadence_test
66+
67+
./install_requirements.sh > /dev/null
68+
pip install -e . --no-build-isolation > /dev/null
69+
pip install beartype later pyre_extensions pytest-xdist
70+
71+
# Use the pre-built runner from the build job
72+
mkdir -p cmake-out/backends/cadence
73+
cp "${RUNNER_ARTIFACT_DIR}/cadence_runner" cmake-out/backends/cadence/cadence_runner
74+
chmod +x cmake-out/backends/cadence/cadence_runner
75+
76+
export PYTHONPATH="${PYTHONPATH:-}:$(pwd)/backends/cadence/utils/FACTO"
77+
python -m pytest examples/cadence/operators/ -v -n auto

.github/workflows/android-release-artifacts.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ jobs:
5353
run: |
5454
VERSION="${{ inputs.version }}"
5555
FLAVOR="${{ inputs.flavor }}"
56+
if [ -z "$FLAVOR" ]; then
57+
FLAVOR="xnnpack"
58+
fi
5659
if [ -z "$VERSION" ]; then
5760
echo "No version name specified. Will create a snapshot AAR"
5861
echo "should-skip=false" >> $GITHUB_OUTPUT
@@ -115,9 +118,10 @@ jobs:
115118
fi
116119
117120
FLAVOR="${{ inputs.flavor }}"
118-
if [ ! -z "$FLAVOR" ]; then
119-
GRADLE_ARGS+=" -Dflavor=${FLAVOR}"
121+
if [ -z "$FLAVOR" ]; then
122+
FLAVOR="xnnpack"
120123
fi
124+
GRADLE_ARGS+=" -Dflavor=${FLAVOR}"
121125
122126
if [[ "$FLAVOR" == "vulkan" || "$FLAVOR" == "all" || -z "$FLAVOR" ]]; then
123127
curl -O https://sdk.lunarg.com/sdk/download/1.4.321.1/linux/vulkansdk-linux-x86_64-1.4.321.1.tar.xz

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
name: Build Cadence
1+
name: Cadence Build & Test
22

33
on:
4-
pull_request:
4+
schedule:
5+
- cron: 0 8 * * *
56
push:
67
branches:
78
- main
89
- release/*
10+
tags:
11+
- ciflow/nightly/*
12+
pull_request:
913
workflow_dispatch:
1014

1115
concurrency:
1216
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
1317
cancel-in-progress: true
1418

1519
jobs:
16-
cpu:
20+
cpu-build:
1721
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
1822
permissions:
1923
id-token: write
@@ -25,6 +29,7 @@ jobs:
2529
submodules: recursive
2630
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
2731
timeout: 90
32+
upload-artifact: cadence-runner-build
2833
script: |
2934
set -eux
3035
# The generic Linux job chooses to use base env, not the one setup by the image
@@ -33,3 +38,15 @@ jobs:
3338
3439
./install_requirements.sh > /dev/null
3540
bash backends/cadence/build_cadence_runner.sh
41+
42+
# Copy runner binary to artifact dir for downstream test jobs
43+
cp cmake-out/backends/cadence/cadence_runner "${RUNNER_ARTIFACT_DIR}/"
44+
45+
cpu-test:
46+
needs: cpu-build
47+
permissions:
48+
id-token: write
49+
contents: read
50+
uses: ./.github/workflows/_test_cadence.yml
51+
with:
52+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

0 commit comments

Comments
 (0)