Repository navigation
Conversation
ashhart
force-pushed
the
lead/glm-longctx
branch
from
November 17, 2026 01:00
470677e to
7190b2e
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).
…and windowed KDA step under Unreleased
…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.
ashhart
force-pushed
the
lead/glm-longctx
branch
from
November 19, 2026 04:46
7190b2e to
f9fc689
Compare
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: two exact kernel speedups for long-context decode, plus a measurement tool. Every output bit is unchanged.
Where long-context decode time goes (M5 Ultra, 90,044-token prompt against a 36-token one):
Changes:
glm_index_select's lists on an M5 Max and an M5 Ultra (real scores, ties, NaN, ±0, infinities, ramps, a hot span, a constant row, a forced fallback; 15 positions; 1, 3 and 16 rows).mla_selectknock-out, andtf-glm-index-speedchecks and times it. Behaviour is unchanged unless the profile sets it.Measured round GPU time at 90K (alternated base, after select, after KDA, base):
Served: base == tip on 54 of 54 replies (16 bench prompts plus a 90K and a short prompt, each greedy, sampled and
"draft": false). Drafted greedy =="draft": falseon 18 of 18. Served tok/s moved within noise (plain at 90K 67.26 to 67.79). Saved GLM prompt states are recomputed once after upgrading, since kernel sources changed.Tests: both check tools pass on both Macs. All Metal runtime source libraries compile. Lean finds nothing new.