Skip to content

Add CSA2 chunked scoring and selective recompute compatibility - #7761

Closed
HollowMan6 wants to merge 3 commits into
NVIDIA:pull-request/7500from
HollowMan6:csa2-mhc-recompute-memory-fixes
Closed

HollowMan6 wants to merge 3 commits into
NVIDIA:pull-request/7500from
HollowMan6:csa2-mhc-recompute-memory-fixes

Conversation

@HollowMan6

@HollowMan6 HollowMan6 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #7500.

Summary

  • Compute no-grad CSA2 indexer scores in key chunks (_chunked_csa2_indexer_scores), so the full per-head score tensor is never materialized at once.
  • Allow selective recompute with CSA2 as long as no attention modules (core_attn, gdn_norm_out, gdp_qkv, gdp_in_proj, shortcut_pre_mlp_layernorm) are recomputed. Full recompute is still rejected because it would re-publish cross-layer KV.
  • Recompute single-pass mHC mappings instead of keeping their activations.

@copy-pr-bot

copy-pr-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Keep the existing eager attention contract while bounding no-grad CSA2 score memory and allowing non-attention selective recompute. Recompute single-pass mHC mappings to reduce activation retention.

Signed-off-by: Hollow Man <hollowman@opensuse.org>
@HollowMan6
HollowMan6 force-pushed the csa2-mhc-recompute-memory-fixes branch from ae0bebc to ef16913 Compare September 30, 2026 22:31
@HollowMan6

Copy link
Copy Markdown
Contributor Author

@guihong-nv This is a follow-up PR on top of #7500. It reduces memory by chunking the no-grad CSA2 indexer scoring and recomputing the single-pass mHC mappings, and it allows selective recompute with CSA2 when no attention modules are recomputed. Verified together with NVIDIA-NeMo/Megatron-Bridge#6199. Please let me know if you have any comments.

@HollowMan6
HollowMan6 marked this pull request as ready for review September 30, 2026 22:37
@HollowMan6
HollowMan6 requested review from a team as code owners September 30, 2026 22:37
Copilot AI balanced review requested due to automatic review settings September 30, 2026 22:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Oct 3, 2026
@dimapihtar

Copy link
Copy Markdown
Contributor

/ok to test ef16913

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Oct 5, 2026
Signed-off-by: Hollow Man <hollowman@opensuse.org>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Oct 7, 2026
Signed-off-by: Hollow Man <hollowman@opensuse.org>
@HollowMan6

Copy link
Copy Markdown
Contributor Author

Merged into #8018

@HollowMan6 HollowMan6 closed this Oct 19, 2026
@HollowMan6
HollowMan6 deleted the csa2-mhc-recompute-memory-fixes branch October 19, 2026 23:36
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants