Repository navigation
Conversation
ashhart
force-pushed
the
lead/glm-decode-kernels
branch
from
November 15, 2026 15:42
3f59878 to
4069c28
Compare
…peed times the indexer at long positions
…ed floor marks candidates, a merge selects among them), the same lists as glm_index_select tf-glm-index-speed checks the new select against glm_index_select on real scores, ties, NaNs, signed zeros, infinities, ramps, a hot span, a constant row and a row whose sampled blocks score high (the floor overshoots, so the row is selected whole) at 15 positions and 1, 3 and 16 rows: 405 of 405 cases give the same lists. On an M5 Max, a row at 90,000 tokens selects in 13.3 us instead of 26.6 us, at 120,000 in 13.3 us instead of 33.2 us.
…s at once, then the recurrence alone, kda_rows' values glm_kda_window has kda_rows' buffers and arithmetic for every value; windows of two or more rows take it, one-row steps keep kda_rows. tf-glm-kda-speed checks its outputs, final state and conv window against kda_rows' bit for bit at 1 to 16 rows on three draws of inputs, for all 64 heads and TP2's 32: 96 of 96 cases are the same. On an M5 Max a 4-row step takes 27.5 us instead of 34.3 us, a 16-row step 79.2 us instead of 106.3 us.
…x_select keeps rows of 3,073 to 8,192 blocks The mark groups load their 16 words a simdgroup before the first compare, and the merge loads its candidates' scores at once. On an M5 Ultra the mark took 8.3 us against 5.3 on an M5 Max, so the sampled floor pays only past 8,192 blocks (32,768 tokens); up to there glm_index_select's one group a row stays. tf-glm-index-speed: 405 of 405 cases give glm_index_select's lists; the speed tools warm the GPU before timing. On an M5 Max a row at 90,000 tokens now selects in 11.8 us (26.6 us before the new select).
…p against glm_index_select and kda_rows, with controls and launch records The merge within 3,072 blocks and the mark and merge past 8,192 blocks (to rows past 65,536 blocks) run the loader's glm_select.metal beside glm_index_select on the same scores; glm_kda_window and glm_kda_window_tp beside kda_rows and kda_rows_tp at 2 to 16 rows. Gates 1-3 require the predecessor's bytes in every written buffer; each entry has a planted source fault red at shapes. glm_launch_records.zig holds the four launches with this GPU's threadgroup bytes and the M1/M2 limits from --offline.
…ll of them, each row the one-row launches' bits; tf-glm-attn-rows checks and times them
… and four down outputs from 2 rows, the generated kernels' bits; tf-glm-moe-rows checks and times the shapes
… sums on six threadgroups for windows up to 4 rows, the same sums; tf-glm-hc-rows checks and times it
…apes against main's launches, with controls and launch records attendRows (glm_latent_scores_rows, glm_softmax_rows, glm_latent_values_rows) runs beside main's one-row scores, softmax and values a row (a frozen glm_attn.metal) at 1 to 16 rows and 1 to 2,048 keys. core/hc.zig's boundary, with tf_hc_expand_mix_parts and tf_hc_first_mix_parts to 4 rows, runs beside main's expand and split (a frozen hc_boundary.metal) for separate streams, in place and at a first read, post and comb compared as raw words. The decode experts at moe.zig's outputs a simdgroup run beside the four-output gathers at 1 to 8 rows. Gates 1-3 require the predecessor's bytes; seven controls plant source faults red at shapes. The records add every launch with this GPU's threadgroup bytes and the M1/M2 limits from --offline.
…h or the head, never the path; rows as a list
ashhart
force-pushed
the
lead/glm-decode-kernels
branch
from
November 18, 2026 19:24
4069c28 to
c76b958
Compare
This was referenced Nov 19, 2026
Owner
Author
|
This change landed on main with #3458 (merged 19 Nov), in commits
|
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.
GLM-5.3-Flash on Metal: faster decode windows of 2-4 rows, and every output bit is unchanged.
Byte budget for a 1-row window (M5 Ultra, each launch class run alone over every layer):
Changes:
GLM_PROFILE_ROWStakes a list.Exactness:
tf-glm-attn-rows: 13.5M outputs bit-identical across 18 cases (1-2,048 keys, 1-16 rows, both size boundaries).tf-glm-moe-rows: 4.1M outputs equal across all four shapes.tf-glm-hc-rows: 1.42M outputs bit-identical at 1-16 rows.tf-glm-runat 100-2,600-token prompts matched base token for token, and depth 3 matched depth 0.Measured on an M5 Ultra (16 bench prompts, 512 tokens, base, tip, tip, base):
"draft": false"draft": falseon 16/16 prompts in all four arms.Checks: lean finds nothing new.
test-glm-window-contract-host,test-glm-contract-hostand the GLM runtime-source compile gate pass.Stacked on #3403.