Skip to content

Commit fd01e12

Browse files
committed
Merge branch 'main' into mlx-delegate-part3
2 parents 6a699b1 + 1ca85a6 commit fd01e12

325 files changed

Lines changed: 15090 additions & 2113 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/export_model_artifact.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ if [ "$MODEL_NAME" = "voxtral_realtime" ]; then
358358
STREAMING_ARG=""
359359
PREPROCESSOR_ARGS="--feature_size 128 --output_file ${OUTPUT_DIR}/preprocessor.pte"
360360
if [ "$USE_STREAMING" = "true" ]; then
361-
STREAMING_ARG="--streaming"
361+
STREAMING_ARG="--streaming --sliding-window 2048"
362362
PREPROCESSOR_ARGS="$PREPROCESSOR_ARGS --streaming"
363363
else
364364
PREPROCESSOR_ARGS="$PREPROCESSOR_ARGS --stack_output --max_audio_len 300"
@@ -424,6 +424,7 @@ if [ "$MODEL_NAME" = "qwen3_5_moe" ]; then
424424
test -f "${OUTPUT_DIR}/model.pte"
425425
test -f "${OUTPUT_DIR}/aoti_cuda_blob.ptd"
426426
ls -al "${OUTPUT_DIR}"
427+
427428
exit 0
428429
fi
429430

.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_model_e2e.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ EOF
354354
fi
355355
;;
356356
qwen3_5_moe)
357-
RUNNER_ARGS="$RUNNER_ARGS --tokenizer_path ${MODEL_DIR}/$TOKENIZER_FILE --prompt 'What is the capital of France?' --max_new_tokens 32"
357+
RUNNER_ARGS="$RUNNER_ARGS --tokenizer_path ${MODEL_DIR}/$TOKENIZER_FILE --prompt 'What is the capital of France?' --max_new_tokens 128 --temperature 0"
358358
;;
359359
voxtral_realtime)
360360
RUNNER_ARGS="--model_path ${MODEL_DIR}/model.pte --tokenizer_path ${MODEL_DIR}/$TOKENIZER_FILE --preprocessor_path ${MODEL_DIR}/$PREPROCESSOR --audio_path ${MODEL_DIR}/$AUDIO_FILE --temperature 0"

.ci/scripts/test_model_e2e_windows.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,19 @@ try {
135135
Write-Host "::group::Check CUDA toolchain"
136136
$nvccOutput = nvcc --version | Out-String
137137
Write-Host $nvccOutput
138-
nvidia-smi
138+
$nvidiaSmiCmd = Get-Command nvidia-smi -ErrorAction SilentlyContinue
139+
if ($null -eq $nvidiaSmiCmd) {
140+
Write-Host "nvidia-smi not available (command not found; driver may not be installed)"
141+
}
142+
else {
143+
try {
144+
nvidia-smi
145+
}
146+
catch {
147+
Write-Host "nvidia-smi failed (driver or GPU issue). Error details:"
148+
Write-Host $_
149+
}
150+
}
139151
if (-not [string]::IsNullOrWhiteSpace($ExpectedCudaVersion)) {
140152
$versionMatch = [Regex]::Match($nvccOutput, "release\s+(\d+\.\d+)")
141153
if (-not $versionMatch.Success) {

.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')"

.ci/scripts/wheel/test_linux.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,25 @@
1111
from examples.models import Backend, Model
1212

1313
if __name__ == "__main__":
14-
# On Linux x86_64 the wheel is built with the Qualcomm backend.
15-
# Verify that it was registered correctly.
16-
if platform.system() == "Linux" and platform.machine() in ("x86_64", "amd64"):
14+
if platform.system() == "Linux":
1715
from executorch.extension.pybindings.portable_lib import (
1816
_get_registered_backend_names,
1917
)
2018

2119
registered = _get_registered_backend_names()
20+
21+
# QNN backend is only available on x86_64.
22+
if platform.machine() in ("x86_64", "amd64"):
23+
assert (
24+
"QnnBackend" in registered
25+
), f"QnnBackend not found in registered backends: {registered}"
26+
print("✓ QnnBackend is registered")
27+
28+
# OpenVINO backend is available on all Linux architectures.
2229
assert (
23-
"QnnBackend" in registered
24-
), f"QnnBackend not found in registered backends: {registered}"
25-
print("✓ QnnBackend is registered")
30+
"OpenvinoBackend" in registered
31+
), f"OpenvinoBackend not found in registered backends: {registered}"
32+
print("✓ OpenvinoBackend is registered")
2633

2734
test_base.run_tests(
2835
model_tests=[

.ci/scripts/wheel/test_linux_aarch64.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@
1212
# coremltools does not support linux aarch64 yet and install from the source fails on runtime
1313
# https://github.com/apple/coremltools/issues/1254
1414
# https://github.com/apple/coremltools/issues/2195
15+
16+
from executorch.extension.pybindings.portable_lib import (
17+
_get_registered_backend_names,
18+
)
19+
20+
registered = _get_registered_backend_names()
21+
22+
# OpenVINO backend uses dlopen (no build-time SDK dependency), so it
23+
# is compiled into the wheel on all Linux architectures.
24+
assert (
25+
"OpenvinoBackend" in registered
26+
), f"OpenvinoBackend not found in registered backends: {registered}"
27+
print("✓ OpenvinoBackend is registered")
28+
1529
test_base.run_tests(
1630
model_tests=[
1731
test_base.ModelTest(

.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

0 commit comments

Comments
 (0)