Accelerate large-model MLX prefill - #27
Merged
Merged
Conversation
Reduce decoder prefill memory with configurable layer partitions, preserve initializer lifetimes with Plan-owned storage, materialize GQA output once, and add an opt-in BF16-I/O FP16-tile Metal QMM fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5f4a437b-39c5-44ac-9bd7-e726eed87db0
Allow builds to select MLX and mlx-c prefixes, relink dependencies by basename, and bundle optional jaccl so optimized runtime wheels remain self-contained. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5f4a437b-39c5-44ac-9bd7-e726eed87db0
🏎️ MLX EP op benchmarkMedian
base |
Owner
Author
|
A self-contained preview wheel is now available: https://github.com/justinchuby/onnxruntime-mlx/releases/tag/v0.27.3-muse-prefill-preview.1 It bundles the pinned optimized MLX + mlx-c runtime, so users do not need to wait for MLX #4216 or replace their system MLX. Enable with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ONNXRUNTIME_EP_MLX_LAYER_PARTITIONS=8selects eight transformer layers per fused partition.ONNXRUNTIME_EP_MLX_BF16_QMM_FP16=1enables the standalone stock-MLX fallback kernel. The best result below uses the private MLX kernel from ml-explore/mlx#4216 viaMLX_BF16_QMM_FP16=1.Muse-Glimmer-30B results
M1 Max 32 GB, 512-token prompt, asymmetric INT4 block 32:
The layer partitioning reduced MLX peak memory from 34.85 GiB to about 20 GiB, eliminating swap. Greedy token IDs were stable across measured runs.
Validation