Skip to content

GLM-5.3-Flash capture tooling: the two-rank oracle run for the Zig replay - #546

Closed
GustavBlack wants to merge 1 commit into
ashhart:mainfrom
GustavBlack:glm-capture-tooling
Closed

GustavBlack wants to merge 1 commit into
ashhart:mainfrom
GustavBlack:glm-capture-tooling

Conversation

@GustavBlack

Copy link
Copy Markdown
Contributor

One commit adding GLM-5.3-Flash's stage-0 capture tooling: zig/tests/cuda/glm/capture.py (the oracle run, modeled on zig/tests/cuda/nemotron/capture.py) and zig/tests/cuda/glm/box/ (the two-rank capture script + README).

GLM-5.3-Flash serves CUDA on two ranks across two machines, so the box script extends the nemotron flow with the peer orchestration: rank 1 starts first on TF_PEER (ssh) and follows; rank 0 drives the prompt matrix; both ranks install the recorder and write their own launches.json; the runner merges both Triton caches and packs one kernel set with aot_pack.py. The preflight (no containers, no compute apps, both machines) and the journal lines follow the nemotron box's conventions.

Three operational notes from running this end to end on a GB10 pair (139 kernels captured per rank, 8/8 runs token-exact, drafted == serial on every prompt, ~94–98 ms/token serial decode):

  1. The mounted tree needs this repo's zig/ and the Python engine's src/ — the 1.0.0 split moved the Python line to python-0.6, and the capture imports tensorfold.families.glm5_next.cuda.engine from PYTHONPATH=/tensorfold/src. The README documents the union checkout.
  2. The follower's follow() raises (DistNetworkError, connection closed) when rank 0's process exits — the pair's normal shutdown — so the capture catches it and still writes the launch record.
  3. HF-cache snapshots hold symlinks into ../blobs/: the script mounts the model root and points --model at snapshots/<rev>/ inside it; mounting only the snapshot dir leaves broken symlinks in the container.

The capture renders the checkpoint's chat template with jinja2 directly (including the loopcontrols extension, as transformers does) and encodes with the tokenizers library — no transformers install needed inside the CUDA container.

Ran with the pinned container (nvcr.io/nvidia/pytorch:26.07-py3, nvcc 13.3.73) against the EXL3 TR3-4bpw checkpoint. (Developed with AI assistance on our 2×GB10 testbed; authorship is mine.)

…play

glm5_next serves CUDA on two ranks across two machines, so its stage-0 capture
extends the nemotron box with the peer orchestration: rank 1 starts first on
TF_PEER (ssh) and follows; rank 0 drives the prompt matrix; both ranks install
the recorder and write their own launches.json, the runner merges both Triton
caches and packs one kernel set (aot.json + cubins) with aot_pack.py.

capture.py renders the checkpoint's chat template through jinja2 directly (with
the loopcontrols extension, as transformers does) and encodes with the tokenizers
library, so the CUDA container needs no transformers install.

Notes from running this end to end on a GB10 pair (139 kernels captured per
rank, 8/8 runs token-exact, drafted == serial on every prompt):
- the mounted tree needs zig/ AND the Python engine's src/ (python-0.6 since
  the 1.0.0 split); the box README documents the union checkout
- rank 1's follow() raises (connection closed) when rank 0 exits; the capture
  catches it so the launch record still lands
- HF-cache snapshots symlink into ../blobs/: mount the model ROOT, point
  --model at snapshots/<rev>/ inside it

Signed-off-by: Gustav <[email protected]>
@ashhart

ashhart commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thank you, @GustavBlack, for the capture tooling and for running it end to end on a GB10 pair, with 139 kernels a rank and 8 of 8 runs token-exact. The three operational notes are useful.

We're not taking the capture route for GLM on CUDA. Since 1.0.3, Nemotron's CUDA kernels are our own instead of captured Triton code (8fc1e87, https://github.com/ashhart/TensorFold/releases/tag/v1.0.3), and we're bringing GLM to CUDA the same way, on our own kernels rather than a replay of the Python engine's. One thing we noticed while reading: capture.sh calls tools/zig/aot_pack.py with repeated --manifest/--cache pairs, but that file isn't on main. The packer lives at zig/tests/cuda/nemotron/aot_pack.py and takes one pair.

Your #539 and #541 are separate: both are merged into main and ship in the next release. Thanks again, and reopen this if you see a use for the capture that we've missed.

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