Skip to content

Nemotron 3.5 Bolt on CUDA: the shared expert runs on the side stream in decode windows - #2847

Merged
ashhart merged 3 commits into
mainfrom
lead/bolt-shared-side
Nov 16, 2026
Merged

ashhart merged 3 commits into
mainfrom
lead/bolt-shared-side

Conversation

@ashhart

@ashhart ashhart commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Nemotron 3.5 Bolt ran each layer's shared expert serially after the routed experts on the main stream, and planned it over an all-zero id list every layer. Super already forks its shared expert onto the side stream (cuda_latent.run, forked), measured at +2.1-2.5% decode on one GPU. This ports that design to Bolt.

What changes:

  • cuda_state.zig: Bolt's shared slot is sized for every window row, its one-expert shared layer is planned once at load for rows 1 to windowRows, and the shared expert gets its own act and out rows, so the routed path's plan, act and ymoe buffers are never shared.
  • cuda_forward.zig (latentExperts): in a decode window with a side stream, the shared up and down kernels run on f.side between a fork and a join; the main stream waits for the join before addBf16. Windows without a side stream (two ranks, a dump run) run the same kernels serially; prompt chunks are unchanged.

Exactness: the shared and routed experts compute the same values into separate buffers with the same kernels and plans, and the sum happens in the same order after the join; the separate buffers are what make the fork race-free.

Checks: a host test that Bolt's shared slot covers the cached plans for every window row (main sized it as shared_words); shared-fork extended to Bolt with its shared output NaN-poisoned and the side stream held back. test-bolt-host (471/475, 4 skipped on macOS), test-modelopt-host, test-nemotron-window-host, compile-cuda-tests -Dtarget=aarch64-linux-gnu, zig fmt --check and the lean count pass.

Still to run before landing: tf-cuda-test shared-fork with Bolt on a GB10, and Bolt decode at 1 and 4 streams on one GB10, main against this branch, replies equal (about +1-3% expected from Super's numbers).

For #2840.

  • Synthena (Ash's Agent)

@ashhart

ashhart commented Nov 11, 2026

Copy link
Copy Markdown
Owner Author

Device result on a GB10, Nemotron 3.5 Bolt, main against this head (base-new-new-base, run 1 excluded): identical replies and faster everywhere. One stream +2.9% to +3.0% (chat and code, greedy and sampled), four streams +1.4% to +2.1%. That's in line with Super's side stream (#1002). It lands after an independent read.

  • Synthena (Ash's Agent)

@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Status: this branch now sits on today's main. Two files conflicted:

  • CHANGELOG.md: both lines are kept.
  • zig/src/families/nemotron/cuda_forward.zig: main's CUDA EXL3 grouped experts: launch and size storage at the caller's tile and pair count #2843 added a pair count and a tile to every grouped expert launch. Bolt's shared expert launches now pass one pair a row (rows) with tile 16 in decode windows (:313-314 on the side stream, :339-340 without one). Outside a window they pass rows with the prompt or decode tile (:346-350), which is what main's serial shared expert passed. Nothing else changed.

I also read the change on its own and found nothing to fix:

  • In a decode window, the side stream reads only b.y, the shared expert's weights and its fixed plan in b.shared (zig/src/families/nemotron/cuda_state.zig:381). It writes only b.sact and b.sout (zig/src/families/nemotron/cuda_forward.zig:303-304). Nothing on the main stream writes those buffers before it waits on the join at zig/src/families/nemotron/cuda_forward.zig:353.
  • The fixed plan borrows rank and hist from b.plan, which the routed path rewrites while the side stream runs. Decode kernels never read those two words. Only the wide planner does (zig/src/cuda/grouped.zig:74-81).
  • Bolt never reaches forked or sharedPlan, which still use the old shared_words layout. experts sends Bolt to latentExperts first (zig/src/families/nemotron/cuda_forward.zig:266), so moving Bolt's b.shared to the per-row plan layout is safe.
  • Two ranks and a dump run take the same kernels on one stream. Their fixed plans come from the same plan call at load, with the same inputs the per-layer call had. Prompt chunks keep the per-layer plan.

The Bolt host tests and the Linux CUDA compile (engine and device tests) pass on the rebased head.

One check is still owed before this lands: tf-cuda-test shared-fork with Bolt on a GB10. The decode A/B above already showed identical replies.

  • Synthena (Ash's Agent)

… windows (#2840)

Bolt sizes its shared slot for every window row and plans its one-expert shared layer once at load for rows 1 to windowRows, with its own act and out rows, so the routed path's plan, act and ymoe are never shared. In a decode window with a side stream the shared up and down kernels run on f.side between a fork and a join; the main stream waits for the join before addBf16, so the sum keeps its order. Windows without a side stream run the same kernels serially; prompt chunks are unchanged. shared-fork covers Bolt with a NaN-poisoned slot and the side stream held back.
@ashhart
ashhart force-pushed the lead/bolt-shared-side branch from b70c993 to 0663101 Compare November 16, 2026 09:57
@ashhart
ashhart merged commit a437511 into main Nov 16, 2026
2 of 10 checks passed
ashhart added a commit that referenced this pull request Nov 16, 2026
@ashhart
ashhart deleted the lead/bolt-shared-side branch November 16, 2026 09:57
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