Repository navigation
metal row projection: the wide kernel from 8 rows on tensor-unit Macs (refs #3396) - #4617
Merged
Merged
Conversation
This was referenced Nov 22, 2026
Owner
Author
|
M5 Ultra A/B (Qwen3.8 Flash Next MLX 4-bit with its MTP head; base = main, new = this PR; three runs each arm, order base new new base base new), aggregate tok/s:
Seven of eight cells gain 1-3%. The one dip (chat, temperature 1, 2 streams) has runs that overlap on both sides (base 189-208, new 193-200), so it reads as noise. That matches #3396: on tensor-unit Macs the 4-row cutover cost 2- and 4-stream throughput, and taking the wide kernel from 8 rows gives a little back.
|
This was referenced Nov 22, 2026
On chips with tensor units, every window of 4 or more rows took the 8-row kernel, which is slower at 4 rows (#3396). Windows now take the wide kernel from a cutover in a table keyed by GPU generation. The table starts at 8 rows for generation 17 and needs confirming on an M5 with tf-row-cutover, which times both kernels at 1 to 32 rows and checks their bytes are equal. Chips before generation 17 keep the narrow kernels. Both kernels compute each row with the same operations in the same order, so output does not change. The two dispatch tests now skip on inert pipeline stand-ins, which have no id.
row_projection.wideFrom takes the device's u32 generation; the stub returned usize, so test-qwen27-quant-host and the host test build stopped compiling on Linux.
ashhart
force-pushed
the
lead/m5-row-cutover
branch
from
November 22, 2026 18:36
318903a to
b0e75b4
Compare
ashhart
added a commit
that referenced
this pull request
Nov 22, 2026
ashhart
added a commit
that referenced
this pull request
Nov 22, 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.
Refs #3396.
What this changes
On Macs with tensor units (M5 and later, GPU generation 17+), row projections switched to the wide kernel at 4 rows. #3396 reports sampled throughput on an M5 Max falling at 2 and 4 streams since then. The cutover is now a per-generation table: generation 17 and later take the wide kernel from 8 rows, the first width where it runs its full 8-row step; earlier chips never take it, as before.
callandcallStridedshare one rule (takesWide); indexed calls are unchanged.Each row gets the same group sum, the same scaled input, the same dot and accumulation and the same output rounding on both kernels (
row_projection.metal), so replies keep their tokens.A
tf-row-cutoverbench times both kernels at 1 to 32 rows for all six code widths, stops if their bytes differ, and prints each width's cutover, so the table can be set from measurement on each chip.Checks
test-row-projection-host; fmt, ast-check, the 600-line cap; no pinned file changed.Still to run
The model in #3396 (Flint) on an M5 Max at 2 and 4 sampled streams; we don't hold it here.