Skip to content

glm/cuda: the other ranks sleep on their lines while rank 0's vision tower runs (for #3614) - #3675

Merged
ashhart merged 7 commits into
ashhart:mainfrom
ultradaoto:glm-vision-park
Nov 19, 2026
Merged

ashhart merged 7 commits into
ashhart:mainfrom
ultradaoto:glm-vision-park

Conversation

@ultradaoto

Copy link
Copy Markdown
Contributor

For #3614, as agreed there: the other ranks leave NCCL for the length of rank 0's tower pass, by the park and wake the engine already uses when no stream is left.

The protocol. Before rank 0's tower encodes a prompt pass's images, Leader.encode sends the existing idle step. That is the same step Leader.idle sends when the last stream ends: every other rank receives it in follow's loop and calls tp_watch.sleep, a futex wait on its liveness line, so none of them holds a posted NCCL receive during the pass. After the pass, rank 0's next step (the image step, after any drop steps flush sends) goes through Leader.send, which sees link.asleep and calls tp_watch.wake first, as it does after any idle. The followers return to Link.receive and the steps go on in the same order.

  • Ordering. The park is one more step in the one ordered stream of steps every rank already follows, at a point where no other step is in flight. Rank 0 sends nothing on NCCL between it and the wake, since the tower runs on rank 0 alone.
  • Failure and cancel. If the pass is refused (ImageRows, ImageOutOfStep, NoVision, an encode error), encode returns before sending the image step and the request fails as on main. The other ranks stay asleep until rank 0's next step for any stream, which wakes them first, as after an idle. A cancel lands after the pass, as before. A rank that dies while the others sleep closes its line, and they stop, as they do when it dies while they wait in NCCL.
  • Wakes. tp_watch.sleep counts wakes against sleeps, so a wake that arrives before its sleep is not lost. Leader.idle does nothing on one rank (tp_watch.open() is false) or when the ranks are already asleep.
  • Cost. One 64-byte step and one wake record per prompt pass with images; nothing else changes for passes without images or at one rank.

Code: Leader.encode in cuda_follow.zig (the park, the tower, then Leader.images as before), called from Lanes.images in cuda_lanes.zig in place of the two calls it made, so that file stays at 599 lines. Leader.idle's comment now names both cases. The tower pass is the only caller of Images.begin.

Checks

On the branch as pushed (aarch64, a GB10, nvcc 13.0):

  • zig build test-cuda-host passes 4,460 of 4,480, with 19 skipped. Its one failure is cli_config_test's serve --config: expand ..., which fails the same way on main on this host.
  • pr_check: 0 errors, 0 new lean findings.
  • git merge-tree against main f3307fb is clean. Against glm cuda: decode kernels as dependent launches, +6.8% decode at TP=2, same tokens #3673's head, only CHANGELOG.md conflicts: both add a line at the top of Unreleased.

The receipts' binary is this commit on main 077998f, built with zig build -Dgpu=spark.

Receipts

The test bed:

  • Three GB10s cabled as a switchless ConnectX-7 triangle, TP=3, GLM-5.3-Flash EXL3.
  • Settings: --parallel 4 --kv-cache fp8 --decode-share 0.5, --drafter incoai/GLM-5.3-Flash-DFlash2, and TF_GLM_DENSE_BITS=8 TF_GLM_HEAD_BITS=8 TF_GLM_KDA_PAD=1 TF_ROCE=1, greedy.
  • NCCL_MESH_TIMEOUT_SEC=30 on every rank, the mesh plugin's default. Each rank's log names the 30 s timeout.
  • Three starts in one session, in this order: main 077998f, this branch, main again. Each was a fresh server with an empty window-cost cache.

Images are cold passes with a fresh prompt each time, asking "how many screenshots are attached?". Times are wall seconds to the reply.

main this branch main
16 varied greedy requests (4 with thinking), aggregate tok/s 58.18 58.64 58.24
tokens a round over those requests 3.057 3.058 3.058
13 greedy replies (8 prompts alone, 4 at once, one of about 8K tokens) reference 13/13 hash equal 13/13 hash equal
1 × 1440x900, s 3.06 2.87 2.91
1 × 2560x1440, s 14.45 14.47 14.43
8 × 1440x900, s 18.87 18.76 18.83

Each image pass gave the same answer on all three starts.

The branch alone also ran the passes that stop every rank on main at 30 s (#3614's table). All three ranks were up after each one:

pass prompt tokens s answered
1 × 3840x2160 10,805 65.66 yes
2 × 3072x1728 13,683 56.25 yes
15 × 1920x1080 40,435 77.41 yes

Then a 45-minute soak at four concurrent requests, still at the 30 s default: 1,818 requests, 0 failed, all three ranks up at the end. By kind:

kind ok mean s
chat, thinking high 193/193 14.0
chat, thinking low 188/188 9.4
chat, thinking off 195/195 13.5
multi-turn conversations 517/517 3.8
tool calls 335/335 2.2
image requests 384/384 1.8
prompts of about 27K tokens 3/3 38.7
prompts of about 55K tokens 3/3 66.9

@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks @ultradaoto. LAND with the routine changelog integration. The tower now uses the existing park/wake protocol before its image step, including wake-before-sleep handling. The supplied long-pass regression exercises the original timeout failure. #3660’s workaround should remain historical once this lands.

  • Synthena

ashhart and others added 7 commits November 19, 2026 13:26
…tower runs (ashhart#3614)

Leader.encode sends the idle step before the tower pass, so ranks 1.. wait in tp_watch.sleep, not in an NCCL broadcast
that a net plugin's operation timeout can end (nccl-mesh-plugin: 30 s by default); the image step after the pass wakes
them as any step does. One rank and the steps' order are as before.
@ashhart
ashhart merged commit d8b947b into ashhart:main Nov 19, 2026
ashhart pushed a commit that referenced this pull request Nov 19, 2026
@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thank you @ultradaoto. 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.

2 participants