Skip to content

train 1117031739: #2805 #3631 #3632 #3633 (CI only) - #3650

Closed
ashhart wants to merge 12 commits into
mainfrom
lead/train-1117031739
Closed

ashhart wants to merge 12 commits into
mainfrom
lead/train-1117031739

Conversation

@ashhart

@ashhart ashhart commented Nov 17, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #2805 #3631 #3632 #3633 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.

…grouped experts read it, routed arrays are freed

TF_FLASHNEXT_SCALE_INDEX is now on by default on GPUs without tensor units. The loader indexes every 4-bit group-32
expert projection once at load, on up to eight threads. The routed gate, up and down projections, which only expert
kernels read, release their stored scales and biases and keep the index and table in those slots; the shared
projections keep theirs beside the index, since kernels outside the expert set read them direct.

The prompt gathers (32, 64 and 128-row tiles and the fused gate/up) and the grouped expert kernels now read each
group's pair through the index, as the per-row expert kernels already did: the same two values into the same sums,
so replies keep their tokens. An index is keyed by its projection's codes buffer, and a kernel takes the indexed
form only for a projection that has one. A tensor with more pairs than a 16-bit index holds turns the index off
with a warning, as before.

The indexed gathers and the indexed grouped launches register with the kernel contract as bit-preserving
replacements of the direct reads, each with a planted control and launch records.

Refs #2751
At widths other than 4/64, wide.moe ran each (row, pick) slot in its own
threadgroup, so a window of R rows read each routed expert once per pick
and the shared expert once per row. glm_moe_rows_u runs one threadgroup a
unique expert (the route's uids, members and count) with a simdgroup per
pick, and the shared expert with a simdgroup per row, so their weights
come from memory once for every row that picked them. Each pick's sums are
the same tf_rp_rows call, so the bits are too. Windows of 2+ rows take it;
one row keeps the per-pick launch.

tf-glm-rows-check: by unique expert == by pick at q8, q4 and q2 for 2, 4
and 16 rows (456,192 bit-equal values).
A checkpoint may store layers.45.shared_head.head (a lighter copy of
lm_head, e.g. 4-bit beside an 8-bit backbone). On one Mac the loader
loads it beside lm_head and the MTP drafts project through it; lm_head
still produces every verified token, so replies are unchanged. Without
the tensor nothing changes.

8-bit GLM-5.3-Flash with the 4-bit MTP layer and head, 6 bench prompts:
12/12 replies equal to the 8-bit alone; greedy 53.0 -> 53.2-53.5 tok/s,
sampled 48.4 -> 50.1-50.3, 3.5 GB less memory.
…pt path

GLM_PROMPT_NLL=ROWS reads each prompt in chunks of ROWS through the prompt
kernels a reply's prompt runs, runs the head over every chunk row and
scores row i on token i + 1 (checks.promptNll). GLM_PROMPT_NLL_OUT=PREFIX
writes the per-token losses (f32) for paired comparisons;
GLM_PROMPT_NLL_ONLY stops before the replies.

A dev-tool per-token loss check, for comparing builds whose weights
differ; over 99,999 tokens on the 8-bit GLM its standard error was 0.067%.
@ashhart
ashhart force-pushed the lead/train-1117031739 branch from 44ab15b to 95b530f Compare November 17, 2026 03:47
@ashhart

ashhart commented Nov 17, 2026

Copy link
Copy Markdown
Owner Author

Landed: #2805 #3631 #3632 #3633 as main 15cce71. This PR only carried their CI.

@ashhart ashhart closed this Nov 17, 2026
@ashhart
ashhart deleted the lead/train-1117031739 branch November 17, 2026 04:37
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