Skip to content

Broadcast native FLA CP chain state from the group's global owner rank - #920

Merged
bradhilton merged 2 commits into
mainfrom
shannon/919-cp-group-src
Sep 17, 2026
Merged

bradhilton merged 2 commits into
mainfrom
shannon/919-cp-group-src

Conversation

@bradhilton

Copy link
Copy Markdown
Collaborator

Fixes #919.

torch.distributed.broadcast takes a global rank as src. Two collectives in src/art/megatron/gdn/fla_cp.py passed context-parallel-local indices instead: _broadcast_chain_final_state used cp_size - 1 and _suffix_summary_exclusive_and_full used 0. Those coincide with global ranks only when the CP group is range(cp_size), i.e. TP 1 and DP 1. With TP 2 on four ranks the CP groups are {0, 2} and {1, 3}, so the first GDN forward raised ValueError: Global rank 1 is not part of group; DP × CP fails the same way for the second group.

Change: translate through dist.get_global_rank(group, local_index) at both sites. No behavior change for TP 1 / DP 1 (the translation is the identity there). The neighbouring _exchange_summary is untouched: all_to_all_single split lists are group-local by design.

Test: tests/unit/test_fla_cp_group_ranks.py spawns four gloo CPU ranks with strided ({0,2}/{1,3}) and offset ({0,1}/{2,3}) CP groups and checks that every member receives the last member's chain state and that the full-chain suffix summary agrees across the group. It passes on this branch and fails on main with the reported error.

GPU validation: in progress on Qwen/Qwen3.8-27B (48 GDN + 16 attention layers), 4×H200, rank-1 LoRA probe forward/backward, with ART_MEGATRON_TENSOR_MODEL_PARALLEL_SIZE=2 ART_MEGATRON_CONTEXT_PARALLEL_SIZE=2 and with DP 2 × CP 2; the same workload failed on the first forward before this change. I will post step timing and peak memory here when the lanes finish.

🤖 Generated with Claude Code

bradhilton and others added 2 commits September 17, 2026 00:02
torch.distributed.broadcast takes a global rank as src. _broadcast_chain_final_state passed cp_size - 1 and _suffix_summary_exclusive_and_full passed 0, both CP-group-local indices, which only coincide with global ranks when the context-parallel group is ranks 0..cp_size-1 (TP 1, DP 1). With TP 2 the CP groups are {0, 2} and {1, 3} and the first forward raised 'Global rank 1 is not part of group'; DP x CP fails the same way. Translate through dist.get_global_rank.

Fixes #919.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Gloo regression test on four CPU ranks with CP groups {0,2}/{1,3} (TP 2) and {0,1}/{2,3} (DP 2): _broadcast_chain_final_state must deliver the last group member's state to every member, and _suffix_summary_exclusive_and_full must agree on the full-chain summary across the group. Fails on main with 'Global rank N is not part of group'.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@bradhilton
bradhilton deployed to trainer-rank-gpu-validation September 17, 2026 00:08 — with GitHub Actions Active

@bradhilton bradhilton left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review text removed on 2026-09-17; the consolidated review record is in the summary comment on this PR.

@bradhilton bradhilton left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review text removed on 2026-09-17; the consolidated review record is in the summary comment on this PR.

@bradhilton
bradhilton merged commit 5ada80c into main Sep 17, 2026
7 checks passed
@bradhilton

Copy link
Copy Markdown
Collaborator Author

Consolidated review record (automated agent review traffic removed 2026-09-17)

Change. Fixes #919: two collectives in src/art/megatron/gdn/fla_cp.py passed CP-local indices to torch.distributed.broadcast, which takes global ranks, so GDN context parallelism combined with TP or DP failed on the first forward. Both sites now translate through dist.get_global_rank; TP 1 / DP 1 behavior is unchanged. Adds a four-rank Gloo test with strided and offset CP groups.

Review. Kang routed independent reviews to McCarthy and Minsky; both returned CLEAR for source correctness at ba959aa, noting the PR edits art.megatron so merge eligibility was Brad's decision. Verified: quality-checks, trainer-rank-gpu-validation and the 2xH200 run were green; Minsky ran the new test (2 passed at head, 2 failed on base with the reported error); McCarthy's 36-case routing fixture passed at head and failed 12 on base; author-reported 4xH200 validation on Qwen3.8-27B (CP2xTP2 45.8 s/step, DP2xCP2 33.6 s/step) at the byte-identical parent commit.

Deferred / follow-ups.

  • Nonblocking: the Gloo test asserts cross-rank agreement, not an independently computed suffix summary; eight-rank and CP>2-with-TP topologies remain unexercised.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GDN context parallel × tensor parallel fails: fla_cp broadcasts with a group-local src rank ("Global rank 1 is not part of group")

1 participant