Skip to content

GLM CUDA: name each startup phase and warn while NCCL init or the peer warm-up waits - #2354

Merged
ashhart merged 4 commits into
mainfrom
lead/glm-startup-phases
Nov 7, 2026
Merged

ashhart merged 4 commits into
mainfrom
lead/glm-startup-phases

Conversation

@ashhart

@ashhart ashhart commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Part of #2347. A multi-rank GLM CUDA start that stops in NCCL init or the peer warm-up now says where, instead of printing nothing until it's killed.

What each rank prints

  • A line as it enters each phase: NCCL init, peer warm-up, weights, calibration (rank 0 only), then ready or ready to follow rank 0. A start that fails says stopped before ready.
  • Before the warm-up: the peers' capabilities, the liveness connections, the communicator id's hash, and the path of NCCL's captured init log. After NCCL init: its device, bus id, NCCL version and elapsed time.
  • While NCCL init or the warm-up is unfinished, a warning once a minute: the phase, the seconds spent, the transport NCCL's log shows so far and the log's path. On a two-rank start whose log shows P2P, it names NCCL_P2P_DISABLE=1 as one thing to try. It never applies it.

What doesn't change

  • The watcher is its own thread reading one atomic timestamp. It takes no lock the phases hold, makes no CUDA or NCCL call, and never retries, changes or interrupts a transfer.
  • Transfer order, kernels, arithmetic and lane code are unchanged. Single-rank GLM and the other families start no watcher.
  • The host startup wiring moves from native/cuda.zig into native/cuda_startup_phase.zig, which leaves native/cuda.zig at 583 lines.

A timeout that stops every rank after a stuck warm-up would be a separate change. It isn't in this PR.

Checks (host, no GPU)

  • 33 focused tests across the watcher, native readiness and GLM startup.
  • Three planted controls fail as they should: no watcher started, a failed start left unreported, and the P2P hint given on the wrong start.
  • The full CUDA host graph passes: 313 steps, 1,970 tests, 12 skipped. The Linux cross-compile passes.
  • Lean is 425 before and after.

Not checked yet: a real two-rank start and its served tokens. A GLM TP=2 pair runs before it lands, with tokens equal to main's.

zig/build/cuda.zig ends at 599 lines here. The integrated-upload PR also adds one line there, so whichever lands second ends at 600.

@ashhart

ashhart commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

GLM-5.3-Flash NVFP4 at TP=2 on two GB10s, main's merge base against this head, runs ordered base, new, new, base:

  • Tokens: 52 equal, 0 unequal, 0 unverified. The six-turn chat qualified on both binaries, thinking on and off, with the same cached_tokens on every turn.
  • The new lines, from the real start:
    rank 0 startup: entering NCCL init (2 ranks, id 7b9a2a9a, NCCL 2.30.7, CUDA device 0 000F:01:00.0)
    rank 0 startup: NCCL init done in 1203 ms
    p2p: rank 0 of 2: GPU 0 NVIDIA GB10 (...); driver 580.173.02, CUDA driver API 13.0, NCCL 2.30.7
    rank 0 startup: entering peer warm-up
    rank 0 startup: entering weights
    rank 0 startup: entering calibration
    rank 0 startup: entering ready
    
    The p2p report now comes before the warm-up. No "still in" warning fired, since nothing waited a minute.
  • Speed: inconclusive, not a result. The same binary swung more than the gap between binaries. Base decode at one stream was 42.1 tok/s in run 1 and 31.8 in run 4, and the second prompt row was 1,612 against 727 tok/s. The summary's -6.3% at 2K and -6.1% for one-stream code sit inside that spread. Nothing in this PR runs after ready (the watcher is joined there), but we'll rerun the pair before it lands rather than lean on that.

@ashhart

ashhart commented Nov 6, 2026

Copy link
Copy Markdown
Owner Author

The rerun on the same two GB10s, same heads, runs ordered base, new, new, base:

Cell Base New against base
8K prompt 1,471.3 tok/s -0.0%
32K prompt 1,476.7 tok/s -0.2%
Chat, 1 and 2 streams 30.2 and 53.1 tok/s +0.0% and +0.1%
Code, 1 and 2 streams 55.4 and 80.2 tok/s +0.3% and -0.1%
2K prompt 1,202.9 tok/s +5.3%

Tokens: 52 equal, 0 unequal, and the six-turn chat qualified on both binaries with the same cached_tokens.

The 2K cell isn't a result either way. Its first rows vary from 718 to 1,613 tok/s within one binary's runs, in both runs of this PR. It read -6.3% the first time and +5.3% now. Everything that holds still is level, and nothing in this PR runs after ready. It goes in the landing queue.

Observe unfinished NCCL init and peer warm-up once per minute without a phase-held lock or driver call. Report only captured transport classes, and suggest NCCL_P2P_DISABLE=1 only for an observed P2P path with two ranks. Followers say ready to follow rank 0 rather than claiming calibration has finished.

Keep phase wiring and host construction in a helper so the native adapter has room for further changes. End the observer on ready, failed host startup and normal cleanup. Host checks cover blocked observation, cadence, transport-specific advice and production readiness callbacks, with runtime controls for omitted observation, unconditional advice and missing failure cleanup. No transfer, kernel or lane behavior changes. Refs #1994.
Print peer facts before warm-up while retaining capture through warm-up and leaving the optional transfer probe at its existing point. Name the capture file in startup and minute warnings, report liveness connection successes, and correlate NCCL id handoffs with the first eight SHA-256 hex digits.

Wrap the same blocking communicator init with best-effort version, visible device and bus details plus elapsed completion. Keep wire operations, existing waits and warm-up postings unchanged. Host fakes cover ordered lines, capture lifetime, delayed connections, optional-probe order and failed diagnostic queries. Refs #1994.
@ashhart
ashhart force-pushed the lead/glm-startup-phases branch from cd1e41f to ce36087 Compare November 7, 2026 04:36
@ashhart
ashhart merged commit cce0bde into main Nov 7, 2026
2 of 11 checks passed
ashhart added a commit that referenced this pull request Nov 8, 2026
…nged since 18b3b69

The test stops at its first mismatch, so only contract_controls.cu. failed first Hashing every
row with the test's own rules finds 16. For each, the last commit whose bytes match the pin was
found in topological order (rebased commits keep older author dates). Every change since is a
merged commit whose diff matches its message. The kernel ones carry their contract or SASS
evidence:

- contract_controls.cu: cf637be, 390ef29, 94a9a48 (controls for the LFM2 glue, the Liquid
  conv and the head-64 paged attention), then 6b81d9b (declares P256, IDS and PN off, which the
  prompt-row fragment reads since 47bd0d5 and 00dddc5).
- nemotron_attention.cu, prefill_attention.cu and prefill_attention_rows.cuh: 82f3dde and
  94a9a48 (head-64 paged attention, moved helpers; sassid: existing functions unchanged).
- qmmf.cu, qmmf.zig: ec76abd and c3acc34 (BF16 prompt tile and K32 staging, bytes unchanged
  under the contract), fbf8d96 (that tile for Flash Next only), 6a1feb2 (TF_QMMF_HALF_BELOW).
- aot.zig 3a7e6fa; carveout.zig 6a1feb2; kernels.zig cf637be: one export or reader each.
- root.zig ffe9b36, 13d7450 and tp_watch.zig 13d7450, 7ead07c (#2354; #2512).
- Flash Next cuda_batch, cuda_batch_state, cuda_lanes, cuda_mtp_ops, cuda_snap: 4f6017c (marks
  kept inside the pass), 4b2679b (grouped draft head's page table), fbca907 (#2391),
  ec76abd (reserveRows).

Seven of these (root.zig, the Flash Next files and part of tp_watch.zig) changed before
18b3b69 and were already stale there. Each changed row gets a note column naming its commits,
or that note appended to the existing one. Modes and paths are unchanged.
pocket-serving-approved.tsv is unchanged.

test-gradient-serving: 1 of 1.
@ashhart
ashhart deleted the lead/glm-startup-phases branch November 10, 2026 16:34
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