Repository navigation
fix(data-plane): broadcast route fragments instead of the dense routes table - #4526
Conversation
|
/ok to test 92246a2 |
zyzhou5
left a comment
There was a problem hiding this comment.
Looks great to me! Thanks.
d8c1c25 to
40ed1c7
Compare
|
/ok to test 40ed1c7 |
40ed1c7 to
e6f7b30
Compare
|
/ok to test 33a2e82 |
yuki-97
left a comment
There was a problem hiding this comment.
Shipping only the valid route fragments instead of the padded 47 GiB dense table is a big improvement for router replay at TP4 x CP4: the replica-group broadcast drops to 1.66 GiB of GPU peak and about 0.55 s instead of roughly 2.6 s, and it reuses the existing dict broadcast, so no new collective is introduced.
The GB300 measurements in the description, including the chunked-broadcast variant that was deliberately left out (0.5 s faster, but about 250 more lines against a ~560 s step), make the trade-off easy to trust.
Scope: the replica-group _fetch path and the _route_plans / _assemble_routed_experts split in worker_mixin.py, plus the new pack/unpack tests.
Checked:
- Pack/unpack layout — 8-byte-aligned offsets make the int16/int64 views legal on peers, and all three
RouteFragmentfields are carried in the per-row index. - Fallback accounting —
record_fallbacks=is_leaderkeeps counts leader-only as on main, so the summation intq_policy.pystays correct. - Leader/peer symmetry — the private blob/index keys are popped before
attach_message_log_view, and the_route_fragments_by_rowsignature change has no other callers. NRL_ROUTE_BCAST=densestill routes through the unchanged_maybe_assemble_routed_expertspath.
Remaining comments are on e2e coverage: no nightly recipe enables deferred routes today, so the fragments branch is only exercised by manual runs.
|
/ok to test a5c0535 |
…s table With router replay, the replica-group leader assembled a dense padded routed_experts table (47 GiB int16 at 86 nodes) and broadcast it, widening int16 to int32 and staging ~4x the table on non-leader GPUs, which OOMs. Behind NRL_ROUTE_BCAST=fragments the leader now broadcasts the route fragments and every rank assembles the table locally. - _broadcast_bytes: NCCL host-byte broadcast through two alternating device buckets so copies overlap the broadcast; GPU staging is 2 x NRL_ROUTE_BCAST_BUCKET_BYTES (default 64 MiB). - _broadcast_route_fragments: index via broadcast_object_list, bytes via _broadcast_bytes; leader streams parts without concatenating, peers take 8-byte-aligned views without copying. - _broadcast_leader_result: shared leader error-envelope protocol, now also used by _broadcast_batched_data_dict. - Route plans are decoded once per fetch; fallback counts stay leader-only. - design doc: docs/design-docs/routed-experts-replica-broadcast.md Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
…cast Replace the custom chunked byte broadcast with a packed fragment blob carried by _broadcast_batched_data_dict. The leader packs each fragment once into a uint8 blob plus a per-row index; every rank unpacks views and assembles the routes table on CPU. No new collective. Fragments are ~1.7 GB per DP rank, so the single-transfer path costs 0.55 s and 1.66 GiB of GPU staging on GB300 (vs 0.065 s / 0.125 GiB for the chunked transport), for ~250 fewer lines. Drop the design doc from the branch; it moves to the PR description. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
NRL_ROUTE_BCAST=dense keeps the leader-built dense table as an escape hatch until the 12- and 86-node end-to-end runs pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
…re nightly Adds a vLLM + router replay + defer_routed_experts_to_policy variant of the nanov3 token_capture nightly (CP=2, so the replica-group fragments broadcast runs). The script reuses the parent driver and gates and adds route checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zhiyu Li <[email protected]>
a5c0535 to
37d1f60
Compare
|
/ok to test 37d1f60 |
Problem
With router replay on, the replica-group leader of each DP rank builds a dense, padded
routed_expertstable for the whole batch and broadcasts it to its TP x CP x PP peers. In job 1053591 (86 nodes, TP4 x CP4, DP 8) that table was 47.13 GiB:NCCL has no int16, so
_broadcast_batched_data_dictwidens the table to int32. Peers then stage roughly 4x the table on GPU (188.5 GiB measured) and OOM. Only about 3.5% of the table is real routes: about 1.7 GB per DP rank. The rest is padding.Fix
By default, whenever routes pass through a replica group (route passthrough on, group size > 1), the leader now broadcasts the route fragments instead of the padded table, and every rank builds the table itself. Host memory per rank is the same as
main, where peers already hold the full table on CPU. SettingNRL_ROUTE_BCAST=denserestores the old dense-table path as an escape hatch._pack_route_fragments/_unpack_route_fragments: store each fragment once in auint8blob, at 8-byte-aligned offsets so peers read them back as views. Each row's index lists only the fragments its route plan uses._maybe_assemble_routed_expertsis split into_route_plans(decode once) and_assemble_routed_experts. Every rank assembles, but fallback counts are recorded only on the leader, as before (once per replica group).Results
GB300, 2 nodes, 8-rank TP4 x CP2 replica group built the same way as the Megatron worker,
NCCL_MNNVL_ENABLE=0. Steady state; arms in each table ran on the same node pair.Tests
On GB300 with NCCL:
tests/unit/data_plane/test_leader_broadcast.py:_broadcast_batched_data_dictover NCCLtest_worker_route_assembly.pyneedsnemo_gym, which isn't in the base venv. It covers the_route_plans/_assemble_routed_expertssplit and has not run yet.Nightly coverage (a5c0535)
New nightly
grpo-nanov3-30BA3B-2n8g-noncolocated-async-gym-single-controller-token_capture-r3-deferreaches the fragments branch:token_capture.defer_routed_experts_to_policy=true+router_replay.enabled=true, CP=2 so the replica group is > 1.max_total_sequence_length=8192/max_new_tokens=1024keep the agent's turns inside vLLM's context, so no rollout is poisoned by acontext_length400..shcalls the parent token_capture driver (same gates), then adds three:route_plan_span_count > 0,routed_experts_row_coverage == 1, norouted_experts_deferred_fallback/*key.test_recipes_and_test_suites.pygoes 4789 → 4805.Ran the real
.shon GB300 (4 nodes × 4 GPUs: 2 train TP2×CP2, 2 vLLM): all gates pass, exit 0 on this PR (W&B) and on #4530 (W&B).Ablation on the same recipe, 6 steps per arm,
[BCAST_AB]timing/peak logging not in the PR:NRL_ROUTE_BCAST=denseAll arms: 0 masked sequences, no NaN,
token_mult_prob_error≈ 1.02. At this small shape the time is the same; the win is bytes and GPU peak, which is what blows up at 86 nodes.Follow-ups
NRL_ROUTE_BCAST=densefalls back to the old dense path.NRL_ROUTE_BCASTinto config, per the config-conventions skill.🤖 Generated with Claude Code