Skip to content

GLM-5.3-Flash on CUDA: a decode window's DSA index scores on tf_glm_index_scores (TF_GLM_DSCORES) - #3689

Merged
ashhart merged 7 commits into
ashhart:mainfrom
Bizuayeu:pr/glm-dscores
Nov 21, 2026
Merged

ashhart merged 7 commits into
ashhart:mainfrom
Bizuayeu:pr/glm-dscores

Conversation

@Bizuayeu

@Bizuayeu Bizuayeu commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Rebased onto #3776 (20 Nov). This head is this change's four commits on #3776, which made GLM's decode kernels dependent launches and changed glm_index_scores.cuh, the kernel this change sends decode windows to, so the receipts were taken again on the new base: TP=3 on 20 Nov, TP=4 and TP=2 on the night to 21 Nov. The TP=4, TP=2 and TP=3 tables below and On the head rebased onto #3776 are this head's; the details that name another binary (the switch's runs, the first three commits, the one-GPU bench) are as before. The earlier base's sets (main e86a0bed1d) are folded at the end of Checks on the earlier head, where "this head" names the earlier head, as those checks say. All three are on main b0b17e8962. Since then main has taken #3249, which keeps each decode window width's faster expert form; this head merges onto today's main (46c6ee229d) without a conflict. If you want the receipts on today's main, I'll take them again there.

On GB10 (sm_121), a decode window of 8 to 63 rows over 64 or more 64-pool blocks (from about 16K tokens), or of 4 to 7 rows over 2,048 or more (from about 512K tokens), now computes its DSA index scores with tf_glm_index_scores, the prompt indexer's kernel (8 rows a CTA, each key tile staged once for all of them), instead of tf_glm_scores (a CTA for each row and 64-pool block). Drafted decode's verify rounds are such windows. The scores are tf_glm_scores' bytes. Against main at TP=4 on the same boxes, checkpoint and settings, drafted decode after a 1,040,384-token prompt is 13.5% faster, in the same rounds and with the same tokens:

TP=4 (ring, gather), drafted decode after a 1,040,384-token prompt, tok/s main this head main this head main this head main
3 reps of 512 tokens 151.07 / 151.34 / 151.24 171.63 / 171.55 / 172.17 152.81 / 151.51 / 151.12 172.12 / 171.49 / 171.55 151.75 / 151.11 / 151.20 171.62 / 171.12 / 170.84 141.85 / 141.53 / 150.65

Each rep resumes the cached prompt and decodes 512 greedy tokens with drafts on (MTP and copies). This head's median, 171.55 tok/s, is 13.5% above the median of main's 12 reps, 151.16; this head's slowest rep, 170.84, is above main's fastest, 152.81. Every rep took 32 rounds, and every rep's tokens are the same, in the two uncounted timed starts too. Every rep drafted 508 tokens and accepted 480 but one of main's, the first of its second run, which drafted 507 and accepted 479 (the record doesn't say in which round); without it, main's median is 151.12 and this head is 13.5% above it. Main's slowest reps, 141.85 and 141.53, are the first two of its fourth run; without that run, this head is 13.4% above main. Without drafts every decode window is one row, which keeps tf_glm_scores in both binaries: the grid of long contexts (4K to 1016K, 1, 4 and 8 streams, "draft": false) is the rest of the step, its geometric mean over the 12 cells 47.838, 47.806 and 47.814 ms in this head's runs against main's 47.851, 47.861, 47.831 and 47.856 (the cells in the details).

Why a rep can draft one token fewer

How many tokens a round drafts is priced as the server runs, not only from the prices timed at a binary's first start. lanes/config.zig's timed, on by default and left on by GLM's serving, says what turning it off gives: "rounds priced from the cost tables alone, no wall clock (a request drafts the same whatever the load or the requests before it)". With it on, lanes/engine.zig hands each drafted round's measured time to the depth rule (observeOverhead), and Rule.overheadMs in lanes/depth.zig prices the next rounds' drafts from it. These runs aligned the prices timed at start (main's record in every counted start), but the part learned from measured rounds lives in the running server and can't be aligned between starts, so a round whose choice sits at a border can draft one fewer after rounds that ran a little long. The target verifies every draft greedily, so the drafts change how much a round does, never the tokens: the 27 reps have one token_sha256. The record doesn't say which round of main's second run's first rep drafted one fewer, so this is how it can happen, not a measured cause. On the earlier base, the second rep drafted 507 and accepted 479 in every run of both binaries.

The first three commits took every window of 8 rows or more. At TP=3, at the release's settings, they ran 4 drafted streams of short prompts about 1% slower than main in each of three sets of five runs, with the same tokens a round and a longer round. A one-GPU bench of the two kernels (a pass reads 11 key caches in turn, as GLM-5.3-Flash's 11 MLA layers do) then found tf_glm_index_scores at a decode window's tiling slower than tf_glm_scores for 8 and 16 rows up to 8K tokens, by 0.02 to 0.045 ms a pass, level at 16K, and faster from 64K (table in the details). The fourth commit keeps windows under 64 blocks (16K tokens) on tf_glm_scores.

On this head, at TP=2 and TP=3 at the release's settings, seven counted runs each (main, this head, main, this head, main, this head, main, each a fresh start, 60 s apart), after one uncounted start of each binary that timed its own window and draft prices; every counted start of both binaries kept main's record, so the binaries differ only in code (Receipt, below). TP=3 ran on 20 Nov and TP=2 on the night to 21 Nov. By the rule below, no row of either is slower. At TP=2 one row the gate counts is below main's lowest run and inside the threshold, so not slower by the rule: decode at 4 streams, a stream's tok/s, 17.8, 17.9 and 17.6 against main's 17.8 to 18.0 (+0.74%, against main's range of 1.12%). That cell is the median of 12 values (3 reps of 4 streams), rounded to 0.1 tok/s; the reps' means of their four streams are 17.52 to 18.25 for this head against main's 17.82 to 18.32, the lowest in this head's third run, and all streams' tok/s at 4 streams is level with main's, 68.9 against 68.9 (+0.04%). Every cell, greedy row and cold prompt gave the same tokens in all nine starts of each set:

TP=2, mean of 4 runs of main and 3 of this head main this head this head against main (+ slower, − faster)
decode, a stream's tok/s, 1 / 4 streams 48.9 / 17.9 48.6 / 17.8 +0.60% / +0.74%
decode, all streams' tok/s, 4 streams 68.9 68.9 +0.04%
cold 9,600 / 38,400, ttft_s (two prompts' mean) 6.961 / 26.174 6.859 / 26.131 −1.46% / −0.16%
cold 2K / 8K / 32K / 64K, ttft_s 1.342 / 5.721 / 22.564 / 44.754 1.339 / 5.706 / 22.455 / 44.662 −0.23% / −0.26% / −0.48% / −0.21%
bench_openai, t=0, code / chat (tok/s) 43.4 / 37.7 45.2 / 37.8 −4.17% / −0.38%
bench_openai, t=1, code / chat (tok/s) 42.7 / 36.5 42.6 / 36.2 +0.18% / +0.83%
TP=3, mean of 4 runs of main and 3 of this head main this head this head against main (+ slower, − faster)
decode, a stream's tok/s, 1 / 4 / 8 streams 69.1 / 24.7 / 15.0 69.7 / 24.8 / 14.9 −0.88% / −0.17% / +0.50%
decode, all streams' tok/s, 4 / 8 streams 91.6 / 99.8 91.8 / 100.1 −0.28% / −0.24%
cold 9,600 / 38,400, ttft_s (two prompts' mean) 5.343 / 20.675 5.342 / 20.652 −0.02% / −0.11%
cold 2K / 8K / 32K / 64K, ttft_s 1.089 / 4.592 / 17.664 / 35.220 1.094 / 4.590 / 17.643 / 35.183 +0.45% / −0.06% / −0.12% / −0.11%
bench_openai, t=0, code / chat (tok/s) 62.8 / 51.7 63.1 / 52.0 −0.41% / −0.55%
bench_openai, t=1, code / chat (tok/s) 51.5 / 46.7 51.1 / 47.3 +0.84% / −1.10%

The rule, set before the runs, calls a row slower when this head's mean loses more than main's range or 0.25%, whichever is larger. The decode, edit and bench_openai prompts run 14 to 1,648 tokens with 256 tokens of reply: their windows stay under 64 blocks, so in both binaries they keep tf_glm_scores, and their rows show the rest of the step; the cold rows show the prompt pass. These gates show that this head loses nothing where the new path doesn't run; the gain is at the long contexts of the TP=4 table at the top.

TP=2 and TP=3 on this head, in run order
TP=2, in run order main this head main this head main this head main
decode, a stream's tok/s, 1 / 4 streams 49.3 / 18.0 49.4 / 17.8 48.6 / 17.8 48.3 / 17.9 48.6 / 17.9 48.2 / 17.6 49.2 / 17.9
decode, all streams' tok/s, 4 streams 69.6 69.0 69.0 69.7 68.3 68.0 68.8
cold 9,600 / 38,400, ttft_s (two prompts' mean) 6.947 / 26.157 6.718 / 26.065 7.072 / 26.132 6.897 / 26.236 6.863 / 26.268 6.962 / 26.092 6.962 / 26.140
cold 2K / 8K / 32K / 64K, ttft_s 1.351 / 5.725 / 22.407 / 44.691 1.343 / 5.711 / 22.209 / 44.440 1.336 / 5.723 / 22.600 / 44.915 1.340 / 5.699 / 22.575 / 44.760 1.341 / 5.708 / 22.694 / 44.597 1.335 / 5.709 / 22.582 / 44.786 1.340 / 5.728 / 22.554 / 44.812
bench_openai, t=0, code / chat (tok/s) 43.4 / 37.8 45.9 / 38.0 41.7 / 37.2 43.7 / 37.6 44.2 / 37.4 46.0 / 37.9 44.1 / 38.2
bench_openai, t=1, code / chat (tok/s) 43.1 / 36.2 43.0 / 36.6 42.0 / 35.9 42.3 / 35.2 42.4 / 37.2 42.5 / 36.7 43.2 / 36.6
TP=3, in run order main this head main this head main this head main
decode, a stream's tok/s, 1 / 4 / 8 streams 68.5 / 24.6 / 14.9 70.1 / 24.7 / 14.6 69.1 / 24.8 / 15.0 69.9 / 24.8 / 15.1 69.0 / 24.6 / 14.9 69.2 / 24.8 / 15.0 69.9 / 24.9 / 15.1
decode, all streams' tok/s, 4 / 8 streams 92.3 / 98.5 92.0 / 99.4 91.2 / 100.3 91.2 / 100.5 90.6 / 100.2 92.3 / 100.3 92.2 / 100.3
cold 9,600 / 38,400, ttft_s (two prompts' mean) 5.327 / 20.587 5.346 / 20.657 5.364 / 20.747 5.343 / 20.680 5.339 / 20.692 5.335 / 20.618 5.341 / 20.676
cold 2K / 8K / 32K / 64K, ttft_s 1.087 / 4.586 / 17.574 / 35.077 1.089 / 4.584 / 17.631 / 35.198 1.099 / 4.596 / 17.713 / 35.344 1.095 / 4.599 / 17.678 / 35.239 1.086 / 4.589 / 17.674 / 35.222 1.098 / 4.586 / 17.619 / 35.111 1.085 / 4.599 / 17.695 / 35.238
bench_openai, t=0, code / chat (tok/s) 62.3 / 51.5 62.2 / 52.2 62.3 / 51.5 63.8 / 51.7 62.7 / 52.3 63.3 / 52.2 64.2 / 51.5
bench_openai, t=1, code / chat (tok/s) 50.8 / 46.2 52.1 / 47.0 52.1 / 46.5 50.3 / 47.0 51.3 / 46.8 51.0 / 47.8 52.0 / 47.4

Each set's chain first timed both binaries' prices, uncounted, this head's start before main's, and then put main's record under this head's key and read it back by sha before its counted runs. At TP=2 the two timed starts named one expert form (factored), and one chain ran all nine starts. At TP=3 they named different forms (this head classic, main factored), a choice made at load time; that stopped the first chain before its counted starts, and the second went on from the table the first left. The timed starts gave the same tokens as the counted ones in every cell, greedy row and cold prompt. Each run's edit list (prompts of 768 to 1,648 tokens that copy from their prompt): at TP=2, a stream's tok/s 119.3, 117.2 and 103.3 against main's 108.7 to 117.5 at one stream, and at 4 streams 22.8, 23.2 and 22.9 against 22.8 to 23.2; at TP=3, 161.7, 157.5 and 157.3 against 157.2 to 159.5, and 30.8 in all three against 30.7 to 31.3.

TP=4's grid without drafts, each run, and the switch's runs

A cell is the median of 3 reps: the median gap between a stream's text chunks while every stream of the rep decodes, with "draft": false, ignore_eos and greedy, after a shared prompt of the cell's length (4,096, 65,536, 262,144 and 1,040,384 tokens). Every stream's token_sha is the same in every run, in every cell.

TP=4 (ring, gather), decode round in ms, mean of 4 runs of main and 3 of this head main this head this head against main (+ longer, − shorter)
4K, 1 / 4 / 8 streams 26.101 / 47.377 / 70.891 26.046 / 47.073 / 70.845 −0.21% / −0.64% / −0.06%
64K, 1 / 4 / 8 streams 26.616 / 48.009 / 71.230 26.629 / 48.438 / 71.135 +0.05% / +0.89% / −0.13%
256K, 1 / 4 / 8 streams 27.309 / 49.300 / 72.352 27.246 / 49.305 / 72.470 −0.23% / +0.01% / +0.16%
1016K, 1 / 4 / 8 streams 30.227 / 62.117 / 98.728 30.195 / 61.862 / 98.644 −0.10% / −0.41% / −0.08%
TP=4 (ring, gather), decode round in ms, in run order main this head main this head main this head main
4K, 1 / 4 / 8 streams 26.126 / 47.063 / 70.867 26.015 / 47.049 / 70.778 26.098 / 47.077 / 70.850 26.070 / 47.083 / 70.866 26.083 / 47.732 / 70.929 26.051 / 47.087 / 70.891 26.095 / 47.637 / 70.917
64K, 1 / 4 / 8 streams 26.673 / 48.055 / 71.168 26.637 / 48.925 / 71.076 26.642 / 48.031 / 71.298 26.623 / 48.321 / 71.037 26.629 / 47.920 / 71.103 26.628 / 48.066 / 71.293 26.519 / 48.031 / 71.353
256K, 1 / 4 / 8 streams 27.361 / 49.292 / 72.594 27.178 / 49.362 / 72.603 27.297 / 49.336 / 72.253 27.249 / 49.345 / 72.309 27.212 / 49.277 / 72.272 27.312 / 49.207 / 72.498 27.364 / 49.293 / 72.287
1016K, 1 / 4 / 8 streams 30.215 / 61.960 / 98.916 30.132 / 61.833 / 98.635 30.242 / 62.662 / 98.643 30.309 / 61.733 / 98.531 30.211 / 61.940 / 98.686 30.145 / 62.020 / 98.767 30.240 / 61.907 / 98.667

By the rule above, one cell is slower: 64K at 4 streams, a round of 48.438 ms against main's 48.009 (+0.89%, against main's range of 0.28%), this head's three runs 48.925, 48.321 and 48.066 against main's 47.920 to 48.055. The other eleven are within main's runs or faster, four of them faster (4K at 1 and 8 streams, 1016K at 1 and 4). Every GPU function is the same in both builds (cuobjdump -sass, in the section on this head), and a one-row window keeps tf_glm_scores, so I read that cell as run-to-run spread where the new path doesn't run.

The switch's runs: one binary of a local branch (this change's first three commits on an earlier main, with a bench and an unrelated setting, off), at TP=4, the same drafted reps after 1,040,384 tokens, alternated as default, TF_GLM_DSCORES=0, default, each a fresh start. Every rep took 32 rounds, drafted 508 and accepted 480 tokens, with the same tokens in the three runs.

TP=4, drafted decode after 1,040,384 tokens default TF_GLM_DSCORES=0 default
tok/s, 3 reps 171.71 / 171.89 / 171.17 151.98 / 151.77 / 151.65 172.08 / 171.47 / 171.67
decode round in ms 88.7 to 89.0 100.6 to 100.9 88.5 to 88.9
The first three commits at TP=3, and the one-GPU bench behind the fourth

At TP=3, at the release's settings (tools/bench_* as in the gate above), each set five runs (main, the branch, main, the branch, main). In the first two sets each binary kept its own window and draft prices (both factored; the branch's 28.45 ms at one row and 45.27 at four, main's 28.59 and 44.64); in the third, main's record served both. Decode at 4 streams, all streams' tok/s: main 91.4, 90.3 and 90.6 against the branch's 88.9 and 90.8 in the first set, 91.0, 90.4 and 91.2 against 90.5 and 89.4 in the second, 89.5, 91.1 and 90.7 against 90.6 and 88.0 in the third: the branch's mean 1.01%, 1.01% and 1.25% below main's, where main's own runs span 1.21%, 0.88% and 1.77%. In the third set, the pooled decode at 4 streams took 2.934 tokens a round in both binaries, and its median round was 121.96 ms on main against 124.31 on the branch.

The bench: tf-cuda-test glm-score-bench on one GB10, 11 key caches of the context's length read in turn as one pass (GLM-5.3-Flash's 11 MLA layers), the median of 15 reps by GPU events, tf_glm_scores (two runs, 0.00% to 3.12% apart) against tf_glm_index_scores at decodeLoop's tiles. Every arm wrote tf_glm_scores' bytes. ms a pass:

context 8 rows: tf_glm_scores / tf_glm_index_scores 16 rows 32 rows
1K 0.045 / 0.090 0.068 / 0.090 0.068 / 0.113
2K 0.049 / 0.090 0.068 / 0.090 0.090 / 0.113
4K 0.068 / 0.090 0.090 / 0.113 0.135 / 0.158
8K 0.090 / 0.113 0.135 / 0.158 0.231 / 0.211
16K 0.135 / 0.135 0.227 / 0.226 0.428 / 0.297
64K 0.426 / 0.322 0.800 / 0.494 1.584 / 0.818

Below 16K a pass takes a few microseconds a layer, and the timings fall on steps of about 0.0225 ms a pass: the kernels there differ by one or two steps, so the cells give the direction, not a ratio. 32 rows at 8K is the one cell under 64 blocks where tf_glm_index_scores ran ahead, by one step (0.02 ms); the floor keeps it on tf_glm_scores too.

decodeLoop: the sweep behind the tiles a CTA

The patch chose a window's tiles a CTA from its blocks alone (blocks / 376, at least one). On GB10 the fastest tiling also follows the rows. The third commit's rule, decodeLoop(rows, nb): a tile a CTA up to 4 rows, 2 up to 8, then rows / 4 for every 1,024 blocks (rounded up), at most score_tiles (16) and never fewer than 32 CTAs a row group. It changes speed only: every tiling writes the same scores. The same bench, median of 15 reps, three runs (each cell the runs' median), ms a pass, at the windows the path takes:

rows, context tf_glm_scores blocks / 376 decodeLoop
4, 512K / 1016K 1.720 / 3.419 1.735 / 3.459 1.627 / 3.188
8, 16K / 64K / 256K 0.136 / 0.428 / 1.538 0.159 / 0.360 / 0.909 0.136 / 0.320 / 0.919
8, 512K / 1016K 3.020 / 5.954 1.927 / 3.865 1.827 / 3.515
16, 16K / 64K / 256K 0.228 / 0.808 / 3.048 0.209 / 0.568 / 1.565 0.226 / 0.492 / 1.477
16, 512K / 1016K 6.037 / 12.688 2.717 / 4.890 2.620 / 4.953
32, 16K / 64K / 256K 0.429 / 1.601 / 6.327 0.316 / 0.978 / 2.913 0.289 / 0.795 / 2.585
32, 512K / 1016K 13.080 / 24.671 5.121 / 9.768 4.919 / 9.608

The rule runs behind blocks / 376 in two of these cells: 16 rows at 16K (0.226 against 0.209 ms, about one step, level with tf_glm_scores) and at 1016K (4.953 against 4.890, +1.3%).

On the head rebased onto #3776

In this section, "this head" is the rebased head.

  • Head commit: 50c6634539, on main b0b17e8962: this change's four commits with code, rebased onto glm cuda: decode kernels as dependent launches (carries #3673), +3.7% decode at TP=3, same tokens #3776. Two lines conflicted, cuda_index.zig's and cuda_sparse.zig's launches of the index scores; each keeps this change's arguments and branch with glm cuda: decode kernels as dependent launches (carries #3673), +3.7% decode at TP=3, same tokens #3776's cuda_pdl.launch. The diff against main is this change's 11 files, +107 −17, as before. A merge onto main 9e2a9bd7a9 shows no conflict.

  • Checks on this head: python3 tools/pr_check.py --base b0b17e8962 --pr 3689: 0 errors, lean 168 problems on main and on this head, 0 new, 1 warning (no Unreleased bullet naming this PR). In WSL (Ubuntu, x86_64), Zig 0.17.0: zig fmt --check build.zig zig passes; test-environment-host 26/26, test-glm-index-host 14/14, test-glm-index-emulate, the GLM module unfiltered 250/250, test-glm-contract-host 7/7, test-kernel-contract 257/257, check-native-cuda-host and compile-cuda-tests pass, and so do glm cuda: decode kernels as dependent launches (carries #3673), +3.7% decode at TP=3, same tokens #3776's test-glm-pdl-scan (3/3) and tools/test_pdl_early_loads.py (17 tests). pytest from the root: 650 passed, 89 skipped, 1 failed: tools/zig/zig_cache_restat_test.py, whose zig build timed out at 300 s here; run alone, that file fails on main's tree here too.

  • CI on this head (the run of 20 Nov, on its merge with main 9e2a9bd7a9): 6 checks pass (fmt, pytest, release-paths, benchmark-clients on Ubuntu and Windows, zig-macos-dev-tools), the two host-nightly jobs skipped, and zig, zig-b and zig-windows each fail one step, the same one: a test compile that stops at zig/src/families/qwen3_5/cuda_train.zig (no module named 'living'), a file this change doesn't touch; their other steps pass. Main's own scheduled run on 9e2a9bd7a9 (44668091696) fails the same three jobs on the same error. Main fixed that compile in its next commit, f3b4fa5dd4, after this run. pytest: 652 passed, 88 skipped, 670 subtests passed.

  • On a GB10 (sm_121), this head's tf-cuda-test (nvcc 13.3.73): glm-index-check PASS, scores, pools and token lists byte-equal at 10 cases, tied scores through both selects, 2 of its 7 decode windows on glm_index_scores; kernel-contract "decode scores" 1 pass with the planted control red, "tf_glm_index_scores" 2 pass, "decode select" 1 pass with the planted control red. glm cuda: decode kernels as dependent launches (carries #3673), +3.7% decode at TP=3, same tokens #3776's zig build check-pdl-loads in each build's tree: 0 early reads in 201 functions of 9 images, main's and this head's. cuobjdump -sass of the 157 fatbins found in both builds' caches: 2,089 functions, every one the same in both.

  • TP=3 on this head, at the release's settings as below, main against this head: nine fresh starts, 60 s apart. Each binary first timed its own window and draft prices, uncounted; then seven counted runs, main and this head in turn from main, every one kept on main's record, so the binaries differ only in code. The two timed starts named different expert forms (this head classic, main factored), a choice made at load time, and gave the same tokens in every cell, greedy row and cold prompt. By the rule above, no row is slower: every row is within main's range. tools/fsum.py's exactness checks hold over all nine starts: every cell, greedy row and cold prompt.

  • TP=4 on this head, four boxes in a ring as below, main against this head, on the night to 21 Nov: nine fresh starts, 60 s apart. Each binary first timed its own window and draft prices, uncounted, and both named the factored form; then seven counted runs, main and this head in turn from main, every one kept on main's record. Each start ran the grid of long contexts without drafts and then three drafted reps after the kept 1,040,384-token prompt. Drafted decode is 13.5% faster than main's, in the same 32 rounds and with the same tokens in all nine starts; one of main's 12 reps drafted one token fewer and accepted one fewer (507 and 479 against 508 and 480), and tools/dsum.py stops on any difference in drafts. By the rule above, one grid cell is slower, 64K at 4 streams (+0.89%, against main's range of 0.28%), and the other eleven are within main's runs or faster; every stream's tokens are the same in every counted run, in all 12 cells. The TP=4 tables are at the top and in the details.

  • TP=2 on this head, at the release's settings as below, main against this head, on the night to 21 Nov: nine fresh starts, 60 s apart. Each binary first timed its own window and draft prices, uncounted, and both named the factored form; then seven counted runs, main and this head in turn from main, every one kept on main's record. By the rule above, no row is slower. One row the gate counts is below main's lowest run and inside the threshold: decode at 4 streams, a stream's tok/s, 17.8, 17.9 and 17.6 against main's 17.8 to 18.0 (+0.74%, against main's range of 1.12%); all streams' tok/s there is +0.04%. tools/fsum.py's exactness checks hold over all nine starts: every cell, greedy row and cold prompt. The TP=2 and TP=3 tables are at the top, with each run in their details.

  • Receipt for this section: Bizuayeu/TensorFold@5a1bd38fc (rebase-1120/; its README's last section lists the files and the commands).

What this changes

cuda_sparse.selectTokens scores a window's rows against its visible pools before the select. For a decode window (under rows_from, 64, rows) on an aligned key cache, when Set.dscore holds the loaded glm_index kernels and Kernels.takesDecode(rows, np, nb, pk, ps) holds (8 rows or more from 64 64-pool blocks, or 4 or more from 2,048), the scores now come from tf_glm_index_scores through Kernels.scoresTiles at decodeLoop(rows, nb) tiles a CTA, with the grid's second axis in runs of that many tiles; any other window keeps tf_glm_scores, and prompt chunks keep TF_GLM_INDEX_CUDA's rule (Kernels.takes). cuda_forward.Modules.dscore loads glm_index's scores unless TF_GLM_DSCORES=0; the setting is a GLM row of platform/environment.zig (a flag, default on) with its docs/environment.md row, so a malformed value is refused by name when the model opens, and a glm_index that fails to load warns and keeps tf_glm_scores.

Checks on the earlier head (757cb7516d)

  • Head commit: 757cb7516d, on main 8cbef9777b: the maintainer's rebase (11-18) of this change's four commits with code. By git range-diff its commits 65a0e99df4, a39bac485d, fd67ceb1f9 and 757cb7516d are the same patches as f3e6f2c4ce, e43dd96cd0, cc457382c9 and a4da5a4eb2; the two CHANGELOG commits are not on it. The receipts and the checks below were made before the rebase, on a4da5a4eb2 on main e86a0bed1d, which "this head" names below; a line made on the rebased head names 757cb7516d. TP=4's runs used binaries built from cc457382c9, the first three commits, and main's e86a0bed1d; TP=2's and TP=3's gate and the TP=3 retake, this head's and main's; the TP=3 sets and the bench in the details, cc457382c9 and a local branch with the bench on it. nvcc names its internal symbols afresh on every build, so two builds of one tree differ in bytes: the served binaries are the ones built for these runs, each in an empty global cache (by sha256: this head's native 3bfb718d39a304e4, cc457382c9's 529d728d99655ee9, main's 1cfdb8a0c81eb7c0).
  • python3 tools/pr_check.py --base e86a0bed1d --pr 3689 on ba21a91a53, the head before the rebase, with the two CHANGELOG commits (12 files): lean 221 problems on main and on this head, 0 new; 0 errors and 0 warnings. git diff --check passes.
  • Tests run in WSL (Ubuntu, x86_64), Zig 0.17.0, on this head: lean 221 on main and on this head, 0 new; zig fmt --check build.zig zig passes. zig build test-glm-index-host 14 passed (the floor's cases fail on the third commit's takesDecode: 13 of 14); test-glm-index-emulate passed; test-environment-host 25, test-glm-fp8-kv-host 17, test-glm-prompt-profile-host 12, test-glm-pages-host 13, test-glm-tp3-host 9, test-glm-startup-host 7, test-glm-contract-host 7 and test-kernel-contract 244 passed; check-native-cuda-host (7/7 steps) and compile-cuda-tests (10/10 steps) pass. The GLM family module's tests with no filter (a local build step): 245 passed, 243 on main. CI's pytest from the root: 520 passed and 86 skipped, as on main, for the same 35 reasons. Merged onto today's main (25de9d70b0, git merge-tree clean; this change and main's 22 commits since share docs/environment.md and platform/environment.zig): lean 221 on that main and on the merge, 0 new; test-environment-host 26, test-glm-index-host 14 and the GLM module's 245 passed, check-native-cuda-host passes. On the rebased head 757cb7516d, in the same WSL: lean 221 on main 8cbef9777b and on the head, 0 new; zig fmt --check build.zig zig passes; test-environment-host 26, test-glm-index-host 14, test-glm-contract-host 7, test-kernel-contract 247 and the GLM module's 249 passed; test-glm-index-emulate, check-native-cuda-host (7/7 steps) and compile-cuda-tests (10/10 steps) pass.
  • On a GB10 (sm_121), this head's tf-cuda-test (nvcc 13.3.73): glm-index-check PASS (scores, pools and token lists byte-equal at 10 cases, tied scores through both selects; the decode select at 7 windows; decode scores on glm_index_scores at 2 of the 7, the two 16-row windows); kernel-contract "decode scores": 1 pass gates 1-4, 0 fail, 1 known finding, its control red at the shapes gate as planted; kernel-contract "tf_glm_index_scores": 2 pass, 0 fail, 2 known findings; kernel-contract "decode select": 1 pass, its control red as planted.
  • Kernels of the two builds, main's and this head's (the source trees and Zig caches that built the TP=2 and TP=3 binaries): cuobjdump -sass of the 115 fatbins found in both caches, 1,176 functions, every one the same in both (Receipt: sass/).
  • CI: on the rebased head 757cb7516d, in the run of 11-18, 5 checks pass (fmt, pytest, zig-windows, zig-macos-dev-tools, release-paths), the two host-nightly jobs skipped, and 4 fail, on three tests in files this change doesn't touch. zig (1 of 16,198 tests) and zig-b (1 of 14,375) each fail one of zig/src/cluster/bringup_test.zig's two real-clock tests, the two that tests: the drafter-auto benchmark test and two cluster bring-up tests stop flaking #3750 moves to a lockstep clock. benchmark-clients on Ubuntu and Windows fails test_bench_cache_agents' test_ttft_starts_at_content_not_headers_role_or_final_usage, a test main gained in 99db5bc6fe, three minutes before the rebase; run alone in WSL it passes 20 of 20 times on main's tree and 20 of 20 on 757cb7516d's. A second run on the same head, started on 11-19 by closing and reopening this PR, was cancelled by the maintainer after 45 minutes, before any job finished; the checks this page shows are that run's cancelled jobs. Before the rebase, on ba21a91a53, 9 checks passed (fmt, zig, zig-b, zig-windows, zig-macos-dev-tools, pytest, benchmark-clients on Ubuntu and Windows, release-paths) and the two host-nightly jobs skipped; its pytest's 522 passed, 84 skipped and 616 subtests passed were the counts of main's own run on 9489c38179.
  • Not run, and why: nvcc 13.0 and 13.2 for this head (13.3.73 is the release image's); GPUs other than sm_121; Metal and HIP (the change is in GLM's CUDA decode scores only).
The earlier base's sets: TP=2, TP=3, the TP=3 retake and TP=4's grid (main `e86a0bed1d`)

In this block, as in the checks above, "this head" is a4da5a4eb2 and "the branch" the third commit, cc457382c9.

On this head, at TP=2 and TP=3 at the release's settings, five runs each (main, this change, main, this change, main, each a fresh start), after one uncounted start of this change that timed its own window and draft prices; every counted start of both binaries kept main's record, so the binaries differ only in code (Receipt, below). At TP=2 no row the gate counts is slower. At TP=3 one is, by one stream of one rep: decode at 4 streams, a stream's tok/s, 24.1 and 24.4 against main's 24.4 in all three runs (+0.61%, against main's range of 0.00%). That cell is the median of 12 values (3 reps of 4 streams), rounded to 0.1 tok/s; in this head's first run one stream of one rep decoded at 24.0 (25.1 and 25.3 in its other reps), and the reps' means of their four streams are 24.57 to 25.00 for this head against main's 24.44 to 24.99. All streams' tok/s at 4 streams is 0.09% above main's, and the pooled decode round 0.51% shorter (122.19 ms against 122.81, at 2.939 and 2.931 tokens a round), where the first three commits ran all streams 1.01% to 1.25% below main in three sets and, in the set on main's prices, a round 1.93% longer:

TP=2, mean of 3 runs of main and 2 of this head main this head this head against main (+ slower, − faster)
decode, a stream's tok/s, 1 / 4 streams 48.4 / 17.6 48.4 / 17.6 +0.00% / +0.00%
decode, all streams' tok/s, 4 streams 68.0 68.3 −0.56%
cold 9,600 / 38,400, ttft_s (two prompts' mean) 6.977 / 26.226 6.953 / 26.301 −0.34% / +0.29%
cold 2K / 8K / 32K / 64K, ttft_s 1.354 / 5.745 / 22.594 / 44.832 1.346 / 5.781 / 22.519 / 44.618 −0.58% / +0.62% / −0.33% / −0.48%
bench_openai, t=0, code / chat (tok/s) 43.4 / 37.2 43.0 / 36.8 +0.91% / +1.14%
bench_openai, t=1, code / chat (tok/s) 41.4 / 36.0 41.7 / 36.3 −0.76% / −0.72%
TP=3, mean of 3 runs of main and 2 of this head main this head this head against main (+ slower, − faster)
decode, a stream's tok/s, 1 / 4 / 8 streams 69.5 / 24.4 / 14.8 68.6 / 24.2 / 14.9 +1.29% / +0.61% / −0.68%
decode, all streams' tok/s, 4 / 8 streams 90.6 / 99.1 90.7 / 99.5 −0.09% / −0.49%
cold 9,600 / 38,400, ttft_s (two prompts' mean) 5.341 / 20.664 5.343 / 20.645 +0.04% / −0.09%
cold 2K / 8K / 32K / 64K, ttft_s 1.090 / 4.599 / 17.663 / 35.227 1.096 / 4.598 / 17.630 / 35.190 +0.59% / −0.04% / −0.18% / −0.11%
bench_openai, t=0, code / chat (tok/s) 63.4 / 51.6 61.4 / 51.7 +3.14% / −0.28%
bench_openai, t=1, code / chat (tok/s) 51.6 / 46.9 51.8 / 46.5 −0.48% / +0.81%

The rule, set before the runs, calls a row slower when this head's mean loses more than main's range or 0.25%, whichever is larger. The decode, edit and bench_openai prompts run 14 to 1,648 tokens with 256 tokens of reply: their windows stay under 64 blocks, so in both binaries they keep tf_glm_scores, and their rows show the rest of the step; the cold rows show the prompt pass. These gates show that this head loses nothing where the new path doesn't run; the gain is at the long contexts of the TP=4 table at the top.

Of the rows the gate doesn't count, two are slower by the rule. I read both as run-to-run spread where the new path doesn't run: at these prompts no window takes the new launch, both binaries launch tf_glm_scores on the same grid (this head adds one comparison a window), and every run gave the same tokens.

  • TP=2's bench_openai chat at t=0: 35.9 and 37.7 tok/s against main's 37.0 to 37.3 (+1.14%, against main's range of 0.93%). The row is each run's median of 3 reps. Over the reps, this head's six average 37.01 tok/s and main's nine 37.03; this head's first run's three are 37.8, 35.9 and 35.7, and main's nine run 35.6 to 37.5.
  • TP=3's bench_openai code at t=0: 61.1 and 61.7 tok/s against main's 62.9 to 63.9 (+3.14%, against 1.65%). In this set the difference holds through both runs: every rep of both binaries took 83 to 85 rounds, and this head's rounds are longer, 49.46 and 48.85 ms on average (decode time over rounds, from rank 0's done lines) against main's 47.58 to 48.39; all six of this head's reps are below eight of main's nine. Across sets, main's twelve runs of this row at TP=3 (these three and the nine of the first three commits' sets, in the details) ran 61.2 to 63.9 tok/s, and the first three commits, which hold all of this head's code but the floor, 62.4 to 64.0 in their six; this head's uncounted start, on its own prices, ran it at 62.8.

TP=3's code row at t=0 was then taken again, once, as a set of its own, with its arms, their order and the rule above fixed before it ran (Receipt, below: tp3-retake/; TP=2's chat row was not taken again). Nine fresh starts: main four times and this head three, alternated, and among them two starts of this head with TF_GLM_DSCORES=0 in every rank's environment, not counted. Each ran the cold prompts and then bench_openai, as in the gate, and stopped there (no bench_concurrent), from the price table the first TP=3 set ended with: all nine kept main's prices, and the table was the same after each start. In this set this head's mean is within main's runs:

  • Code at t=0: this head's runs 63.0, 62.8 and 63.7 tok/s against main's 62.9 to 64.0 (+0.33%, against main's range of 1.83%). Over the reps, this head's nine average 62.98 tok/s and main's twelve 63.03. A rep took 84 or 85 rounds in main's runs and 84 to 86 in this head's; the rounds average 47.31 to 48.16 ms a run for this head and 47.59 to 48.22 for main.
  • The two TF_GLM_DSCORES=0 starts, not counted: 62.6 and 62.2 tok/s (+1.58%), below main's lowest run and inside main's range, so not slower by the rule. Their reps took 84 or 85 rounds, averaging 48.34 and 48.70 ms a run, the longest of the nine. Every rank of both logged the switch's warning once; no other start did.
  • The other rows: none slower, chat at t=0 among them (+0.00%), and the gate's cold 9,600 and 38,400 (+0.05% and −0.06%). Each greedy row gave one token_sha over its reps, the same in all nine starts.
TP=2 and TP=3 in run order
TP=2, in run order main this head main this head main
decode, a stream's tok/s, 1 / 4 streams 48.4 / 17.6 49.0 / 17.6 48.1 / 17.6 47.8 / 17.6 48.7 / 17.6
decode, all streams' tok/s, 4 streams 68.3 68.2 67.9 68.5 67.7
cold 9,600 / 38,400, ttft_s (two prompts' mean) 6.976 / 26.070 7.040 / 26.324 7.053 / 26.273 6.866 / 26.278 6.902 / 26.336
cold 2K / 8K / 32K / 64K, ttft_s 1.370 / 5.724 / 22.739 / 44.711 1.353 / 5.827 / 22.626 / 44.451 1.348 / 5.767 / 22.663 / 44.944 1.339 / 5.736 / 22.413 / 44.786 1.344 / 5.745 / 22.381 / 44.842
bench_openai, t=0, code / chat (tok/s) 43.8 / 37.0 44.2 / 35.9 43.0 / 37.3 41.9 / 37.7 43.6 / 37.3
bench_openai, t=1, code / chat (tok/s) 41.6 / 35.8 41.6 / 36.2 42.5 / 35.9 41.8 / 36.3 40.0 / 36.4
TP=3, in run order main this head main this head main
decode, a stream's tok/s, 1 / 4 / 8 streams 70.0 / 24.4 / 14.6 68.2 / 24.1 / 14.9 69.5 / 24.4 / 14.9 69.0 / 24.4 / 14.9 69.0 / 24.4 / 14.9
decode, all streams' tok/s, 4 / 8 streams 90.5 / 97.8 90.3 / 99.6 90.3 / 99.5 91.0 / 99.5 90.9 / 99.9
cold 9,600 / 38,400, ttft_s (two prompts' mean) 5.347 / 20.708 5.339 / 20.632 5.353 / 20.668 5.348 / 20.658 5.325 / 20.616
cold 2K / 8K / 32K / 64K, ttft_s 1.095 / 4.597 / 17.706 / 35.344 1.099 / 4.596 / 17.605 / 35.161 1.099 / 4.602 / 17.641 / 35.231 1.094 / 4.599 / 17.655 / 35.219 1.076 / 4.599 / 17.641 / 35.107
bench_openai, t=0, code / chat (tok/s) 63.9 / 51.3 61.1 / 52.1 62.9 / 51.5 61.7 / 51.3 63.4 / 51.8
bench_openai, t=1, code / chat (tok/s) 51.9 / 48.0 51.6 / 46.5 50.9 / 46.3 52.1 / 46.5 51.9 / 46.4

Each set's chain put main's record under both binaries' keys before its counted runs, and each stopped once on its own checks of that step and went on from there. At TP=2 the uncounted start left two new records, its own and the price reference's (that box's table held no reference), where the chain expected one; the five counted runs then ran in a second chain, 16 minutes later, 60 s apart. At TP=3 the chain took the reference's record for main's (both held main's bytes before this head's timed start rewrote the reference): main's first run kept its own record and counted, and this head's next start kept its own prices, so the chain's check of its start-up line stopped it before that run's benchmarks. The other four ran in a second chain 14 minutes after main's first run, with main's own record under this head's key. Each run's edit list (prompts of 768 to 1,648 tokens that copy from their prompt): at TP=2, a stream's tok/s 114.4 and 114.4 against main's 114.6 to 117.5 at one stream, and at 4 streams 22.6 and 23.0 against 22.5 to 22.6; at TP=3, 160.1 and 156.5 against 149.6 to 160.0, and 30.4 and 30.4 against 29.8 to 30.5.

TP=4 (ring, gather), decode round in ms main the branch main
4K, 1 / 4 / 8 streams 26.492 / 47.960 / 71.657 26.459 / 48.010 / 71.774 26.433 / 48.027 / 71.735
64K, 1 / 4 / 8 streams 26.878 / 49.657 / 72.158 26.852 / 48.779 / 72.168 26.894 / 49.267 / 72.091
256K, 1 / 4 / 8 streams 27.608 / 50.152 / 73.282 27.528 / 50.159 / 73.551 27.691 / 50.176 / 73.280
1016K, 1 / 4 / 8 streams 30.502 / 62.628 / 99.101 30.508 / 63.013 / 99.535 30.534 / 62.588 / 99.201

Three cells ran above both of main's runs by more than main's spread: 256K at 8 streams (+0.37%), 1016K at 4 (+0.65%) and at 8 (+0.39%), where main's two runs lie 0.00% to 0.10% apart and the branch's reps 0.66% to 0.80%. These windows are one row, the same kernel in both binaries. Taken again in five more runs (main, the branch, main, the branch, main), 256K and 1016K only:

TP=4, decode round in ms, in run order main the branch main the branch main
256K, 1 / 4 / 8 streams 27.550 / 50.126 / 73.103 27.682 / 50.085 / 73.218 27.506 / 50.384 / 73.181 27.572 / 50.184 / 73.255 27.685 / 50.272 / 73.095
1016K, 1 / 4 / 8 streams 30.542 / 62.528 / 99.066 30.770 / 62.573 / 99.486 30.501 / 62.504 / 99.281 30.528 / 62.682 / 99.271 30.503 / 62.658 / 99.351

In these runs the first runs' three cells are within main's three runs (1016K at 4 streams) or above them by less than 0.25% (256K and 1016K at 8). 1016K at one stream is the branch's first run, 30.770 ms, against 30.501 to 30.542 in the other four. The six cells' geometric means: main 51.701, 51.745 and 51.799 ms, the branch 51.856 and 51.771.

Receipt

  • On the head rebased onto glm cuda: decode kernels as dependent launches (carries #3673), +3.7% decode at TP=3, same tokens #3776 (the tables at the top, the section above): Bizuayeu/TensorFold@5a1bd38fc, rebase-1120/.
  • The earlier base's sets (folded above): the raw results and the tools that rerun those tables: Bizuayeu/TensorFold@041aaa525 (its README lists the files and the commands).
  • Boxes it reaches: GLM-5.3-Flash on CUDA, every rank's decode windows of 8 to 63 rows from 64 64-pool blocks (about 16K tokens), and of 4 to 7 rows from 2,048 (about 512K): drafted decode's verify rounds. Prompts, one-row windows and shorter contexts keep tf_glm_scores.
  • New switch? TF_GLM_DSCORES: default 1 (on), accepted 0 or 1, a GLM row in docs/environment.md; any other value is refused when the model opens.
  • Environment: on the rebased head, TensorFold 50c6634539 and main b0b17e8962; the earlier base's sets, a4da5a4eb2 (TP=2, TP=3), cc457382c9 (TP=4) and main e86a0bed1d. Each was built for its runs with CUDA 13.3 (nvcc V13.3.73, sm_121) in an empty Zig global cache; Zig 0.17.0; NCCL 2.30.7; NVIDIA GB10 (128 GB unified memory), driver 580.178.04; Bizuayeu/GLM-5.3-Flash-XSFP4 at 88736f9; the release settings for each size, with drafts MTP and copies and a 1,048,576-token window: TP=2 on two boxes over one cable (split), 4 streams; TP=3 on three in a switchless ring, 8 streams. TP=4: four boxes in a ring (TF_GLM_PREFILL_REDUCE=gather, NCCL_CUMEM_ENABLE=1, TF_GLM_PROMPT_TAIL=1, as tools/grid.py's shared prompt resumes only with it), 8 streams.
  • Window and draft prices: the engine times them at a binary's first start and keeps them by binary, and they set the expert form and the drafts a round. Each set on this head aligned them before counting: every counted start of both binaries kept main's record (TP=4: 24.99 ms at one row, factored; TP=2: 38.08 ms, factored; TP=3: 28.81 ms, factored), so the binaries differ only in code. Each binary's own timed start, uncounted: this head's 25.01 ms at one row at TP=4 and 37.84 ms at TP=2, both factored, and 29.49 ms, classic, at TP=3, against main's 24.99, 38.08 and 28.81 ms, all factored. The earlier base's sets aligned on main's record the same way (TP=4: 25.20 ms at one row, factored; TP=2: 39.41 ms, classic; TP=3: 28.59 ms, factored), the TP=3 retake's nine starts included.
  • Exactness: on the rebased head, over all nine starts of each set, the two timed ones included. At TP=2 and TP=3 (tools/fsum.py): in every cell tools/bench_concurrent.py --alone --serial's concurrent replies equal to their requests alone and every alone run equal to "draft": false, each stream one token_sha256 over the reps and the same in every start; tools/bench_openai.py's greedy rows one token_sha over their reps and the same in every start, and its sampled rows (t=1, seeded) agreed as well. The 16 greedy tokens after each of the eight cold prompts: one hash over the nine starts (tools/ccold.py); at each TP, the 126 resumed requests tools/bench_cache.py sends after the cold ones of 8K and more (6,144 to 63,488 tokens cached) each gave its cold request's tokens (tools/cwarm.py). At TP=4, the grid (tools/grid.py): every stream's token_sha the same in every counted run, in all 12 cells; the drafted reps: the same 512 tokens in all 27, the two timed starts' included. The earlier base's sets, as before: tools/bench_concurrent.py --alone --serial: every concurrent reply equal to its request alone, and every alone run equal to "draft": false, in every cell of every counted gate run at TP=2 and TP=3. tools/bench_openai.py's greedy rows: one token_sha over their reps and the same in every run, the TP=3 retake's nine included; its sampled rows (t=1, seeded) agreed as well. The 16 greedy tokens after each of the eight cold prompts: one hash over the six runs of each TP, the uncounted one included, and over the retake's nine; the two resumed requests tools/bench_cache.py sends after each cold one of 8K and more (8,192 to 63,488 tokens cached) gave the cold request's tokens in every run (84 a TP, and 126 in the retake). TP=4's grids (tools/grid.py): every stream's token_sha the same in every run, in all 12 cells of the first runs and the six taken again; the drafted reps: the same 512 tokens in all nine.
  • Main against this branch, same machine and checkpoint: on the rebased head, nine fresh starts at each of TP=4, TP=2 and TP=3 (60 s between runs; TP=3's in two chains, as in the details): the two timed starts, uncounted, and seven counted runs, main four times and this head three. Rank 0's start-up line in every counted run: at TP=4, the model 47.80 GiB a rank and 288 MiB fixed a stream, KV pages 8,030 to 8,033 in this head's runs against main's 8,024 to 8,031; at TP=2, 91.37 GiB and 391 MiB, pages 2,062 to 2,067 against 2,058 to 2,066; at TP=3, 64.11 GiB and 327 MiB, pages 4,758 to 4,774 against 4,762 to 4,777. The earlier base's sets: three runs at TP=4 and five more for its long cells, five at each of TP=2 and TP=3, and nine more at TP=3 for the retake (main four times, the earlier head three, and twice with TF_GLM_DSCORES=0, uncounted).
  • Licence of any new weights or drafter: n/a.
Kernel contract
  • Kernels registered with the contract, and the kernel each one replaces: cuda glm decode scores tf_glm_index_scores on pages out of order (zig/tests/cuda/contract_glm_index.zig, in the GLM index group beside the prompt indexer), a replacement of tf_glm_scores on the prompt indexer's scores, host rule and checks, launched at a decode window's tiles (glm.index.decodeLoop, cuda_sparse's grid). Served shapes: 8 x 4,096, 16 x 51,200 and 4 x 131,072 pools (2, 4 and 1 tiles a CTA), with up to 8,192 visible pools; the 8-row shape is 64 blocks, the floor.
  • A planted control for the new launch, failing as planted: control: GLM decode scores write one tile short, the same launch told it has one 64-pool tile fewer: red at the shapes gate, as planted ((filtered) SUMMARY 1 kernels: 1 pass gates 1-4, 0 fail, 1 known findings; 1 controls: 1 red as planted, 0 missed; 0 limit problems, tf-cuda-test kernel-contract "decode scores"). The known finding is the prompt indexer's (relu is fmaxf(x, 0), as Triton's tl.maximum: a NaN dot scores 0 where float64 keeps the NaN).
  • The launch is glm_index's tf_glm_index_scores, already in the records; this change adds no kernel.

Checklist

  • The title and description match the head commit, including the receipt and the stack. (head 50c6634539 on main b0b17e8962, rebased onto glm cuda: decode kernels as dependent launches (carries #3673), +3.7% decode at TP=3, same tokens #3776, with TP=2, TP=3, TP=4 and the checks taken on it; the earlier head was 757cb7516d on main 8cbef9777b, the maintainer's rebase of the four commits with code; before it the last was a4da5a4eb2 on main e86a0bed1d, whose sets are folded above)
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. (the planted control, the decode tiling told a tile fewer, goes red at the shapes gate; the floor's host cases fail on the third commit's takesDecode; glm-index-check fails when no window takes the decode scores; the device checks build only with -Dnvcc and run in tf-cuda-test on a GPU)
  • Comments and docstrings are one line. No measurements or history in the source. (lean checker: 0 new findings)
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off. (a kernel launch inside the select; the rounds and drafts are untouched)
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (every concurrent reply equals its request alone, and every alone run "draft": false, in every cell of every counted gate run; the resumed requests after each cold prompt of 8K and more give the cold request's tokens; TP=4's grids and drafted reps give main's tokens)
  • No precision traded for speed. If the bits change, the description says which sums change and why. (the scores are tf_glm_scores' bytes; no sums; greedy tokens equal main's)
  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled. (TP=4: drafted decode after 1M tokens 13.5% faster; the grid's one-row windows, which keep tf_glm_scores, within main's runs or faster in 11 of 12 cells, and 64K at 4 streams slower by the rule, +0.89% against main's range of 0.28%, which I read as run-to-run spread where the new path doesn't run, as in the details. TP=2 and TP=3 at one stream and the widest admitted, 4 and 8: no row slower by the rule; at TP=2 one row the gate counts, a stream's tok/s at 4 streams, below main's lowest run and inside the threshold, +0.74% against 1.12%, where all streams' tok/s is level, +0.04%; drafts as the release runs them, MTP and copies, and the change doesn't touch the drafter)

This is MiaAI-Lab's patch 0091 (attn5-0070-glm-decode-index-scores-on-glm-index-scores in MiaAI-Lab/GLM-5.3-Flash-DGX-Sparks-1104 at 0049d7c, Apache-2.0), moved onto the decode select; credit to @MiaAI-Lab for the kernel's decode launch. What I added: the settings-table row, the comments to the lean rules, the contract's decode tiling, served shapes and control, glm-index-check's count, the decodeLoop rule and the floor, each from the bench on GB10.

Bizuayeu added a commit to Bizuayeu/TensorFold that referenced this pull request Nov 17, 2026
@Bizuayeu Bizuayeu closed this Nov 19, 2026
@Bizuayeu Bizuayeu reopened this Nov 19, 2026
@Bizuayeu

Bizuayeu commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

A note on the CI state of this head (757cb7516d), so the red marks are not read as failures of the change.

  • The run of 18 Nov had four red jobs. Each was one test: the benchmark clients' ttft_s assertion on both runners, and two cluster bring-up tests (two ranks settle on the real clock ... in zig, a peer that stops after agreeing is found dead by name ... in zig-b). We read these as flaky tests, not as something this change touches: the two bring-up tests are the ones tests: the drafter-auto benchmark test and two cluster bring-up tests stop flaking #3750 is about, and main fixed the ttft_s test in Use a deterministic clock in the benchmark TTFT test #3783 (merged 19 Nov), which this head, rebased on 18 Nov, does not contain.
  • We closed and reopened the PR at 06:15 UTC on 19 Nov to run CI again on the same head. Both new runs were cancelled by the maintainer at 07:00 UTC, before any job finished, so the checks show as failed although no job reported a failure in that run.

The CI is not green, and we are leaving it as it is: no further close and reopen from our side. If you would like it run again once the queue is free, say so here.

@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks @Bizuayeu. The red check on this head isn't from your change.

The only failure is one test in test-cluster-membership-host, 1 of 38. That step runs the cluster bring-up tests on the real clock, and on a busy runner two ranks can briefly report different views. We have seen the same failure on other pull requests that don't touch the cluster code, and this one doesn't touch it either: your diff changes only the GLM CUDA index files, their tests and the environment table.

There is nothing to change on your side: a rerun of that check, or a rebase onto current main, clears it. The flake itself is being fixed separately, by moving those tests to a lockstep clock.

  • Synthena

@Bizuayeu

Copy link
Copy Markdown
Contributor Author

a rerun of that check, or a rebase onto current main, clears it.

#3689 (comment)

Thanks. The rerun of the failed jobs passed on 757cb75. Since then #3776 has landed, and this head now conflicts with it in two launch lines (cuda_index.zig and cuda_sparse.zig, where the decode path meets cuda_pdl.launch). #3776 also changed glm_index_scores.cuh, the kernel this change sends decode windows to, so I am rebasing this myself and taking the receipts again on the new base (TP=2, TP=3 and TP=4). I expect to push the rebased head today with the new TP=3 table, and to add TP=2 and TP=4 on 21 Nov. If you would rather rebase it yourself at landing, say so and I will stop.

@ashhart

ashhart commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Thanks @Bizuayeu. The rerun cleared the red check, so that point is resolved: the failure was in cluster bring-up, not in your diff, and there is nothing to change there.

One thing remains. Against current main the head conflicts in zig/src/families/glm/cuda_index.zig and zig/src/families/glm/cuda_sparse.zig, the two launch lines where the decode path meets cuda_pdl.launch, and #3776 also changed tf_glm_index_scores, the kernel these windows call. Please go ahead with your rebase and take the TP=2, TP=3 and TP=4 receipts again on the new base; we would rather you do it than rebase at landing. Keep the byte-for-byte score and token checks and the TP=4 drafted-decode numbers in the receipt. We were unable to run those device checks here before this review.

  • Synthena

@AIFlowML

Copy link
Copy Markdown
Contributor

At 50c66345, zig build test-glm-index-host test-glm-pdl-scan test-glm-prompt-profile-host test-glm-pages-host -Dcpu=apple_m1 -j5 --summary all passed 42 tests on M5 Max. The head now trial-merges cleanly into 124052c97.

The latest red Zig jobs ran on the older CI merge into 9e2a9bd7a. I reproduced their missing living import on Linux with zig build test-qwen35-modelopt-admission-host -Dfixed-cpu on that merge. The same target passed 186 tests with two skips on today's scratch merge, which includes main's import fix f3b4fa5dd. CI run

On the current trial stack with #3697, the Linux index emulator and PDL scan passed. The SM120 build (nvcc 13.1) ran tf-cuda-test kernel-contract 'decode scores' 'decode select' on an RTX 5090 Laptop. Both kernels passed, both controls failed as planted, and the runner reported one known nonfinite finding and zero limit problems. This is a single-device synthetic check. The requested TP=2/3/4 checkpoint receipts still need the multi-rank run.

Igor Lessio - AIFLOW LABS

Bizuayeu added a commit to Bizuayeu/TensorFold that referenced this pull request Nov 20, 2026
…se-1120/tp4, tp2), and the cold prompts' token checks at TP=3
@Bizuayeu

Copy link
Copy Markdown
Contributor Author

The requested TP=2/3/4 checkpoint receipts still need the multi-rank run.

(#3689 (comment))

TP=4 and TP=2 on this head (50c6634539) are in the description now, beside TP=3 of 20 Nov. At TP=4, drafted decode after a 1,040,384-token prompt is 13.5% faster than main, in the same rounds and with the same tokens; without drafts, one grid cell is slower by the rule (64K at 4 streams, +0.89%) and the other eleven are within main's runs or faster; at TP=2, as at TP=3, no row is slower. The receipt keeps each run's reports and the tools that rerun the tables: the grid's replies and the drafted reps' token_sha256 at TP=4, the token checks over all nine starts at TP=2 and TP=3 (tools/fsum.py, tools/ccold.py, tools/cwarm.py), and this head's byte checks of scores, pools and token lists on a GB10 (glm-index-check, kernel-contract).

Receipt: Bizuayeu/TensorFold@5a1bd38fc (rebase-1120/).

ultradaoto and others added 7 commits November 21, 2026 05:49
… stream; replies and tokens a round, not drafts)
…x_scores (TF_GLM_DSCORES)

MiaAI-Lab's patch 0091 (attn5-0070-glm-decode-index-scores-on-glm-index-scores,
in MiaAI-Lab/GLM-5.3-Flash-DGX-Sparks-1104 0049d7c, Apache-2.0), moved onto the
decode select (TF_GLM_DSEL). A decode window under rows_from rows, of 8 rows or
more (or 4 from 2,048 64-pool blocks) on an aligned key cache, takes
tf_glm_index_scores (8 rows a CTA, each key tile staged once for the window's
rows, decodeLoop tiles a CTA) instead of tf_glm_scores (a CTA a row and block);
the kernel writes tf_glm_scores' bytes. Prompt chunks keep TF_GLM_INDEX_CUDA's
rule and one-row windows keep tf_glm_scores. glm_index's scores load unless
TF_GLM_DSCORES=0, a glm row of platform/environment.zig (a flag, default on)
with its docs/environment.md row, read as TF_GLM_DSEL is; the comments are one
line each. glm-index-check's decode section runs selectTokens with the decode
scores in the new set.
…iles, and glm-index-check counts the windows that take them

contract_glm_index.zig's index scores also run at a decode window's tiling
(glm.index.decodeLoop tiles a CTA, cuda_sparse's grid) as a replacement of
tf_glm_scores, at three served decode shapes (8 x 4,096, 16 x 51,200 and
4 x 131,072 pools: 1, 2 and 5 tiles a CTA) with up to 8,192 visible pools. Its
planted control, the same launch told one 64-pool tile fewer, goes red at the
shapes gate. Both sit in Fast beside the prompt indexer's kernels; the launch is
glm_index tf_glm_index_scores, already in the records. glm-index-check counts
the windows whose decode scores take glm_index_scores and fails when none does,
so its byte checks cannot pass by skipping them. The docs' GLM paragraph names
the decode scores.
decodeLoop chose a window's 64-pool tiles a CTA from its blocks alone (about 376 CTAs a row group). On GB10 the
fastest tiles also follow the rows: a tile a CTA up to 4 rows, 2 up to 8, then rows / 4 a 1,024 blocks (rounded
up), at most score_tiles and never under 32 CTAs a row group. The rule is fit to a sweep of glm_index_scores by
rows and blocks; it changes speed only. The contract's served decode shapes keep 2, 4 and 1 tiles a CTA.
On GB10 glm_index_scores at a decode window's tiles is slower than tf_glm_scores for 8 and 16 rows up to 8K tokens
(0.02 to 0.045 ms a pass of 11 layers, in a one-GPU bench of the two kernels), level at 16K (64 blocks) and faster
from 64K (0.10 ms a pass at 8 rows, 0.31 ms at 16). A window of 8 or more rows takes it from 64 64-pool blocks
(16K tokens); 4 to 7 rows keep 2,048 blocks. Speed only: both kernels write the same scores. The contract's served
decode shapes still take it (8 rows over 4,096 pools is 64 blocks), and glm-index-check counts its windows by
selectTokens' blocks (the visible pools) instead of the bucket's.
@ashhart
ashhart merged commit 6c3bd29 into ashhart:main Nov 21, 2026
2 of 11 checks passed
@ashhart

ashhart commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Thank you @Bizuayeu. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

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.

4 participants