Repository navigation
perf(core): prefetch tiles in the tiled matmuls, and flash attention with 8-key blocks and paired GQA heads - #105
Merged
Conversation
chmjkb
requested changes
Nov 6, 2026
chmjkb
approved these changes
Nov 9, 2026
xxpopielxx
force-pushed
the
perf/flash-attention-prefetch
branch
from
November 10, 2026 17:49
3411331 to
aee26a2
Compare
… kernels matmulTiledVec4 and matmulQuantTiled load tile t + 1 while tile t computes. The same values go through the same math, so outputs are bit-identical.
… workgroup With 8 lanes and heads up to 128 values, blocks take 8 keys so the scores stay in registers, and two query heads on one kv head share a workgroup, so each key and value block feeds both. 4 lanes and wider heads keep their blocks and one head per workgroup.
xxpopielxx
force-pushed
the
perf/flash-attention-prefetch
branch
from
November 12, 2026 13:30
aee26a2 to
f879680
Compare
4 of 11 tasks
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.
Description
Two kernel speedups, stacked on #97 (it touches the same matmul kernels).
matmulTiledVec4,matmulQuantTiled): each thread loads the next tile into registers while the current one computes. Same values, same math, so outputs are bit-identical.attnFlash), with 8 lanes and heads up to 128 values:Introduces a breaking change?
Type of change
Testing instructions
pnpm typecheck,pnpm lint,pnpm --filter runntime testpnpm --filter runntime bench:ab kernels -b feat/quant-conv -k matmul,conv,attentionNew tests and bench cases:
SDPA_OPTIONS: three query heads per kv head (6/2, sinks, causal), run on every prefill route.A/B against #97 (M2 Pro): 115 cases, 28 faster, none slower. Matmul and conv outputs are bit-identical.
End to end (zoo models, M2 Pro, median wall time):
Screenshots
N/A
Related issues
Stacked on #97.
Checklist
Additional notes