Skip to content

inkling2: split the loop gates' down projection across threadgroups - #107

Closed
lucasgelfond wants to merge 1 commit into
BlivionIaG:work/inkling2-mini-metal-4bitfrom
lucasgelfond:inkling2-gate-down-split
Closed

lucasgelfond wants to merge 1 commit into
BlivionIaG:work/inkling2-mini-metal-4bitfrom
lucasgelfond:inkling2-gate-down-split

Conversation

@lucasgelfond

@lucasgelfond lucasgelfond commented Nov 21, 2026 •

Copy link
Copy Markdown

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.

@lucasgelfond

Copy link
Copy Markdown
Author

Folded into work/inkling2-mini-metal-4bit as 8d54caf; the contract fix is in #108.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant