Skip to content

fix: bound context-parallel admission and memory accounting - #1138

Merged
bradhilton merged 13 commits into
mainfrom
fix/cp-admission-accounting
Oct 22, 2026
Merged

bradhilton merged 13 commits into
mainfrom
fix/cp-admission-accounting

Conversation

@bradhilton

@bradhilton bradhilton commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Agent: Shazeer

Problem. ART's admission control refused context-parallel work that fits. Before this change, CP8 refused even a 32K forward, predicting 128.6 GiB of extra memory against 61.3 GiB available. The CP>1 profile extrapolated fixed small-root scratch as if it scaled per token. The long-context lanes also found a planner-replay crash at CP>1.

What this changes.

  • Bounded calibration for matching MoE and dense CP2/4/8 geometries. It keeps the worst-rank physical-row floors, full-output charges and collective admission, and never divides a CP1 peak.
  • Dense CP backward charges LoRA workspace (saved factor products and backward workspace) from the selected adapter ranks and target counts. Adapter owners are recognized by type, subclasses included. Any inventory the readers can't fully classify falls back to main's conservative per-layer allowance.
  • CP>1 planner replay records the runtime shape and MoE layer count, so replay works. Older incomplete reports decline replay explicitly.
  • Not included: host activation offload, an earlier prototype here, is excluded. Its per-forward host usage could desynchronize ranks, and it's tracked separately.

Validation.

  • Tests: Megatron CPU CI 1,783 passed / 14 skipped; backend 4,250 passed. Ruff, format and lock pass, and ty has the same 18 diagnostics as main.
  • CP1 unchanged: the 8 pinned values plus 135/144/432 differential cases are identical to main.
  • Measured cells: all five measured rank-8 dense lifecycle cells stay admitted, with predictions at or above measured peaks.
  • Adversarial probes are refused: both rank-768 dense probes at a 550 MB cap, and a GLM rank-512 subclass witness at a 1.15 GB cap.
  • Review: three exact-head Sol review rounds. The final round, at 60b9de6d, is CLEAR-WITH-NOTES.

Limits.

  • No numerical change and no CP numerical qualification; that's separate.
  • The scoped-report replay TypeError already exists on main at CP1.
  • With the opt-in bounded calibration scope enabled, estimates can be below main's by design.

🤖 Generated with Claude Code

bradhilton and others added 13 commits October 21, 2026 21:39
(cherry picked from commit ed3dbb78c2dae42b992fee11e910a6a62bc6293d)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8343c73a83010b4317a11522d5c15afd5fc02ff1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bounded-profile CP2/4/8 scope conflicted with the MoE-only scope
picked just before it. Keep this general condition, as lc-qual's
b31af924 integration did: the signature's trailing clause still
requires MoE memory support for MoE models and an adapted FC1 for
dense ones.

(cherry picked from commit bfedd0be47931e8d19ba2bb01bb67eef91077995)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit faae9cfed73ebdecf89566b41a3215ae50f5ad44)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add opt-in synchronous saved-boundary offload with a fixed declared host budget and separate admission signature. Keep one device boundary, recompute workspace, all pending adapter gradients and complete outputs priced; reject host over-budget plans before forward. Defaults and GPU safety budgets remain unchanged.

(cherry picked from commit 67170e6080609e071b5a0261e93c0f10880e210e)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0b4b671388d4210acec782b5e63d61888ce2a387)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record origin/main's CP1 cold and calibrated requirements, checkpoint floors
and input-gradient terms for dense and MoE roots, with and without the
bounded direct-forward scope, so the CP2/4/8 calibration cannot move them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new offload tests import art.megatron.lora and the Megatron-backed rank
fixtures, so collect them with the Megatron runtime instead of the backend
unit environment, like the other checkpoint memory tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Revert 69d03c7 (upstream 0b4b6713) before removing its host offload dependency. The feature needs collective budget semantics in a separate follow-up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Revert 82284f4 (upstream 67170e60). Cumulative pack-time host usage can fail after preflight on only one rank during repeated forwards. Remove its CI-only test wiring and document the CPU/Gloo repro and required follow-up. CPU checkpoint and gradient tests: 92 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record selected adapter layouts for native dense CP, including attention-only TP1 models. Charge the most-adapted recomputed layer at the largest selected rank for saved factor products plus backward workspace. Freeze runtime parallel shape and observed MoE layers for CPU replay, and refuse older CP reports without those facts.

CPU validation: 370 passed / 14 skipped across targeted accounting, CP1 pinning, loaded-rank admission and CP2/4/8 replay. All five measured rank-8 lifecycle cells remain within their recorded budgets and above allocated peaks. Ruff/format/lock pass; ty has the same 18 diagnostics as base main, with zero in touched production/replay files. The complete Megatron list needs a clean committed tree for acceptance fixtures; rerun follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scalar and historical estimators can declare LoRA targets without supplying selected ranks. Keep the old boundary-gradient allowance beside explicit workspace in that case instead of interpreting absent ranks as zero. Complete rank metadata still uses the derived saved-product and backward-workspace charge. Extend the high-rank regression to the literal metadata-omitting probe. CPU checkpoint/forward-profile tests: 150 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read LoRA subclasses, classify native selected-factor inventories, and retain the per-layer allowance for unknown owners or geometry. Cover the GLM rank-512 escape and inherited/foreign adapter regressions. Move the host-offload handoff outside the repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bradhilton
bradhilton merged commit 416261f into main Oct 22, 2026
4 checks passed
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.

1 participant