Skip to content

[Fix] Capture complete Nemotron auxiliary hidden states - #40801

Merged
ch-wan merged 1 commit into
mainfrom
cheng/hot-fix/nemotron-aux-capture
Sep 23, 2026
Merged

ch-wan merged 1 commit into
mainfrom
cheng/hot-fix/nemotron-aux-capture

Conversation

@ch-wan

@ch-wan ch-wan commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

This PR is part of a stack (oldest at bottom):

Motivation

With DP attention, Nemotron Attention/Mamba outputs remain partial across attention TP until the next layer prepares them. Auxiliary hidden-state capture currently adds these partials directly to the residual. Also, the first captured tensor aliases the input residual and can be overwritten by a later in-place norm.

Modifications

Reduce a copy when capturing a DP Attention/Mamba output, preserving the live tensor for the next layer's normal reduction. Clone the initial snapshot before it becomes the mutable residual. Reuse the capture helper at intermediate boundaries and the model endpoint.

Add a regression through the model and actual decoder/communicator forwards, covering Attention, Mamba, consecutive Attention, endpoint capture, TP1/TP2, and DP enabled/disabled. It checks snapshots against an independent reference and verifies that enabling capture leaves the main output unchanged.

Accuracy Tests

Stacking and comment cleanup preserve the executable AST of the tested revisions.

  • All 12 new regression subcases fail on main (incomplete partials or snapshot aliasing) and pass with this fix.
  • Capture, shared-add, weight-loading, and communicator fusion-gate tests: 29 passed, 12 subtests passed.
  • B200: attention TP2 with DP1 and DP2, real NCCL collectives and RMSNorm, BF16, decode and extend. Snapshots match the mathematical reference; capture enabled/disabled yields identical main outputs. 12 rank-local CUDA graph captures and 36 replays with changing inputs match eager exactly.
  • Pre-commit checks pass, including CI registration validation.

The GPU probe uses synthetic Attention/MLP outputs. Full-checkpoint auxiliary-state/speculative decoding has not been run.

Speed Tests and Profiling

No performance benchmark. Capturing a DP Attention/Mamba partial now adds a clone and an attention-TP reduction for that snapshot. Capturing the initial input adds a clone. Forward passes without auxiliary capture do not execute the new helper.

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): 🚫 Run #35923794078
Latest PR Test (Extra): 🚫 Run #35923793342
Latest PR Test (AMD ROCm 10): ❌ Run #35923793607

@ch-wan
ch-wan force-pushed the cheng/hot-fix/nemotron-aux-capture branch from b24b22e to 930a93f Compare September 23, 2026 21:39
@ch-wan
ch-wan merged commit 379e8f9 into main Sep 23, 2026
26 of 36 checks passed
@ch-wan
ch-wan deleted the cheng/hot-fix/nemotron-aux-capture branch September 23, 2026 21:39
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