Skip to content

feat(draft) - Add Dynamic CP Support - #4125

Open
humairafirdowse18 wants to merge 7 commits into
mainfrom
dyncp/nemo-rl-integration
Open

humairafirdowse18 wants to merge 7 commits into
mainfrom
dyncp/nemo-rl-integration

Conversation

@humairafirdowse18

Copy link
Copy Markdown
Contributor

Title

Add initial Megatron dynamic context parallel support

Description

This draft adds dense-model Dynamic CP support to NeMo RL’s Megatron backend while keeping Ray responsible for data distribution.

The Ray driver schedules packed samples across the DP×CP domain and sends workers serializable rank/CP plans. Workers resolve the corresponding MCore process groups locally. Dynamic CP outputs are collected from all CP lanes, reordered into the original sample order, and normalized using unique global token counts.

The current implementation:

  • Supports active CP sizes including CP1 and runtime CP transitions.
  • Handles sequence packing, padding, logprobs, loss scaling, and output ownership.
  • Uses zero-masked placeholders to keep forward/backward collective ordering aligned.
  • Adds a Ray tensor serializer to avoid requiring MCore in the driver.
  • Supports dense models with PP1; MoE and PP>1 remain follow-up work.

Validation

  • Distributed logprob, loss, gradient, and optimizer-update parity tests
  • Active CP1/2/4 with static CP1/2 and TP1/2
  • Qwen3-32B: 10 GRPO steps on 4 nodes × 4 GB200 GPUs
  • Nsight traces from all 16 policy workers
  • Finite metrics and expected importance-ratio/KL values

@humairafirdowse18
humairafirdowse18 requested review from a team as code owners September 14, 2026 16:46
@copy-pr-bot

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

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Sep 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant