Skip to content

[None][perf] Run the Mistral Large 4 SM107 decode query half beside the indexer - #22422

Closed
yt0428 wants to merge 1 commit into
NVIDIA:feat/mistral-large-4from
yt0428:codex/ml4-vr200-pr-attn-side-stream
Closed

yt0428 wants to merge 1 commit into
NVIDIA:feat/mistral-large-4from
yt0428:codex/ml4-vr200-pr-attn-side-stream

Conversation

@yt0428

@yt0428 yt0428 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai summary

Description

In the Mistral Large 4 SM107 (VR200) TP4/TP8 decode target, each layer's attention block now runs its query half on a side stream, overlapped with the indexer.

  • The main stream runs the indexer (K-side projection and key append, Q side, FP8 paged MQA scoring, Top-K) and converts the selection to latent-pool slots.
  • The side stream runs the wq FP8 projection with SSMax, the K-B absorption and, on layers that own a latent, the kv_a projection with RMSNorm, rope and the fp8_ds_mla append.
  • The two halves join before the sparse MLA decode, which reads both. Neither half reads what the other writes: the selection writes only the indexer key pool and the Top-K buffer, and the query half writes only the step scratch and the latent pool.

What changes (mistral_large_4_nvfp4__sm_107__tp4/modeling.py only)

  • DecodeTarget._attention splits into select() and query() closures, run through maybe_execute_in_parallel with a per-target side stream and fork/join events.
  • maybe_execute_in_parallel uses the side stream only under CUDA graph capture, so eager steps and steps with context rows are unchanged.
  • There is no env switch: modeling_v2 routing already decides when this target runs. That is SM107, this NVFP4 checkpoint, 4 or 8 ranks of pure TP, and speculation off or native DSpark. Within the target, the overlap covers generation-only steps in the captured CUDA graph batch range.

VR200 results

Same-build A/B, TP4, with natural DSpark acceptance. This compares the side stream against the serial order, in the run order serial / side / side / serial. The metric is the median GPU forward time of generation-only steps:

Batch Serial Side stream Change
1 9.10 ms 8.58 ms −0.52 ms (−5.7%)
8 16.22 ms 15.56 ms −0.65 ms (−4.0%)
  • The p10–p90 ranges of the two arms do not overlap.
  • A side-stream run that used the serial run's autotuner tactics was as fast as the other side-stream run, so the gain does not come from tactic choice.
  • Batch 8 gains more than batch 1, so there is no sign of SM contention.

End to end, against the current feat/mistral-large-4 tree (this PR's base). Setup: DSpark K3 with a synthetic acceptance length of 2.772, 20 min per point, stream_interval=1, one run per point, on a different node pair from the baseline. Step time is 2.772 / (1/ITL p50).

Point 1/ITL p50 (tok/s/user) Step time Total tok/s/GPU OK / errors
TP4 c=1 289.9 → 310.9 (+7.2%) 9.56 → 8.92 ms +2.0% 146/1 → 146/1
TP4 c=4 271.4 → 292.9 (+7.9%) 10.21 → 9.46 ms +3.9% 244/0 → 245/0
TP4 c=8 216.5 → 228.6 (+5.6%) 12.81 → 12.12 ms +1.6% 456/0 → 462/0
TP8 c=1 312.9 → 332.4 (+6.2%) 8.86 → 8.34 ms +2.1% 146/1 → 146/1
TP8 c=4 297.0 → 313.8 (+5.6%) 9.33 → 8.83 ms +0.4% 246/0 → 246/0
TP8 c=8 237.9 → 253.3 (+6.5%) 11.65 → 10.94 ms +1.8% 467/0 → 480/0
  • The step saving is 0.50–0.75 ms.
  • TTFT p90 is mixed: at TP4 c=8 it went from 1.38 s to 1.48 s, and at TP8 c=8 from 1.51 s to 1.32 s.
  • The single c=1 error also occurs on the baseline.
  • The measured build still had a temporary switch for the A/B's serial order. This PR removes it; the default path is the same code.

Numerics

  • Outputs were not bitwise identical between the serial and side-stream runs. Two serial runs with the same tactics also differed on 21 of 21 requests.
  • The cause is the decode split radix Top-K. It claims output positions and ties with atomics, so the summation order of the sparse MLA changes from run to run.
  • Serial vs side stream diverge at the same scale as serial vs serial.
  • The draft acceptance rate was 0.623 serial and 0.625 side stream.

Not measured yet

  • Speculation off.
  • Batch 9–16.
  • Graphs where all sequences fit in index_topk and the indexer is skipped.
  • A layer- or logit-level numerics comparison.

Test Coverage

No new unit tests. The change only moves work inside the decode target's attention block onto a second stream; the computed values do not change.

The existing accuracy tests run this target on SM107 at tp4 and tp8, with and without DSpark. They were not run for this PR:

  • accuracy/modeling_v2/test_mistral_large4.py::TestModelingV2MistralLarge4Nvfp4Accuracy::test_accuracy
  • accuracy/modeling_v2/test_mistral_large4.py::TestModelingV2MistralLarge4Nvfp4Accuracy::test_accuracy_without_dspark

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

🤖 Generated with Claude Code

…he indexer

In the decode target's attention block, the query projection with SSMax,
the K-B absorption, and the owner's kv_a latent with its rope and
fp8_ds_mla append now run on a side stream under CUDA-graph capture,
concurrently with the indexer (key append, scoring, TopK) and the slot
conversion on the main stream. They join before the sparse decode, which
reads both halves. The selection writes only the indexer key pool and the
TopK buffer; the query half writes only the step scratch and the latent
pool. Outside capture both halves run in order on the main stream.

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

yt0428 commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

/bot skip --comment "Format check only"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #85380 [ skip ] triggered by Bot. Commit: d770d12 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #85380 [ skip ] completed with state SUCCESS. Commit: d770d12
Skipping testing for commit d770d12

Link to invocation

@yt0428 yt0428 closed this Nov 18, 2026
@yt0428
yt0428 deleted the codex/ml4-vr200-pr-attn-side-stream branch November 18, 2026 02:52
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