Skip to content

glm cuda: warm turns under TF_GLM_REQUEST_STARTS=1, every message start a cut, DFlash2's ring kept alike on every rank (#3109) - #3147

Open
ashhart wants to merge 3 commits into
mainfrom
lead/glm-cuda-warm-turns
Open

ashhart wants to merge 3 commits into
mainfrom
lead/glm-cuda-warm-turns

Conversation

@ashhart

@ashhart ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner

For #3109 (the CUDA part; Metal follows separately).

GLM-5.3-Flash on CUDA gets warm turns. With TF_GLM_REQUEST_STARTS=1 and a prompt cache, a warm pass runs after each reply, so the next turn resumes past it. Every message start becomes a prompt cut. A new request stops a warm pass at its next chunk: the yield fires only for background warm passes, as Nemotron's does, so foreground prompts are never stopped. Kept states carry DFlash2's context alike on every rank.

At TP=2, rank 0 decides the request-starts setting and sends it with the snapshot-cache step. Before, each rank read the variable itself, but the recipe sets it on rank 0 only, so the ranks could disagree on the drafter state. A kept DFlash2 ring's origin is clamped to the pass's last 2,048 rows, so it can't restore another sequence's stale rows.

With the variable unset, nothing changes. With it set, users now get every message start as a cut, not assistant starts 256 tokens apart.

Tests: test-glm-warm-host 8, warm-policy 11, request-starts 13 and 19, snapshots 21, dflash 6, test-server-cpu 1331, test-cuda-host 393/393 steps; cross-compiles pass. On main, the request-starts pin fails (256 against 1).

Device check pending (two GB10s at TP=2, switch on rank 0 only, MTP then DFlash2): switch unset equals main at 1 and 4 streams, greedy and seeded; zig/tests/server/glm_warm_served.py warm drafted equals undrafted equals cache-off equals main, with cached_tokens past each reply's end; cold prompts under the switch keep tokens and cold TTFT; a request 200 ms into a warm pass stops it at the next chunk on both ranks.

@ashhart
ashhart force-pushed the lead/glm-cuda-warm-turns branch from fe30557 to 84f9459 Compare November 14, 2026 03:29
@ashhart
ashhart force-pushed the lead/glm-cuda-warm-turns branch from 84f9459 to 595fa04 Compare November 17, 2026 22:01
ashhart added a commit that referenced this pull request Nov 17, 2026
#3147

glm_warm_served.py needed the base, warm and cache-off servers loaded at
once, and one GB10 pair holds one TP=2 GLM server (96 GiB on rank 0).
`record` now takes one server (--url, --out, --label) and writes each
seed's, turn's and stream's drafted and draft-off token ids and sha,
cached_tokens, the previous history's token count and TTFT to JSON.
`compare` reads the warm, cache-off and main receipts and fails on any
token difference, on a warm turn that resumes fewer tokens than main's
turn, or on a warm TTFT not below main's where the warm turn resumed more.

CHANGELOG line under Unreleased.
ashhart added a commit that referenced this pull request Nov 17, 2026
#3147

glm_warm_served.py needed the base, warm and cache-off servers loaded at
once, and one GB10 pair holds one TP=2 GLM server (96 GiB on rank 0).
`record` now takes one server (--url, --out, --label) and writes each
seed's, turn's and stream's drafted and draft-off token ids and sha,
cached_tokens, the previous history's token count and TTFT to JSON.
`compare` reads the warm, cache-off and main receipts and fails on any
token difference, on a warm turn that resumes fewer tokens than main's
turn, or on a warm TTFT not below main's where the warm turn resumed more.

CHANGELOG line under Unreleased.
@ashhart
ashhart force-pushed the lead/glm-cuda-warm-turns branch from 595fa04 to 8e388bd Compare November 17, 2026 22:01
ashhart added a commit that referenced this pull request Nov 19, 2026
#3147

glm_warm_served.py needed the base, warm and cache-off servers loaded at
once, and one GB10 pair holds one TP=2 GLM server (96 GiB on rank 0).
`record` now takes one server (--url, --out, --label) and writes each
seed's, turn's and stream's drafted and draft-off token ids and sha,
cached_tokens, the previous history's token count and TTFT to JSON.
`compare` reads the warm, cache-off and main receipts and fails on any
token difference, on a warm turn that resumes fewer tokens than main's
turn, or on a warm TTFT not below main's where the warm turn resumed more.

CHANGELOG line under Unreleased.
@ashhart
ashhart force-pushed the lead/glm-cuda-warm-turns branch from 8e388bd to 697f8ea Compare November 19, 2026 04:38
ashhart added a commit that referenced this pull request Nov 21, 2026
#3147

glm_warm_served.py needed the base, warm and cache-off servers loaded at
once, and one GB10 pair holds one TP=2 GLM server (96 GiB on rank 0).
`record` now takes one server (--url, --out, --label) and writes each
seed's, turn's and stream's drafted and draft-off token ids and sha,
cached_tokens, the previous history's token count and TTFT to JSON.
`compare` reads the warm, cache-off and main receipts and fails on any
token difference, on a warm turn that resumes fewer tokens than main's
turn, or on a warm TTFT not below main's where the warm turn resumed more.

CHANGELOG line under Unreleased.
@ashhart
ashhart force-pushed the lead/glm-cuda-warm-turns branch from 697f8ea to 42845b2 Compare November 21, 2026 12:51
ashhart added a commit that referenced this pull request Nov 22, 2026
#3147

glm_warm_served.py needed the base, warm and cache-off servers loaded at
once, and one GB10 pair holds one TP=2 GLM server (96 GiB on rank 0).
`record` now takes one server (--url, --out, --label) and writes each
seed's, turn's and stream's drafted and draft-off token ids and sha,
cached_tokens, the previous history's token count and TTFT to JSON.
`compare` reads the warm, cache-off and main receipts and fails on any
token difference, on a warm turn that resumes fewer tokens than main's
turn, or on a warm TTFT not below main's where the warm turn resumed more.

CHANGELOG line under Unreleased.
@ashhart
ashhart force-pushed the lead/glm-cuda-warm-turns branch from 42845b2 to 08c157e Compare November 22, 2026 00:50
…lash2's ring kept alike on every rank (#3109)

With TF_GLM_REQUEST_STARTS=1 on rank 0 and a prompt cache, GLM-5.3-Flash on CUDA runs a warm pass 150 ms after a
reply: it prefills the reply as the next turn renders it and keeps states at the next turn's own cuts inside it, so
after a reply longer than 2,048 tokens the next turn resumes inside the reply. The cuts stay main's (assistant
starts at least 256 tokens apart, request_min_chunk kept, and every 2,048 rows from the last cut): a warm pass's
starts are the next turn's below its end, so a resumed turn chunks as a cold one and its tokens are the same. A
foreground request stops a warm pass at its next chunk gate (rank 0's word, all-reduced, as a cancel). Kept states
carry DFlash2's context ring: rank 0 tells every rank with the snapshot cache, and a restore takes the ring from
the first row the keeping pass tapped. Unset, nothing changes.
#3147

glm_warm_served.py needed the base, warm and cache-off servers loaded at
once, and one GB10 pair holds one TP=2 GLM server (96 GiB on rank 0).
`record` now takes one server (--url, --out, --label) and writes each
seed's, turn's and stream's drafted and draft-off token ids and sha,
cached_tokens, the previous history's token count and TTFT to JSON.
`compare` reads the warm, cache-off and main receipts and fails on any
token difference, on a warm turn that resumes fewer tokens than main's
turn, or on a warm TTFT not below main's where the warm turn resumed more.

CHANGELOG line under Unreleased.

This branch has not been deployed

No deployments
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