metal: accelerate M5 Max indexed prefill - #758
Open
rinaldofesta wants to merge 1 commit into
Open
Conversation
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.
M5 Max indexed-prefill attention dropped from 88.619 to 78.608 ms/layer across 21 indexed layers. This PR also replaces the old streaming top-512 path with an exact fused two-run kernel for partial M5 prefill widths.
Changes
DS4_METAL_DISABLE_INDEXED_ATTN_DUAL_RB16=1DS4_METAL_DISABLE_TOPK_FUSED512=1Performance
Attention stage profile at 6144 tokens, 21 indexed layers:
8192-token prefill, counterbalanced pairs:
Top-512 A/B at width 2048 x 6144 rows: 4.470 to 4.209 ms median, -5.8%.
The 6144-token full-prefill runs had large thermal variation, from 503.9 to 722.6 tok/s. The candidate won both no-dump orders, but I am not using that spread for a rate claim.
Exactness and tests
0/270336mismatches, widths 1537 and 2048, unique and heavy-tie inputs, four repeats.0/2162688float mismatches against the row-1 kernel, two repeats.ef2c428e514839cf348ab445465770afe7d260197b15593cee302ea978fd77f9.git diff --check: clean.Scope
Aggregate
make teststatus remains red on this M5 Max: five fixture assertions reproduce byte-identically at clean HEAD and with both optimized paths disabled. They are the existingshort_code_completionstep-0 token/logprob cases andlong_story_4096top-5 overlap case.SSD streaming, distributed inference, and CUDA were outside this Metal-only validation run.