Skip to content

fix(mtp): support contiguous context-parallel THD rolls - #5946

Closed
FDecaYed wants to merge 1 commit into
NVIDIA:pull-request/4495from
FDecaYed:codex/mtp-contiguous-cp-roll
Closed

fix(mtp): support contiguous context-parallel THD rolls#5946
FDecaYed wants to merge 1 commit into
NVIDIA:pull-request/4495from
FDecaYed:codex/mtp-contiguous-cp-roll

Conversation

@FDecaYed

Copy link
Copy Markdown
Contributor

What

Extend MTP packed-sequence rolling so contiguous context-parallel THD shards roll across rank boundaries without crossing packed-sequence boundaries.

  • retain the existing zigzag path as the default;
  • dispatch through the duck-typed cp_partition_mode contract used by the dynamic-CP stack;
  • exchange only the boundary token needed by adjacent contiguous ranks;
  • allow callers to choose the boundary fill value, including True for padding masks;
  • cover values and boolean padding masks on two contiguous CP ranks.

Stack

This PR is stacked on #4495, which fixes padded cumulative-sequence boundaries for MTP THD rolling.

The future dynamic-CP integration supplies PackedSeqParams.cp_partition_mode; this focused PR deliberately does not pull that broader data/attention stack into MTP. Its test exercises the same duck-typed contract directly.

Provenance

Testing

  • isort --check-only, ruff, Black --check, Python compilation, and git diff --check passed for both changed files.
  • Two-rank CUDA execution is delegated to PR CI because this local macOS host has no CUDA devices.

Add configurable boundary-fill semantics and roll packed THD MTP inputs across contiguous context-parallel shards without crossing sequence boundaries.

Reconstructed from the MTP portion of NVIDIA#5795 on top of the padded-cu-seqlens fix in NVIDIA#4495.

Signed-off-by: Deyu Fu <Deyu.Foo@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@FDecaYed

Copy link
Copy Markdown
Contributor Author

/ok to test f57f2df

Copy link
Copy Markdown
Contributor Author

Closing this draft until Round 1. Its logical successor is P9 (contiguous-CP packed MTP roll), rebuilt on main after external prerequisite #4495 merges. Tracking PR: #5795.

@FDecaYed FDecaYed closed this Jul 23, 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.

1 participant