Repository navigation
feat(megatron): add nccl_reshard M-to-N refit for Megatron generation - #3739
Conversation
b2b7173 to
898f628
Compare
|
Thanks for adding Megatron generation support to the NCCL-reshard path. I have one architecture concern about how the backend extension point is represented. The intended design separates backend-agnostic This implementation creates an equivalent This appears to come from Could we preserve the existing extension point by separating the source and destination refit builders—either as backend-owned components or through another explicit role boundary—with each exposing the standard |
ok I think I am addressing this better now. I am just waiting on some other PRs going into bridge to get merged and then I can clean up and add more functional tests for review |
|
/ok to test 351061d |
0d67aa0 to
584149e
Compare
|
@wdykas Sorry, I cancelled the previous CI run because it was hanging on this unit test job for 3 hours. Please resolve merge conflicts and we can try again. |
ok will do now |
yuki-97
left a comment
There was a problem hiding this comment.
Scope: re-review of the three fix commits since the last pass (407aca1) — ea842d7, b95991f, a8d2bcd.
Checked:
- Open threads — all 7 re-audited against the current head rather than the fix diffs; all resolved, each replied on individually.
- Config resolution — every
--config-bearing script undertests/run throughload_config_with_inheritance+parse_hydra_overrides, and every shipped config resolving to Megatron generation walked forrefit_transport. - Docs —
refit.mdand the nccl-reshard design doc checked claim-by-claim against the code at head.
Remaining comments are all on the new commits: two config regressions introduced by the fixes, and one doc claim the new ETP guard contradicts.
Signed-off-by: wdykas <wdykas@nvidia.com>
|
/ok to test 6a2b83d |
Signed-off-by: wdykas <wdykas@nvidia.com>
Signed-off-by: wdykas <wdykas@nvidia.com>
|
/ok to test 1475066 |
Signed-off-by: wdykas <wdykas@nvidia.com>
|
/ok to test 66a132d |
Signed-off-by: wdykas <wdykas@nvidia.com>
|
/ok to test efff98b |
Signed-off-by: wdykas <wdykas@nvidia.com>
|
/ok to test 4194bf5 |
Signed-off-by: wdykas <wdykas@nvidia.com>
|
/ok to test a168c70 |
Eleven commits, two conflicts. nemo_rl/algorithms/single_controller.py -- NOT a keep-both. #3925 (telemetry for rollout checkpointing) replaced the retry-count approach with a reason-typed result: it deletes _MAX_CONSECUTIVE_ROLLOUT_CHECKPOINT_FAILURES and adds the _RolloutCheckpointSaveResult dataclass in the same place this branch's _SUPERVISOR_DRAIN_TIMEOUT_S sits. Resolved as ours + main's dataclass, with the constant dropped: it has no remaining users anywhere in the merged tree, this branch never referenced it, and RolloutCheckpointAttemptReason is imported and used by the replacement. Keeping it would have resurrected a name main removed on purpose. tests/unit/environments/test_nemo_gym_utils.py -- adjacency, as before. #3368 (actor failure and teardown ownership) appends module-level tests to the same end-of-file this branch appended TestUnresolvedAgentRefsAreDiagnosable to. main's functions first, this branch's class after. The other nine merged clean, including #3739 (nccl_reshard M-to-N refit for Megatron generation) and #4063 (refit_with_reload_api in the v2 entrypoint), both of which touch refit paths this PR hardens. Verified after the merge: every artefact this PR adds is still present (_refit_participants, _SUPERVISOR_DRAIN_TIMEOUT_S, the aggregated router drain, shard_liveness_ref, record_weight_version, should_rebuild, restart_backoff_s, the router's transport-cause log), submodule pins match main on all three, and 1398 tests pass across single_controller, fleet_health, the generation router, the gym utils and weight_sync. pyrefly reports two new import errors beyond the known one, all three in data_plane/adapters/transfer_queue.py from #4103, inside a try/except ImportError that exists to report exactly that drift. Optional TQ submodules absent from this container, not a regression. Signed-off-by: asolergibert <asolergibert@nvidia.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
What does this PR do?
This PR extends the existing
nccl_reshardM-to-N weight-refit transport to support Megatron generation and consolidates Megatron refit selection under the commonpolicy.generation.refit_transportsetting.For Megatron generation:
refit_transportnullmcoremcore_generation_config.refit_backend.nccl_reshardxferdtensor, with Megatron as the destination.Native MCore refit supports
gloo,nccl, andnccl_m2n. Thenccl_m2nbackend is non-colocated only.nvshmemremains rejected while #3646 is unresolved.Design
The
nccl_reshardpath retains its existing dual-path design:prepare_refit_info,build_hf_to_local_param_map, and refit entry points.The destination declares its required payload representation through
RefitPayloadMode:hf_exportpreserves the universal HF-named, backend-independent representation used by vLLM and other destinations.logical_weightsis an explicit Megatron-to-Megatron exception. Megatron generation can assume a Megatron training source and request logical weights suitable for MCore destination storage.This keeps the existing vLLM FP8 export behavior unchanged and prevents physical FP8 payloads from being mixed with incorrectly materialized BF16 weights.
Precision and parallelism
Megatron generation supports:
inference_optimizedMoE generation is normalized to ETP=1 because MCore inference linears do not currently implement ETP greater than one.For a Megatron destination, quantized sources are transferred as logical BF16. MXFP8 destinations receive into bounded, short-lived BF16 staging buffers and quantize into persistent MCore MXFP8 storage. The wire representation remains BF16 because Transformer Engine and MCore MXFP8 layouts are not byte-compatible.
Native MCore staging is configurable with:
nulluses NeMo-RL's existing dynamic packed-buffer target: 2% of total GPU memory, capped at 5 GiB. A positive byte count overrides it.Compatibility
refit_transportdefault remainsnull.refit_transport: mcoreexplicitly, preserving their current behavior.refit_backendandrefit_execution_batch_bytesare only used withrefit_transport: mcore.nccl_reshardpayload behavior is preserved.Current limitations
nccl_reshardrequires non-colocated Megatron training.nccl_reshard.Validation
nccl_m2n, staging configuration, payload modes, MXFP8 handling, and TP/PP/EP/ETP geometry.grpo_megatron_nccl_reshard_refit.shwith BF16 coverage and a GB200 MXFP8 mode.Before your PR is "Ready for review"