Skip to content

Support dynamic context parallel groups in Mamba layers - #7143

Draft
ilml wants to merge 1 commit into
NVIDIA:mainfrom
ilml:pr3791-split/mamba
Draft

ilml wants to merge 1 commit into
NVIDIA:mainfrom
ilml:pr3791-split/mamba

Conversation

@ilml

@ilml ilml commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Lets Mamba layers follow dynamic context-parallel groups: MambaContextParallel gains set_context_parallel_group() (CP-size-derived params refactored into _set_cp_params()), and MambaMixer.forward rebinds the CP group from packed_seq_params.cp_group before in_proj when dynamic CP is active. Independently mergeable — PackedSeqParams.cp_group already exists on main.

Series (split of #3791)

Split of #3791 ("Update Dynamic CP to support sequence packing, MXFP8 and Mamba") against current main, tracked in the Dynamic Context Parallelism project. Original changes by @parthmannan in #3791; hunks already covered by main (via the merged sequence-packing series and hybrid-CP fixes) were dropped, and the rest re-implemented against main's current structure. All PRs target main; merge order:

Order PR Content
any #7143 Mamba dynamic CP SSM wiring for runtime CP groups
1 #7144 Hybrid-CP sequence packing packed microbatches in the hybrid-CP dataloader + schedule
2 #7145 MTP dynamic CP multi-token-prediction loss on the runtime CP group
2 #7146 MoE dynamic CP aux-loss reduction, dispatcher padding, EP sync, loss-scale logging

Contribution process

  • Draft PR per contributing guidelines
  • Commits signed off (DCO)

Refactor CP-size-derived parameter computation in MambaContextParallel
into a _set_cp_params() helper and add a set_context_parallel_group()
method so the CP group (and derived nheads/d_inner/ngroups shard sizes)
can be swapped at runtime. In MambaMixer.forward, when
packed_seq_params.cp_group is set, select the CP group per batch before
in_proj so dynamic-CP sequence packing works with Mamba layers.

Split from NVIDIA#3791; original changes by @parthmannan.

Co-authored-by: Parth Mannan <pmannan@nvidia.com>
Signed-off-by: ilml <tolong@nvidia.com>
@ilml

ilml commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test adab00b

@copy-pr-bot

copy-pr-bot Bot commented Sep 8, 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.

This branch was previously deployed

2 inactive deployments
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