Skip to content

Flash Next native: split graphs at the gathers, one captured step for every sequence (+10-15% one stream) - #9

Merged
BobClawblaw merged 4 commits into
native-v1.0.4from
graphs-perf
Oct 10, 2026
Merged

BobClawblaw merged 4 commits into
native-v1.0.4from
graphs-perf

Conversation

@BobClawblaw

Copy link
Copy Markdown
Owner

Two single-stream speedups on native-v1.0.4, both on by default. Outputs are bit-identical.

Split graphs at the cross-rank gathers (TENSORFOLD_FN_SPLIT_GRAPHS=0 turns it off). A captured step now ends a graph at each partial-sum gather. The gather then runs eager between graph segments, with the same payload, sum and order. On GB10 a gather inside a graph costs about 25 µs, against 16 µs eager, for one row.

One captured step serves every sequence (TENSORFOLD_FN_SHARE_GRAPHS=0 turns it off). Graphs used to be keyed by the sequence's address, so each new request recaptured 40-48 graphs. Every sequence lays out its memory alike, so at capture the change does three things:

  • reads each kernel node's arguments, using cuFuncGetParamInfo / cuKernelGetParamInfo;
  • notes which arguments point into the capturing sequence's allocation or cache range;
  • when another sequence launches the plan, moves just those arguments with cuGraphExecKernelNodeSetParams.

Copy and memset nodes are read too. A plan with a node that touches the sequence and can't be moved keeps the per-sequence key. At most 96 plans are held, and the least recently launched is freed first. Sharing needs split graphs: with gathers inside the graph, the NCCL nodes keep plans per sequence.

Exactness, fn-native on two GB10s:

  • Split + shared, int8: the reply equals the Python engine's; shared rounds equal lone; batched drafts; 5 together; resume; 8 prompts in one pass. All pass.
  • Split + shared, int4: the same checks except resume (not run at int4); all pass.
  • Shared alone, int8: all pass.

Served checks on every variant: structured output 0 failures, 20 sampled replies without errors, resumed turn equal to fresh, URLs. Suite on split + shared: drafts 12/12, concurrent 12/12, behaviour all pass.

Ruler, int8, tok/s (prose / code / structured / list), fresh server:

Variant 1 user 1 user, repeat 1 user after other traffic 16 users
baseline (bc0402c1) 66.9 / 107.3 / 87.1 / 110.8 68.5 / 105.4 / 85.0 / 107.8 66.1 / 104.9 / 84.3 / 107.5 298 / 512 / 383 / 521
split only 72.6 / 115.2 / 91.2 / 115.6 71.3 / 113.0 / 92.4 / 115.7 298 / 513 / 388 / 520
shared only (unshared: NCCL nodes) 67.5 / 103.8 / 81.9 / 108.4 66.3 / 104.2 / 86.2 / 105.8 296 / 510 / 386 / 518
split + shared 73.8 / 122.4 / 100.3 / 123.1 72.9 / 124.3 / 97.0 / 125.2 73.7 / 120.8 / 96.9 / 124.3 300 / 513 / 385 / 521

At 4 and 8 users, every variant is within noise of the baseline. Graph log with split + shared: 96 plans held, all shared, and 0-9 captures a request, against 36-41 before.

…gather (TENSORFOLD_FN_SPLIT_GRAPHS)

The gathers then run eager between the graph segments, the same work in the same order (the payload and the
sum untouched). fn-native's "split" word runs the exactness checks that way.
…FN_SHARE_GRAPHS=0: each its own)

Every sequence lays out its memory alike, so at capture each kernel node's arguments are read (the driver's
parameter info) and the ones pointing into the capturing sequence's allocation or cache range are noted; another
sequence's launch moves just those by the base difference in the executable graph. A copy, memset or other node
that touches the sequence keeps the plan to that sequence. At most 96 plans, the least recently launched freed.
@BobClawblaw
BobClawblaw merged commit 0d83956 into native-v1.0.4 Oct 10, 2026
1 of 2 checks passed
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