Repository navigation
Nemotron Super on CUDA: shared windows of several streams run the latent shared expert on the side stream again - #1058
plotarmordev wants to merge 1 commit into
Conversation
…red expert on the side stream again A shared window is one forward over its streams' rows: every MoE layer reads the engine's shared scratch, the cached plan for the window's total rows and one fork and join, as a lone window and the MTP head's batched levels already do. Only two ranks keep the shared expert on the main stream. tf-cuda-test shared-fork adds shared windows of 2, 4 and 8 streams at their narrowest and widest, with the shared rows poisoned and the side stream held back.
|
TP=2 update: with the overlap build, a served two-rank run (NCCL 2.32.3, see #1060) now completes |
|
Thanks @plotarmordev. Your race argument holds up on our GB10: shared-fork passes all 1,558 cases at checkpoint and full precision, including the NaN-filled 2-, 4- and 8-stream windows, and every stream's tokens match the line without the change. Alone, it cost 4-stream prose 2.6%: its cheaper rounds drafted shallower under the depth rule in your #1059. With our shared-round depth probe for #1059 beside it, Super VL NVFP4 (ABBA, 2 servers × 5 waves) measures 4-stream count at +1.5% (122.70 against 120.91 tok/s without either change) and 4-stream prose at +1.3%. 8 streams are within 0.5%, at the 32-row cap. We're carrying both onto the 1.1.2 line under your name. Posted by Ash's AI Assistant Synthena |
…dits The 1.1.2 section had no entries for the contributed pull requests carried into this release, so neither their changes nor their authors reached the release notes. Add an entry for each, written from its commits: Flash Next's CUDA prompt tiles and structured output (#1046, #1062), --thinking-reserve, the long-loop guard and the --vision template diagnostic (#1064, #1075, #1076), GLM's Metal eh_proj tile and CUDA waiting ranks (#1066, #1053), M1's simdgroup cap (#1055), Nemotron's CUDA image and shared-window fixes (#1057, #1058), Qwen's live-row expert routing (#1047), the shared CUDA operators and contract fixture (#1056, #1068, #1070, #1071, #1073), the ROCm receipt, drafter and draft-count work (#1043, #1044, #1045), the ModelOpt recipe numbers (#1042), the Windows host build (#1034) and the session store's allocation-free rollback (#637). Thank #643's and #1060's reporters as the other entries thank theirs.
|
The Nemotron Super CUDA shared-window scheduling change is included in 1.1.2 (https://github.com/ashhart/TensorFold/releases/tag/v1.1.2), with your original authorship retained. Shared windows on one GPU can keep the shared expert on its side stream; tensor-parallel latent windows keep the main-stream schedule. Closing this as carried, and thank you. It landed as fadbf9a. - Synthema, Ash's AI Assistant. |
What this changes
43212bf (in 1.1.0) took the side stream away from shared windows of more than one sequence:
Forward.routedWindownulls
sidewhensegs.len > 1 or f.tp != null, because "the side stream took the latent shared expert in everywindow, which put a fork and a join into each layer of a shared round". This pull request drops the
segs.len > 1half. Two ranks keep the main stream as they do now. On one GPU, a shared round's 40 MoE layers again run the shared
expert beside the router, the latent projection and the routed experts, as a lone window does. Same bits.
Why that is safe:
Engine.verifyShared→windowSegs); only the mixersrun per segment. Each MoE layer sees the window's total rows (32 at most) and reads the plan built at load for that
row count. The shared expert's (row, share) pairs do not depend on which stream owns a row.
b.y,b.sidsand that plan. It writesb.sact, the shared rows ofb.ymoeand theshared section of the NVFP4 rows. The main stream never touches those while the side stream runs.
bis theengine's scratch in a lone window and in a shared one, so segments add no buffer the fork could race on.
waits for the side stream right before
moe_out, the first reader of the shared rows. The next layer's writes tob.ycome after that wait.several streams' rows in every shared round (
networkSpans→latent.runone.forward(null)).draft depths keep the same inputs.
Tests:
tf-cuda-test shared-fork MODELruns every latent MoE layer (40 blocks and the MTP head, both precisions) lone at 1to 32 rows, as before, and now also in shared windows of 2, 4 and 8 streams. Each stream count runs at its narrowest
window (one row a stream) and at 32 rows, laid out as
verifySharedlays them. Before each forked run the test fillsthe shared rows with NaN and holds the side stream back with copies, so a sum that does not wait for the join reads
NaN. A shared window without a side stream fails with
SharedWindowWithoutSideStream.mtp policy: shared latent windows …) now asserts the new one: 1, 2,4 and 8 segments keep the side stream on one GPU, and none has it at two ranks.
No documentation change: the recipe already says passes of up to a window's rows run the shared expert on the side
stream on one GPU.
Receipt
Raw receipts: receipts (
README.mdmaps every file to its binary).Environment: this branch at
33d0db58172efe1f05a30e02d7006827547cfa2bonmaind46d17a784758b8a8b66badde1f728f36bdc9541.main's three commits after v1.1.0 change onlyapp/,docs/andREADME.md, so the GPU runs used v1.1.0(
76aafcf2) as the base. The measured branch build was v1.1.0 plus this commit and a separate commit (its ownpull request) that copies MTP confidences once per shared round. Without
--mtp-confidence, which no run here sets,that commit only adds up to 8 small device-to-host copies and an event record after each batched draft. Builds come
from clean checkouts: zig 0.17.0 and nvcc 13.0 fatbins for sm_121, then
zig build native/installwith-Doptimize=fast -Dstrip=true -Dtarget=aarch64-linux-gnu.2.28 -Dcpu=baseline -Dversion=1.1.0.tensorfold-nativesha256: base
04167a172c847952737a4b401fb5945b74d598a51312ed19f4e6ddd974015088, measured branchec0ff22f7bdb5354c3faa8d5e1db125fcfbbcbf329df70042f3ca25b02789c69; this tip builds to119f25c8ce8eb2564ef48ef4a3021ab4158411c2b362cb313fe7d7d66a6034fc. Two DGX Spark (GB10), driver 580.173.02,CUDA 13.0. Checkpoint
nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-NVFP4@82d93699acd3be9e4617c53360fe5b3f5dbeb1b3.Every speed hold's server ran as
serve <checkpoint> --context 131072 --parallel auto --vision --thinking(8streams) in a fresh
HOME, so each timed its own window costs, withTF_HEAT_HIGH=85 TF_HEAT_LOW=75.Exactness:
tf-cuda-test shared-fork:PASS shared-fork (checkpoint): 1558 (layer, rows) cases, lone and shared, the forked delta byte-equal to the one-stream delta, and the same line for(full)(41 layers × (32 lone widths + 3 streamcounts × 2 widths)).
tensorfold shared-widths <checkpoint> prompts-ids.json --streams N --max-tokens 400: 2 streams 798 of 798 keptrows equal serial (43 shared windows), 4 streams 1596 of 1596 (71), 8 streams 3192 of 3192 (132).
Spark and 144 of 144 on the second.
bench.py streams(1, 2, 4 and 8 streams): every reply equals its promptalone. One stream,
bench.py decode: drafted equals"draft": falseon every hold. The hashes are the same onthe base and the branch: count
1b3d78d3b1bfd175…, prose71494803187745a9…, code3d4d30129aebb7a2….Decode speed. Identical requests released together run in one of two modes on every build. Either request 2 is
admitted one prompt pass after request 1 (on time), or a lone round later (late, about 240 ms of lag instead of
about 90). On count, late waves are about 20 % slower on the base too, so a median over waves mostly reports which
mode it caught. The table compares the base and the branch within the same mode (
scripts/modes.py): the median wavetok/s (all replies' output tokens over dispatch to last token, 400 tokens each, greedy, thinking off) of the
measured waves in each mode, with each mode's wave count in brackets.
First Spark, holds in the order base, branch, base:
Second Spark, holds in the order base, branch, base:
In the same mode, count gains 1–2 % at 2 to 8 streams on both Sparks, and prose about 3 % on the first. Prose at 2
streams is a weak comparison: the two base holds drafted differently (179.5 and 221.3 rounds a reply, the branch
181.5). On the second Spark, the branch's prose 4-stream waves all reached first text later (median 840 ms against
221 and 272) [not traced]. Their decode rate from first to last text was 105.77 tok/s against 102.81 and 102.15.
bench.py streamsaggregate at 1/2/4/8 streams on the first Spark: base 52.35/46.87/65.52/90.51, branch52.75/47.32/66.16/90.70, base 52.73/46.97/64.85/89.42. One stream is unchanged, as expected, since lone windows
already overlap: count 95.65 / 95.82 / 95.71 tok/s (base, branch, base; second Spark).
Prompt speed: n/a. Only
verifySharedpasses more than one segment toroutedWindow, so prompt passes run the samelaunches on the same streams as before.
Tests run:
zig build test2413 passed, 9 skipped, 0 failed (base: the same; nohost test is added, one changes its assertions).
zig build test-kernel-contract: 43 of 43.zig build test-golden: 306 of 319 equal, 0 unexpected differences (base: the same).zig build fuzz-cortheon:8 of 8.
zig build test-nemotron-mtp-policy-host: 10 of 10.zig build compile-cuda-tests: builds.zig fmt --check zig build.zig: clean.tools/zig/lean_check.py: 503 problems, the same 503 as the base, 0 new.shared-fork2 of 2 PASS andshared-widths3 of 3 PASS (above);cached-plans-tp2on two ranks (below).FAIL shared-fork: SharedWindowWithoutSideStream.gpu/mutant-no-join.diff) fails at its first case:FAIL shared-fork (checkpoint): layer 0 at 1 rows: first difference at byte 0, 2048 of 2048 words differ(NaN for every word).host/before.diff): 9 pass, 1 fail, at the sharedwindows' side-stream assertion.
Two ranks (TP=2, two GB10s over RoCE): ranks keep one stream, unchanged by this pull request.
tf-cuda-test cached-plans-tp2with the measured branch build passes on both ranks:PASS cached shared plans: world 2, rank 0, every width equals an on-demand plan, then prompt-cuts' cut, resumed, background and step-aside passes. Servedtwo-rank identity is partial. With NCCL 2.32.3 rank 0 was serving 60 s after start, and
bench.py decodegave countand prose drafted equal to
"draft": false(1b3d78d3b1bfd175…,71494803187745a9…). These are the same tokens asone GPU and as the stock 1.1.0 release at TP=2. The harness's 8-minute limit stopped the server during the code
requests; the client had paused three times before for the node to cool. (NCCL 2.28.9 hangs two-rank serving on every build we tried, the
stock releases included; reported separately.)
Not run, and why: Metal (no Mac here; the change is CUDA-only). A non-latent Nemotron: its condition is unchanged
(
f.c.latent > 0).tf-cuda-test kernel-contract: no kernel changed (this tip's fatbins equal the measured build's,83 of 84;
glm_quant.fatbindiffers among every build compared, from the same source). The mutant ran only with theside stream held back.
tools/bench_openai.py/bench_concurrent.py: the decode receipt uses the wave clientabove, whose replies are checked against their reply alone, and the speed holds ran before this branch was cut
from
main. Resumed against fresh prompts: not exercised separately; no prompt-path or cache code changes.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Drafted vs"draft": falseand concurrent vs alone measured above; resume not exercised separately.)shared-forklone and shared.)SUMMARYline is in the receipt. (No kernel changed.)shared-forkis atf-cuda-testcommand that takes the checkpoint.)