Apply trainer-rank memory floors per context-parallel rank - #951
Merged
Merged
Conversation
Outside TP1/CP1/EP1 the checkpoint, head and MoE floors were disabled, so a cold CP forward fell back to the generic activation factor. Measured on H200 (Qwen3.6-35B-A3B, 8 layers, EP1), cold peaks are 472-550 KB per local token at CP1, CP2 and CP4 alike, while main predicted 5.27 GB against 23-52 GB per CP rank. Price the floors from rows on the most loaded CP rank (an even share in the lower bound) and let CP, and EP for checkpoint retention, use them. EP dispatch working sets remain unmodeled. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 24, 2026 17:34 — with
GitHub Actions
Failure
Review follow-up. Width probing built group rows from global packed counts, so with the floors now enabled under CP it priced them about cp times too high, rejecting widths the exact planner would admit and recording a check that disagreed with the admitted plan's cost. Under CP every probe now uses the existing exact-plan fallback. A TP1/CP2 regression with uneven rank ownership checks that the probe defers, the per-rank floor is active, and the split lower bound stays below exact required and retained costs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 24, 2026 18:15 — with
GitHub Actions
Failure
Second review round. With every CP probe on the exact-plan fallback, width search retried memory-minimal layouts only on a memory failure; a cost-optimal layout that fit but exceeded the profile's trust window was rejected without trying full sharing, which main's cheap probe did. The fallback now retries in both cases (all conditions are DP-synchronized). A regression with unshared cost-optimal layouts reaches width 15 (width 8 without the retry), the CP bound test also covers an even per-rank share, and the probe docstring notes the CP deferral. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 24, 2026 18:42 — with
GitHub Actions
Failure
When the estimator is unavailable, the minimum wave used only the cost-optimal layout. A profiled layout outside the trust window was admitted cold even when full sharing was trusted. Apply the same DP-reduced retry the width probes use. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 24, 2026 19:58 — with
GitHub Actions
Failure
Group rows now read the plan signature's CP size, so the None stub failed before the injected pricing error. Production signatures always carry a topology. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
deployed
to
trainer-rank-gpu-validation
September 24, 2026 20:56 — with
GitHub Actions
Active
This was referenced Sep 24, 2026
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.
Partially addresses #949.
Outside TP1/CP1/EP1, every model-aware memory floor was disabled:
_moe_output_bytes_per_tokenreturned 0 unless the shape was TP1/CP1;_checkpoint_memory_floorreturned(0, 0)unless the topology was(1, 1, 1)with EP(1, 1);_head_workspace_byteswas gated the same way.So with no profile yet, a CP forward fell back to the generic activation factor,
packed × hidden × 2 B × activation_factor. In the #949 CP2/EP2 report, the admitted 44.68 GB prediction is exactly that fallback: 779,067 × 2,048 × 2 × 14.Measurements
These are component measurements: local H200s, Qwen3.6-35B-A3B, random weights, EP1,
forward_micro_batcheswith forward and backward over ten unique-token requests scaled from #949's first wave (about 195K tokens). They are not full-depth HybridEP qualification.mainpredictionMemory per local token is essentially the same at CP1, CP2 and CP4 (about 470–550 KB cold), so the CP1 floors apply per rank. This PR raises cold CP predictions 3–6×, but they are not yet safe cold bounds:
_gdn_memory.model_shapes/plan_floor), which is still CP1-only. CP predictions per local token (~301 KB) are therefore below CP1's (~356 KB), and warm second calls still exceed them by up to about 22% (CP2 36 vs 29.4 GB; CP4 18.5 vs 15.0 GB).Changes
_plan_group_rowsprices each group at the rows of the most loaded CP rank (_max_rank_model_tokens, the same assignment_plan_retained_tokensalready uses). The split lower bound uses an even share,ceil(rows / cp), which never exceeds that maximum._checkpoint_memory_floorand_head_workspace_bytesrequire only TP1/PP1. Checkpoint retention also applies at EP > 1._moe_output_bytes_per_tokenaccepts CP > 1, since CP shards rows rather than the per-token working set. TP, EP and ETP still return 0.main's cheap probe did. The minimum wave gets the same trust-window retry. Every retry condition is reduced across DP ranks, so all ranks take the same branch. Under CP, full sharing can price higher than the cost-optimal layout, because the busiest rank's rows are not monotone in packed tokens and full sharing has more GDN segments. If the retried layout does not fit, the minimum wave goes to the split ladder, which re-plans the cost-optimal unsplit layout first and admits it. The result matchesmain; the cost is two extra plan-and-price rounds.mainskipped this during admission for CP with full recompute, MoE orno_grad. A memory check computes the assignment twice per group; the second is a planning-bundle cache hit that still re-digests the metadata.Not addressed here
_gdn_memory.plan_floorstays CP1-only; see the shortfall above.Validation
ResourcesUnavailableError), before any test ran.CUDA_VISIBLE_DEVICES=""),tests/unit/test_trainer_rank_*.pyplustest_prefix_tree_packing.py: 1,242 passed on the reviewed code. The planning-status fixture now gives its stub signature a CP1 topology, because group rows read the plan's CP size; that file passes 9/9. The other failures are timing-sensitive distributed tests that pass in isolation on this head and onmain, or flake on both.🤖 Generated with Claude Code