Skip to content

minimax_m3 cuda: opt-in verify window from one graph, refreshed each round - #4610

Merged
ashhart merged 3 commits into
mainfrom
lead/minimax-verify-graphs
Nov 24, 2026
Merged

ashhart merged 3 commits into
mainfrom
lead/minimax-verify-graphs

Conversation

@ashhart

@ashhart ashhart commented Nov 22, 2026

Copy link
Copy Markdown
Owner

What this changes

TF_MINIMAX_GRAPHS=1 (opt-in, default off) runs MiniMax-M3's CUDA decode verify window from one CUDA graph launch instead of about 2,000 eager launches, so the GPU runs them back to back without per-launch host gaps.

A replay of one captured program wouldn't be exact here: MiniMax's attention takes each round's positions as host launch arguments (prep's .pos, the index kernels' at and nb, attnPrompt's at), the index kernels' grid grows with the context, and whether they run at all depends on the context length. So each round records the window's launches again with that round's arguments and updates the held executable in place (cuGraphExecUpdate); if the launches took another shape, the update is refused and a new executable replaces the old one (graph_refresh.zig). Every kernel gets the same arguments in the same order as the eager path, so tokens cannot change.

  • What it saves: GPU launch gaps. What it doesn't: the host still issues every call each round (into the capture), so the gain may be well below the review's estimate.
  • The DSpark drafter is not graphed.
  • Commit 2 re-pins zig/src/cuda/root.zig.

Checks

Host tests for the switch policy, the refresh (update, refused update, new executable) and the launch order against the eager path; fmt, ast-check, the 600-line cap. No GPU or nvcc was available.

Still to run

On two GB10s, MiniMax-M3.1-Flash at TP=2, one stream, plain and DSpark-drafted, switch off/on/on/off with the same prompts: tokens identical in all four runs, and decode speed.

@ashhart
ashhart force-pushed the lead/minimax-verify-graphs branch 6 times, most recently from 02470c2 to 2515d4a Compare November 24, 2026 12:23
TF_MINIMAX_GRAPHS=1 (default off) runs a one-stream decode verify window's
launches through cuda.graph_cache, keyed by rows, sparse attention and taps.
MiniMax's attention takes each round's positions and block counts as launch
arguments, so a held graph cannot be replayed as captured: graph_cache gains
a refresh mode in which a hit records the body again with this round's
arguments and updates the executable in place (a new one when the launches
changed), every rank voting each step, so a failed record sends all ranks to
eager together. The same kernels with the same arguments in the same order;
the ids upload and the draw stay outside the graph.
@ashhart
ashhart force-pushed the lead/minimax-verify-graphs branch from 2515d4a to b297eec Compare November 24, 2026 15:35
@ashhart
ashhart merged commit e30ee20 into main Nov 24, 2026
@ashhart
ashhart deleted the lead/minimax-verify-graphs branch November 24, 2026 15:35
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