Skip to content

Commit 6879c80

Browse files
committed
Update
[ghstack-poisoned]
2 parents 6924d32 + 1de0fe8 commit 6879c80

122 files changed

Lines changed: 9022 additions & 1812 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.

.github/workflows/_test_arduino_library.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ jobs:
8989
cp ../../LICENSE arduino_lib/ExecuTorch/LICENSE
9090
cp README.md arduino_lib/ExecuTorch/README.md
9191
(cd arduino_lib/ExecuTorch && arduino-lint \
92-
--project-type library --library-manager submit --compliance strict)
92+
--project-type library --library-manager update --compliance strict)

.github/workflows/build-cmsis-pack.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ on:
2222
paths:
2323
- .github/workflows/build-cmsis-pack.yml
2424
- backends/arm/cmsis_pack/**
25-
- backends/arm/cmsis_pack/scripts/**
2625
- backends/arm/runtime/**
2726
- backends/cortex_m/**
2827
- kernels/portable/**
@@ -33,7 +32,6 @@ on:
3332
paths:
3433
- .github/workflows/build-cmsis-pack.yml
3534
- backends/arm/cmsis_pack/**
36-
- backends/arm/cmsis_pack/scripts/**
3735
workflow_dispatch:
3836
inputs:
3937
version_override:
@@ -80,7 +78,9 @@ jobs:
8078
# Stage 1: Build core ExecuTorch with arm-none-eabi-gcc
8179
# This generates required headers (flatbuffers, schema)
8280
backends/arm/scripts/build_executorch.sh
83-
CMAKE_BUILD_DIR="$(pwd)/cmake-out-arm"
81+
# Must match build_executorch.sh's output dir (et_build_root/cmake-out);
82+
# copy_sources.sh hard-fails if the generated schema headers are absent.
83+
CMAKE_BUILD_DIR="$(pwd)/arm_test/cmake-out"
8484
echo "::endgroup::"
8585
8686
echo "::group::Determine pack version"

.github/workflows/mlx.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
- extension/llm/export/**
1515
- extension/audio/**
1616
- examples/models/gemma4_31b/**
17+
- examples/models/muse-glimmer/**
1718
- examples/models/parakeet/**
1819
- examples/models/voxtral_realtime/**
1920
- examples/models/qwen3_5_moe/**
@@ -90,6 +91,7 @@ jobs:
9091
backends/mlx/test/test_slot_recycling.py \
9192
backends/mlx/test/test_sample.py \
9293
examples/models/gemma4_31b/tests/test_mlx_pipeline.py \
94+
examples/models/muse-glimmer/tests/test_mlx_pipeline.py \
9395
-v
9496
echo "::endgroup::"
9597
@@ -192,6 +194,52 @@ jobs:
192194
echo "Success: built $RUNNER"
193195
echo "::endgroup::"
194196
197+
# Build-only: the Muse Glimmer GGUF checkpoints are far too large to export in
198+
# CI, so this covers the compile / link / metallib wiring of the runners --
199+
# which is what MLX backend changes are most likely to break.
200+
test-mlx-muse-glimmer-build:
201+
needs: run-decision
202+
if: |
203+
github.event_name == 'pull_request' ||
204+
needs.run-decision.outputs.is-full-run == 'true'
205+
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
206+
with:
207+
default-packages: ""
208+
job-name: test-mlx-muse-glimmer-build
209+
runner: macos-14-xlarge
210+
python-version: "3.12"
211+
submodules: recursive
212+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
213+
timeout: 90
214+
script: |
215+
set -eux
216+
217+
echo "::group::Install ExecuTorch"
218+
${CONDA_RUN} python install_executorch.py > /dev/null
219+
echo "::endgroup::"
220+
221+
${CONDA_RUN} pip list
222+
223+
echo "::group::Build Muse Glimmer runners and worker with MLX"
224+
${CONDA_RUN} make muse-glimmer-mlx
225+
BIN_DIR=cmake-out/examples/models/muse-glimmer
226+
for bin in solo_runner dflash_runner muse_glimmer_worker; do
227+
if [ ! -x "${BIN_DIR}/${bin}" ]; then
228+
echo "Failed: ${bin} not found at ${BIN_DIR}/${bin}"
229+
exit 1
230+
fi
231+
done
232+
# Runtime kernel load falls back to an absolute build-tree path, so a
233+
# missing colocated metallib only breaks a relocated binary. Assert the
234+
# copy so the runners stay self-contained (needs EXECUTORCH_BUILD_MLX=ON
235+
# in the preset, which drives executorch_target_copy_mlx_metallib).
236+
if [ ! -f "${BIN_DIR}/mlx.metallib" ]; then
237+
echo "Failed: mlx.metallib not copied next to the runners"
238+
exit 1
239+
fi
240+
echo "Success: built solo_runner, dflash_runner and muse_glimmer_worker"
241+
echo "::endgroup::"
242+
195243
backend-tester:
196244
needs: run-decision
197245
if: |

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
#
9292
# ==============================================================================
9393

94-
.PHONY: voxtral-cuda voxtral-cpu voxtral-metal voxtral-mlx voxtral_realtime-cuda voxtral_realtime-cpu voxtral_realtime-metal voxtral_realtime-mlx voxtral_tts-cpu voxtral_tts-cuda whisper-cuda whisper-cuda-debug whisper-cpu whisper-metal parakeet-cuda parakeet-cuda-debug parakeet-cpu parakeet-metal parakeet-mlx parakeet-vulkan dinov2-cuda dinov2-cuda-debug sortformer-cuda sortformer-cpu silero-vad-cpu llama-cuda llama-cuda-debug llama-cpu lfm_2_5-mlx llava-cpu gemma3-cuda gemma3-cpu gemma4_31b-cuda gemma4_31b-mlx muse-glimmer-cuda qwen3_5_moe-cuda qwen3_5_moe-metal qwen3_5_moe-mlx clean help
94+
.PHONY: voxtral-cuda voxtral-cpu voxtral-metal voxtral-mlx voxtral_realtime-cuda voxtral_realtime-cpu voxtral_realtime-metal voxtral_realtime-mlx voxtral_tts-cpu voxtral_tts-cuda whisper-cuda whisper-cuda-debug whisper-cpu whisper-metal parakeet-cuda parakeet-cuda-debug parakeet-cpu parakeet-metal parakeet-mlx parakeet-vulkan dinov2-cuda dinov2-cuda-debug sortformer-cuda sortformer-cpu silero-vad-cpu llama-cuda llama-cuda-debug llama-cpu lfm_2_5-mlx llava-cpu gemma3-cuda gemma3-cpu gemma4_31b-cuda gemma4_31b-mlx muse-glimmer-cuda muse-glimmer-mlx qwen3_5_moe-cuda qwen3_5_moe-metal qwen3_5_moe-mlx clean help
9595

9696
help:
9797
@echo "This Makefile adds targets to build runners for various models on various backends. Run using \`make <target>\`. Available targets:"
@@ -130,6 +130,7 @@ help:
130130
@echo " gemma4_31b-cuda - Build Gemma 4 31B runner and worker with CUDA backend"
131131
@echo " gemma4_31b-mlx - Build Gemma 4 31B runner and worker with MLX backend"
132132
@echo " muse-glimmer-cuda - Build Muse Glimmer runners and worker with CUDA backend"
133+
@echo " muse-glimmer-mlx - Build Muse Glimmer runners and worker with MLX backend"
133134
@echo " qwen3_5_moe-cuda - Build Qwen3.5 MoE runner with CUDA backend"
134135
@echo " qwen3_5_moe-metal - Build Qwen3.5 MoE runner with Metal backend"
135136
@echo " qwen3_5_moe-mlx - Build Qwen3.5 MoE runner with MLX backend"
@@ -453,6 +454,17 @@ muse-glimmer-cuda:
453454
@echo " DFlash runner: cmake-out/examples/models/muse-glimmer/dflash_runner"
454455
@echo " Worker: cmake-out/examples/models/muse-glimmer/muse_glimmer_worker"
455456

457+
muse-glimmer-mlx:
458+
@echo "==> Building and installing ExecuTorch with MLX..."
459+
cmake --workflow --preset mlx-release
460+
@echo "==> Building Muse Glimmer runners and worker with MLX..."
461+
cd examples/models/muse-glimmer && cmake --workflow --preset muse-glimmer-mlx
462+
@echo ""
463+
@echo "✓ Build complete!"
464+
@echo " Solo runner: cmake-out/examples/models/muse-glimmer/solo_runner"
465+
@echo " DFlash runner: cmake-out/examples/models/muse-glimmer/dflash_runner"
466+
@echo " Worker: cmake-out/examples/models/muse-glimmer/muse_glimmer_worker"
467+
456468
gemma4_31b-cuda:
457469
@echo "==> Building and installing ExecuTorch with CUDA..."
458470
cmake --workflow --preset llm-release-cuda

backends/arm/_passes/fold_qdq_with_annotated_qparams_pass.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,13 @@ def call(self, graph_module: GraphModule) -> PassResult: # noqa: C901
405405

406406
input_qparams: dict[int, QuantArgs] = {}
407407
input_nodes_to_remove: dict[int, set[Node]] = {}
408+
input_nodes_seen: set[Node] = set()
408409
for i, arg in enumerate(n.args):
409410
qparams, nodes_to_remove = self._extract_arg_input_params(arg)
410411
if qparams is not None:
411412
input_qparams[i] = qparams
412-
input_nodes_to_remove[i] = nodes_to_remove
413+
input_nodes_to_remove[i] = nodes_to_remove - input_nodes_seen
414+
input_nodes_seen.update(nodes_to_remove)
413415

414416
preserve_qdq = self._has_partial_binary_tensor_qdq_inputs(n, input_qparams)
415417
graph_modified = graph_modified or not preserve_qdq

backends/arm/cmsis_pack/contributions/add/Documentation/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ This pack provides:
2828
- component: Machine Learning:ExecuTorch:Runtime
2929
- component: Machine Learning:ExecuTorch:Kernel Utils
3030

31-
# Backend (choose one or more)
32-
- component: Machine Learning:ExecuTorch:Backend::EthosU
31+
# Backend (choose one or more). CMSIS component IDs use a single
32+
# colon between Cclass / Cgroup / Csub, with a space (not "::")
33+
# inside the Csub name.
34+
- component: Machine Learning:ExecuTorch:Backend EthosU
3335
# or
34-
- component: Machine Learning:ExecuTorch:Backend::CortexM
36+
- component: Machine Learning:ExecuTorch:Backend CortexM
3537
```
3638
3739
3. Include ExecuTorch headers in your code:

backends/arm/cmsis_pack/scripts/build_pack.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,21 @@ cd "$PACK_BUILD"
107107
if command -v zip &> /dev/null; then
108108
zip -r "$PACK_FILE" . -x "*.DS_Store" -x ".git*" -x "*/generated/*" -x "*.py"
109109
else
110-
python3 -c "
111-
import zipfile, os
112-
with zipfile.ZipFile('$PACK_FILE', 'w', zipfile.ZIP_DEFLATED) as zf:
110+
# Pass $PACK_FILE as sys.argv[1] so the path is safe against
111+
# shell-special characters (single quotes in particular).
112+
python3 - "$PACK_FILE" <<'PYEOF'
113+
import sys, zipfile, os
114+
pack_file = sys.argv[1]
115+
with zipfile.ZipFile(pack_file, 'w', zipfile.ZIP_DEFLATED) as zf:
113116
for root, dirs, files in os.walk('.'):
114117
dirs[:] = [d for d in dirs if not d.startswith('.') and d != 'generated']
115118
for f in files:
116119
if f.startswith('.') or f == '.DS_Store' or f.endswith('.py'):
117120
continue
118121
p = os.path.join(root, f)
119122
zf.write(p, os.path.relpath(p, '.'))
120-
print(f'Created: $PACK_FILE')
121-
"
123+
print(f'Created: {pack_file}')
124+
PYEOF
122125
fi
123126

124127
echo ""

backends/arm/cmsis_pack/scripts/copy_sources.sh

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Usage:
1515
# ./copy_sources.sh --executorch-root <path> --build-dir <path> \
1616
# --pack-staging <path>
17-
set -e
17+
set -euo pipefail
1818

1919
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2020
PACK_DIR="$(cd "$SCRIPT_DIR/../../cmsis_pack" && pwd)"
@@ -115,7 +115,7 @@ cp -r "${PACK_SRC}/src/kernels" "${PACK_SRC}/include/executorch/"
115115

116116
echo " Copying extension sources..."
117117
mkdir -p "${PACK_SRC}/src/extension"
118-
for d in data_loader memory_allocator runner_util; do
118+
for d in data_loader memory_allocator runner_util tensor; do
119119
if [[ -d "${EXECUTORCH_ROOT}/extension/$d" ]]; then
120120
cp -r "${EXECUTORCH_ROOT}/extension/$d" "${PACK_SRC}/src/extension/"
121121
fi
@@ -138,6 +138,18 @@ for candidate in \
138138
break
139139
fi
140140
done
141+
# A pack without the generated flatbuffers schema headers compiles nothing:
142+
# every consumer fails at executorch/schema/program_generated.h. Fail here
143+
# rather than shipping a broken archive.
144+
for required in program_generated.h scalar_type_generated.h; do
145+
if [[ ! -f "${PACK_SRC}/src/schema/${required}" ]]; then
146+
echo "ERROR: ${required} not found in the CMake build tree." >&2
147+
echo " Looked in: ${BUILD_DIR}/schema/include/executorch/schema" >&2
148+
echo " Run the ExecuTorch CMake configure+build first so BUILD_DIR" >&2
149+
echo " contains the generated schema headers (see build_pack.sh -h)." >&2
150+
exit 1
151+
fi
152+
done
141153
cp -r "${PACK_SRC}/src/schema" "${PACK_SRC}/include/executorch/"
142154

143155
echo " Copying generated flatbuffers headers..."
@@ -150,14 +162,27 @@ for candidate in \
150162
break
151163
fi
152164
done
165+
# Same rule as the schema headers: the pack bundles flatbuffers/, and the
166+
# runtime does not compile without it. Refuse to produce a pack missing it.
167+
if [[ ! -f "${PACK_SRC}/include/flatbuffers/flatbuffers.h" ]]; then
168+
echo "ERROR: flatbuffers headers not found in the CMake build tree." >&2
169+
echo " Looked in: ${BUILD_DIR}/third-party/{flatbuffers,flatc_ep}/include" >&2
170+
echo " Run the ExecuTorch CMake configure+build first so BUILD_DIR" >&2
171+
echo " contains the flatc external-project headers." >&2
172+
exit 1
173+
fi
153174

154-
# Flatbuffers headers are redistributed inside the pack; ship the
155-
# upstream Apache-2.0 LICENSE alongside per its terms.
156-
if [[ -f "${EXECUTORCH_ROOT}/third-party/flatbuffers/LICENSE" ]] \
157-
&& [[ -d "${PACK_SRC}/include/flatbuffers" ]]; then
158-
cp "${EXECUTORCH_ROOT}/third-party/flatbuffers/LICENSE" \
159-
"${PACK_SRC}/include/flatbuffers/LICENSE"
175+
# Flatbuffers headers are redistributed inside the pack, so shipping the
176+
# upstream Apache-2.0 LICENSE alongside them is a condition of that
177+
# redistribution -- a pack without it must not be published.
178+
if [[ ! -f "${EXECUTORCH_ROOT}/third-party/flatbuffers/LICENSE" ]]; then
179+
echo "ERROR: third-party/flatbuffers/LICENSE not found in the source tree." >&2
180+
echo " The pack redistributes the flatbuffers headers and must ship" >&2
181+
echo " their licence. Run: git submodule update --init third-party/flatbuffers" >&2
182+
exit 1
160183
fi
184+
cp "${EXECUTORCH_ROOT}/third-party/flatbuffers/LICENSE" \
185+
"${PACK_SRC}/include/flatbuffers/LICENSE"
161186

162187
echo " Creating c10 and torch include paths..."
163188
C10_DIR="${PACK_SRC}/src/runtime/core/portable_type/c10/c10"

0 commit comments

Comments
 (0)