Skip to content

ExecuTorch MLX delegate#16718

Open
metascroy wants to merge 69 commits intomainfrom
mlx-delegate
Open

ExecuTorch MLX delegate#16718
metascroy wants to merge 69 commits intomainfrom
mlx-delegate

Conversation

@metascroy
Copy link
Contributor

@metascroy metascroy commented Jan 20, 2026

Summary

This PR adds an MLX backend for ExecuTorch, enabling Metal-accelerated inference on Apple Silicon. It runs Llama, Qwen, Gemma, Whisper, Voxtral, and Parakeet models end-to-end, with 637 passing op tests and multithreaded execution support. For many models, it offers best performance among all ExecuTorch backends on Apple Silicon, offering 2-6x speedups over what was previously possible with ExecuTorch, and up to 30% smaller model sizes compared to XNNPACK due to BF16 support and tied quantized embedding support.

The PR is large due to extensive op coverage, testing, and documentation, but almost all changes are confined to backends/mlx/. The design is described in backends/mlx/README.md.

Suggested review approach:

  1. Review files outside backends/mlx/ carefully — these integrate with ExecuTorch's build system and are the most likely to need changes.
  2. For backends/mlx/, focus on structural design (see README) and test coverage (CI job is .github/workflows/mlx.yml)

Prerequisite PRs

These fixes were developed alongside the MLX backend. Once merged, this PR can be rebased to remove the duplicated changes:

  • #17257 — Improve lowering time with NamedDataMap
  • #17679 — Allow transform passes in etLLM
  • #17678 — Fix dynamic shape bug in remove_noop_pass
  • #17378 — Fix pocketfft intermittent bus errors on macOS (upstream fix)

Tests

CI is defined in .github/workflows/mlx.yml:

  • test_ops.py: 637 passing op tests
  • Multithreading: launches models on 50 threads, verifies correctness
  • GenAI E2E: parakeet, voxtral, etLLM (stories110m), HF LLMs (llama, qwen, gemma)
  • backend-tester: 380 passed, 1 failed, 86 skipped operator tests; 34 passed, 3 failed, 5 skipped model tests

The 1 failing operator test is a test-side issue being fixed in #17539. The 3 failing model tests will be addressed in follow-ups — they are not an initial focus compared to the GenAI models above.

@pytorch-bot
Copy link

pytorch-bot bot commented Jan 20, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/16718

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 Cancelled Jobs

As of commit 240b241 with merge base 3319157 (image):

CANCELLED JOBS - The following jobs were cancelled. Please retry:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 20, 2026
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@metascroy metascroy changed the title [draft] MLX delegate ExecuTorch MLX delegate Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant