Price the shared-expert return under context and expert parallelism - #966
Merged
Merged
Conversation
The planner dropped a MoE layer's shared-expert return whenever CP or EP exceeded 1, although CP shards rows and shared experts are not expert- parallel. Qwen3.6-35B-A3B traces show the same gated pair per local token at CP1, CP2 and EP2, which left CP2 and EP2 checkpoint workspace 8 KB per token short. Keep TP, PP and ETP at 1. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 25, 2026 08:14 — with
GitHub Actions
Failure
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 25, 2026 08:24 — with
GitHub Actions
Failure
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 25, 2026 08:36 — with
GitHub Actions
Failure
bradhilton
deployed
to
trainer-rank-gpu-validation
September 25, 2026 08:47 — with
GitHub Actions
Active
This branch was successfully 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.
Part of #949. The trainer-rank planner prices a MoE layer's shared-expert return, the output held beside the routed experts' work. It drops that return whenever context or expert parallelism is on. The per-token return does not depend on either: CP shards rows, and shared experts are not expert-parallel. So at CP>1 and EP>1 the MoE workspace was missing 8 KB per local token in checkpoint mode.
Evidence
The data comes from Qwen3.6-35B-A3B allocator traces on H200 (8 layers, 194,753 tokens), replayed on CPU, plus ART's own planner reports from the same runs.
lora.py:1328output andshared_experts.py:127gated output) is 4,096 + 4,096 B per local token at CP1, CP2/EP1 and EP2/CP2. That is exactly what the planner charges in checkpoint mode for a gated shared expert (shared + shared)._shared_expert_output_bytes_per_tokenrequired TP, CP, PP, EP and ETP all to be 1, which Account for grouped checkpoint, head, and enclosing forward buffers #898 introduced as blanket support gating.Change
Tests
tests/unit/test_trainer_rank_shared_memory.py:All five new test cases fail on
main. Locally, on a heavily loaded host, 1,583 trainer-rank unit and acceptance tests pass and three fail:test_planning_failures_and_empty_ranks_use_aligned_statusandtest_optim_step_live_graph_error_is_collectivefail the same way onmain;test_forward_micro_batches_yield_modes_collectively[4]hung once and passed on two reruns.Not covered
The traces also show about 6.4 KB per local token of per-token MoE state that the planner has never modeled, at any CP:
At EP2 the router and dispatch metadata differ (HybridEP), so these are left for a follow-up with its own validation rather than folded into this fix. Today the planner's input-gradient allowance, which is not live at the peak, absorbs both this residual and the shared term fixed here. Neither should rely on that.
This change is independent of #963 (the recomputed-mixer floor); the two touch different code.
🤖 Generated with Claude Code