Metal: correctness-gate M5 Max 4096 prefill (+5%)#149
Open
fitchmultz wants to merge 2 commits into
Open
Conversation
Author
|
Opened a stacked follow-up for the M5 Max decode-indexer tuning: #169. It depends on this PR and includes a clean stacked diff plus local correctness/benchmark evidence (+15–18% generation t/s, prefill neutral). I kept this PR unchanged. |
Author
|
Rebased this PR onto current upstream |
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.
Result
This PR rebases the Apple M5 Max 4096-prefill correctness/scheduling work onto current upstream
main(613e9b2at benchmark/rebase time). Non-M5 devices keep the existing 2048-token default.Fresh paired comparison against current
antirez/mainon an Apple M5 Max 128GB machine, Metal backend,ds4flash.gguf:The safe claim for this PR is: it enables and correctness-gates the M5 Max 4096-token prefill path, with a small 4096-sweep prefill win in this fresh run and otherwise neutral throughput. The larger decode win is kept separate in follow-up #169.
What changed
DS4_METAL_PREFILL_CHUNK=2048forces the previous M5 Max chunk size. Values above 4096 still requireDS4_METAL_ALLOW_UNSAFE_PREFILL_CHUNK=1on the M5 Max default path.Correctness
Passed locally on Apple M5 Max, 128GB RAM, Metal backend,
ds4flash.gguf, after rebasing to current upstreammain:make testcovers:--long-context--tool-call-quality--logprob-vectors--metal-kernels--serverEval parity check
Deterministic 12-question
ds4-evalslice against current upstreammainproduced identical grading decisions and token counts on both branches:antirez/main613e9b2b3d2665The same two cases failed on both branches with the same extracted answers, so this eval slice shows no quality regression.
Benchmark commands
4096-step sweep:
README-shaped 65k sweep:
Memory
The 4096 default increases Metal context-buffer allocation but keeps it modest for the tested M5 Max class machine.
From
ds4-benchcontext buffer reporting at the README 65k allocation:That is about +0.4 GiB. Other devices keep the old 2048 default.
Scope notes
This PR is intentionally limited to runtime Metal changes and the M5 Max prefill default. The decode-indexer speedup is kept in #169.