Fix AG groups for custom parallel order - #5754
Conversation
|
Ready for review. Fixes #4261. Local validation passed for the CPU-safe regression and single-rank smoke path; multi-rank NCCL validation needs Megatron CI. |
|
Thanks for the review. Agreed that multi-rank NCCL validation remains the outstanding piece. I do not have local multi-GPU hardware to run that path, but the targeted CPU-safe regression and single-rank distributed smoke passed locally. I am happy to address any CI failures or requested changes once NVIDIA CI is approved and run. |
|
/ok to test 27891de |
Signed-off-by: ANAY DONGRE <dongreanay@gmail.com>
27891de to
9439662
Compare
|
Rebased on the latest The conflict came from #4967 (GTP), which added the New HEAD: Local validation passed (run in
I also re-checked the regression property against the new upstream structure: restoring the hardcoded Multi-rank NCCL validation still requires NVIDIA CI. |
Summary
Fixes #4261.
create_all_gather_groups()was reconstructingRankGeneratorinstances with hardcodedorder='tp-cp-ep-dp-pp'andrank_offset=0. This could produce AG groups whose rank membership did not match the process groups created byinitialize_model_parallel()when model parallel was initialized with a non-default order or rank offset.This change caches the decoder and expert decoder
RankGeneratorinstances created duringinitialize_model_parallel()and reuses them when creating regular and expert AG groups.Changes
RankGeneratorinstances inparallel_state.py.create_all_gather_groups()instead of reconstructing them with hardcoded order/rank offset.destroy_model_parallel().create_all_gather_groups(for_expert_parallelism=True)directly.Testing
python -m py_compile megatron/core/parallel_state.py tests/unit_tests/test_parallel_state.pyBASE_REF=main CHECK_ONLY=true bash tools/autoformat.shtests/unit_tests/test_parallel_state.py::test_create_all_gather_groups_uses_cached_rank_generatorsin an NVIDIA PyTorch base container using system Python/system torchtorch.distributed.runsmoke forcached_rank_generatorsin the NVIDIA PyTorch base containerGPU_COUNT=1; requires Megatron CI