Price CP2 recompute per rank on each layer type's layout - #978
Draft
bradhilton wants to merge 7 commits into
Draft
bradhilton wants to merge 7 commits into
bradhilton wants to merge 7 commits into
Conversation
A size-only mirror of the executor's record_for_backward path, beside the code it mirrors: per stage, the Q/K/V flex consumes (padded copies, else contiguous copies of permuted views, or kept gathers and fetch buffers), flex's output and LSE at the execution length, logical copies when padded, and a merge-tape clone for every producing stage after the first. It reproduces the traced CP2 ranks: 0.971 GB for an aligned single stage and 3.07 GB for a padded local plus full-query remote stage. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The checkpoint floor priced every rank on the busiest rank's rows with one mixer width, which over-counted boundaries and GDN and under-counted a rank whose attention runs two full-query stages. At CP2/TP1 with ART's CP core attention, price each rank on its own layouts instead: saved boundaries by each layer input's layout, a recomputed attention layer on attention rows plus what the executor keeps for backward, a GDN layer on GDN rows, and the MoE stage on that layer's rows with routed rows on the EP share. Admission takes the largest rank. Elsewhere the busiest-rank floor is unchanged. A rank can receive more routed rows than it holds, so routed rows are no longer clamped to local rows. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The split search's lower bound priced gated plans with the busiest-rank attention width, above what per-rank pricing can charge; price even-share layouts at the least attention state instead (one aligned local stage per rank). Count flex's saved LSE beside the normalized copy it returns. Share one gate between plan pricing and the bound, checking the topology before model state. Record group layouts in planner evidence. Tests cover the positive gate path against the executor's own plans, the runtime layouts, the softmax-offset gate, tiny and single-head stages, and the lower bound staying below plan cost. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The gate now declines models with several chunks or a decoder without layers before reading them. The bound holds because every rank's total grows with its own rows, so the largest is at least the total at the mean; rounding the even share up can exceed a split's exact cost. The lower-bound test covers even, skewed and odd splits and one long sequence. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
deployed
to
trainer-rank-gpu-validation
September 25, 2026 23:53 — with
GitHub Actions
Active
…planning One head does not make a view of a fused QKV split contiguous, so the mirror now charges the copy flex makes of any full local view; the lower bound still counts only multi-head copies. A partial-query merge tape also keeps its int64 row index. The per-rank layout work now counts toward planning time (about 40-76 ms for a new layout's peer plan, under 1 ms once cached). Tests use typed geometry helpers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 26, 2026 00:24 — with
GitHub Actions
Error
The executor keeps a partial stage's int64 row index even when that stage produced first and recorded no accumulator tape, so charge indices apart from the tape the mirror drops. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bradhilton
deployed
to
trainer-rank-gpu-validation
September 26, 2026 00:31 — with
GitHub Actions
Active
This was referenced Sep 26, 2026
bradhilton
marked this pull request as ready for review
September 26, 2026 15:46
bradhilton
had a problem deploying
to
trainer-rank-gpu-validation
September 26, 2026 15:46 — with
GitHub Actions
Failure
bradhilton
marked this pull request as draft
September 26, 2026 16:08
This branch had an error being 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.
Follow-up to #963 (stacked on it). At CP2, TrainerRank's checkpoint floor now prices each context-parallel rank on its own layouts, instead of pricing every rank on the busiest rank's rows with one mixer width. This makes the estimate correct per rank rather than tighter: on the measured workloads its accuracy is about unchanged.
Why: the two CP2 ranks don't hold the same work.
What changes (CP2, TP1, ART's CP core attention without a softmax offset, gradient groups; everything else keeps the old floor):
retained_stage_record_bytes), kept next to the executor code.Measured against the PyTorch peak on the most-loaded rank, EP2/CP2 on two H200s. Peaks and losses are identical before and after; only the estimate changes. A later fix counts one more LSE buffer per attention stage, which adds under 0.01 GB, inside this table's rounding.
The real-data warm call rises because its rank 1 again runs two full-query stages, which the old floor under-priced.
Limitation. The executor mirror and the layout ledger are validated at CP2 against allocator traces of Qwen3.6-35B-A3B, within 0.3%. No test yet runs the executor itself against the mirror; that needs GPUs. CP4 and other executor configurations keep the old floor. GDN keeps its existing per-row width, now on GDN rows. The EP routing allowance, which accounts for most of the remaining EP2 gap, is unchanged.
Testing: trainer-rank and CP unit tests pass; the table's runs are on local H200s.
🤖 Generated with Claude Code