Repository navigation
[DCP V2 3/4] Integrate dynamic CP with standard train and eval schedules - #7047
Open
xiaoyao0115 wants to merge 12 commits into
Open
xiaoyao0115 wants to merge 12 commits into
xiaoyao0115 wants to merge 12 commits into
Conversation
3 of 6 tasks
Contributor
Author
|
/ok to test c6c8257 |
xiaoyao0115
force-pushed
the
dcp-v2-standard-train-eval-schedules
branch
from
September 7, 2026 14:13
c6c8257 to
f42fb7f
Compare
3 of 6 tasks
xiaoyao0115
force-pushed
the
dcp-v2-standard-train-eval-schedules
branch
2 times, most recently
from
September 16, 2026 05:24
9814b68 to
5a7ad87
Compare
7 of 10 tasks
4 of 6 tasks
xiaoyao0115
force-pushed
the
dcp-v2-standard-train-eval-schedules
branch
from
October 1, 2026 08:20
5a7ad87 to
3fc6410
Compare
|
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. |
Contributor
Author
|
/ok to test 3fc6410 |
guihong-nv
reviewed
Oct 12, 2026
guihong-nv
approved these changes
Oct 12, 2026
Signed-off-by: Tailai Ma <58548582+xiaoyao0115@users.noreply.github.com> Signed-off-by: Tailai Ma <tailaim@nvidia.com>
Signed-off-by: Tailai Ma <tailaim@nvidia.com> Signed-off-by: ilml <tolong@nvidia.com> Signed-off-by: Tailai Ma <tailaim@nvidia.com>
Drop the process-group allowlist entries for HybridCPDataLoaderWrapper and hybrid_cp_schedule.py, which this branch deletes, and point the CUDA-graph validation test at dynamic_context_parallel and its new error message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: ilml <tolong@nvidia.com> Signed-off-by: Tailai Ma <tailaim@nvidia.com>
megatron/core no longer reads the runtime CP and TP x CP groups from parallel_state inside get_batch_on_this_rank_for_sequence_packing: callers supply dynamic_cp_group_func, dynamic_tp_cp_group_func and tp_cp_group (or pg_collection.tp_cp). Drop the new global cp_group fallback in get_batch_on_this_cp_rank; every caller passes cp_group. This keeps the process-group usage check passing without growing its allowlist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: ilml <tolong@nvidia.com> Signed-off-by: Tailai Ma <tailaim@nvidia.com>
Signed-off-by: Tailai Ma <tailaim@nvidia.com>
Signed-off-by: Tailai Ma <tailaim@nvidia.com>
Carry pre-created runtime CP and TPxCP maps in ProcessGroupCollection and use the model collection throughout packed batch scheduling and preparation. Keep MPU bootstrap at the training boundary, and reject scheduling fallback to unavailable groups. Validation: 155 focused CPU tests passed; 8 NCCL batch cases passed on each of two GPU ranks; Black, isort, Ruff, Pylint and process-group usage checks passed. Mypy retains the 21 pre-existing diagnostic sites. Signed-off-by: ilml <tolong@nvidia.com>
With dp_balanced packing, CP > 1 and both CP layouts at the default zigzag, get_batches_on_this_cp_rank shards each document with _get_batch_on_this_cp_rank_per_document_balancing, which indexes row 0 of cu_seqlens_padded. The scheduler batch carried 1-D cu_seqlens, so Transformer Engine received a scalar and failed its cu_seqlens.dim() == 1 check. Pass (1, num_seqs + 1) cu_seqlens and cu_seqlens_padded when building a ContextParallelBatch, matching flatten_batch_for_packed_sequences. Cover the default layout in the static packing CPU test, whose fake partitioner now enforces Transformer Engine's 1-D contract, and in a CP2 test that compares the zigzag batch with the tuple path through Transformer Engine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: ilml <tolong@nvidia.com> Signed-off-by: Tailai Ma <tailaim@nvidia.com>
The StopIteration branch in evaluate runs before on_eval_step_start, so
calling on_eval_step_end there closed a fault-tolerance step section
that was never opened once past warmup ("Tried to close step that is
not open"), and counted a phantom eval step before it. Only restore
config.timers before ending evaluation, and add a CPU test that drives
evaluate through the real FT hooks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: ilml <tolong@nvidia.com>
Signed-off-by: Tailai Ma <tailaim@nvidia.com>
Signed-off-by: Tailai Ma <tailaim@nvidia.com>
xiaoyao0115
force-pushed
the
dcp-v2-standard-train-eval-schedules
branch
from
October 14, 2026 03:00
9fef21a to
27b719c
Compare
Signed-off-by: Tailai Ma <tailaim@nvidia.com>
Use torch.full for Python integer counts to avoid the blocking host-to-device scalar copy. Preserve tensor inputs and the existing loss-scale reductions. Cover integer, implicit, tensor and zero-token counts across runtime CP1/2/4, and replay unmasked per-token sequence auxiliary loss bit-exactly. Signed-off-by: Tailai Ma <tailaim@nvidia.com>
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This is DCP V2 3/4. Dynamic context parallelism now uses the standard train/evaluation schedules and caller-owned process groups, including packed data on PP, VPP, and MTP stages. The obsolete dedicated Hybrid-CP schedule and data-loader wrapper are removed.
The implementation:
dynamic_context_parallel, retaining a deprecated Hybrid-CP CLI/config alias;ProcessGroupCollection;For example, a PP first stage no longer tries to CP-slice removed
labels; static packing no longer dereferences a missing runtime CP size; and twelve 1024-token rows at CP6/capacity2048/alignment32 are split into batches that fit after padding.Original change authored by @zhongbozhu in zhongbozhu/Megatron-LM@a708518.
Series and dependencies
Targets
main; #7045, #7046, and #7207 have merged. #7048 follows this PR. Source lineage includes #2000, #5154, #5483, and #6378. CUDA graph and router z-loss changes are outside this PR.October 14 refresh
Rebased onto main at
7a0024e2c, preserving the runtime-group injection, default-zigzag fix, and FT evaluation fix. DCP initialization uses main's current token-rank generator, and activation recomputation retains main's precision-aware checkpoint implementation.The follow-up fixes the CI fixtures identified in the previous data/models/transformer failures: canonical dynamic-CP config fields and packing capacity, the scheduled
ContextParallelBatchinterface and flat CUDA batch schema, layout-state mask lookup, and the two added Hybrid MoE configuration fields. Required token, dtype, length, and mask checks remain in place.Validation
20153993completed with exit code 0: 581 passed and 113 existing conditional skips on every rank, on headdedb587dc. All previously failing data, Hybrid model/config, and residual-recompute cases passed. The run also covers default-zigzag CP2, PP/VPP packing, runtime CP1/2/4/8 router counts/gradient scaling, SP masks, and FT evaluation. The validation container uses Torch 2.12 development and Transformer Engine 2.14 development builds.dedb587dchas been triggered. Linting passed; the remaining tests are waiting for the protectedtestenvironment queue. The current account cannot approve that environment, and reviewer/codeowner approval is still required.Contribution process
Pre-checks