Repository navigation
Use split-KV lane attention for FP16-cache decode on Metal (Granite, Llama Q8_0/Q4_0, 64-wide heads) #291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Use split-KV lane attention for FP16-cache decode on Metal (Granite, Llama Q8_0/Q4_0, 64-wide heads) #291
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fedc487
Run Granite's FP16-cache decode attention on the split-KV lane kernel
stratika 175c8f3
Split the FP16 KV cache's decode attention on Metal for Llama Q8_0/Q4_0
stratika fd39423
Use the 64-wide lane attention kernel on Metal
stratika 3af0283
Address the review of the Metal split-KV change
stratika 6d018e8
Reflow GpuFp16KvLlama3BAccelTest's class comment for the formatter
stratika e3e6ec5
Sort the WorkerGrid imports in LaneAttentionAccelTest for the formatter
stratika File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this copies
AbstractTransformerLayerTaskGraphs.laneAttention(int)except for the scaled policy call. That's fine for now, but the two copies can drift apart if the packed-half2 condition ever changes. A base-class variant that takes the policy predicate would keep them in one place.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 3af0283:
AbstractTransformerLayerTaskGraphs.laneAttention(int headSize, IntPredicate kernelFor)holds the FP16-cache and packed-half2 conditions, andlaneAttention(int)passesLaneAttentionPolicy::laneCooperativeAttention.GraniteFP16FFNLayersandGraniteQ8_0FFNLayers(which had a second copy) passLaneAttentionPolicy::scaledLaneCooperativeAttention.