Repository navigation
metal: add the 128/96 flash attention kernels - #30209
Merged
ServeurpersoCom merged 1 commit intoOct 9, 2026
Merged
Conversation
ggerganov
approved these changes
Oct 9, 2026
CISC
approved these changes
Oct 9, 2026
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.
Overview
#30003 added flash attention tests with K = 128 and V = 96, and Metal crashed on them: it said it supported the pair, but had no kernel for it.
Instead of rejecting the pair (#30208), this adds the 128/96 kernels, the same way 96/64 is done (mma and vec, every K/V type Metal handles). supports_op now accepts exactly the pairs that have a kernel: K == V, plus 96/64, 128/96, 192/128, 320/256 and 576/512. The vec tuning baseline and the sparse path list get 128/96 too.
Tested on an M5 Max: test-backend-ops -o FLASH_ATTN_EXT passes 4973/4973 on Metal, the 128/96 cases run on Metal for every K/V type it supports, and 96/64, 192/128, 320/256 and 576/512 keep running on Metal. No model uses 128/96 yet, so the test suite and the CI are the coverage here.
Additional information
Supersedes #30208
Follow-up #30003
Requirements