Repository navigation
inkling2: split the loop gates' down projection across threadgroups - #107
Closed
lucasgelfond wants to merge 1 commit into
Closed
lucasgelfond wants to merge 1 commit into
lucasgelfond wants to merge 1 commit into
Conversation
Merged
3 of 4 tasks
Author
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.
I started hillclimbing decode/prefill on my base M4 32GB MacBook Pro and profiled your changes here with Metal System Trace.
As I understand it: for each token, the loop gates project a 4,608-value vector down to 64 numbers (ranks). Previously, one threadgroup did all 64 dot products serially, leaving most of the GPU idle. Now 8 threadgroups each take 8 ranks. Each rank keeps its sum order, so the output bits are unchanged. This stage goes from 16 ms to 2.2 ms per token, decode goes up 18% (11.6 → 13.8 tok/s), the token hashes are identical in every round, and prefill is the same, within noise.
This adds the suggestion on top, Lean tests and Inkling tests both pass.