[bugfix]: fix modular ops activation checkpoint recomputation - #1716
[bugfix]: fix modular ops activation checkpoint recomputation#1716shaoxiongduan wants to merge 3 commits into
Conversation
Merge Protections🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🤖 CI
🔴 PR merge requirementsWaiting for
This rule is failing.
|
|
/merge |
alexzms
left a comment
There was a problem hiding this comment.
LGTM. Verified on GB200: ops now wraps per block and retains attention (6 flash_fwd launches across 6 blocks, vs 12 under full), with loss and input grad bit-identical to no checkpointing, and func.name() never raises on the ops a real step dispatches.
The red checks look stale — builds #4878/#4905 fall in a window where unit-tests were red repo-wide (#1726 and #1739 too), and ./fastvideo/tests/train/ passes on this branch locally (161 tests). Worth a CI re-run rather than a code change.
The branch was rebased and materially updated after this review (SM100a coverage, regression tests, and documentation). A fresh exact-head approval is required after CI.
9a19a74 to
2e2889c
Compare
|
/test full |
|
/merge |
|
/test fastcheck |
|
/test full |
The modular trainer's `ops` checkpoint policy matched a small set of op objects and wrapped the transformer root. Custom attention backends therefore fell through to full recomputation, while root-level replay erased the intended per-block selective behavior. Wrap each discovered transformer block independently and match supported fused attention operators by exact dispatcher name. Retain fused SDPA, FastVideo FlashAttention, and autograd-enabled block-sparse attention outputs. Do not retain parameter collectives or inexpensive matrix multiplies. Keep the change scoped to `fastvideo/train`: shipped legacy training configs do not select `ops`, and that separate stack has not been validated here.
Route modular model plugins through the train-owned checkpoint policy so selective recomputation is not limited to MiniMax H3. Resolve Wan checkpoint configuration once so causal KV-cache snapshots honor role-level overrides, and keep kernel drift coverage portable when the optional kernel package is unavailable.
2e2889c to
cce7fdf
Compare
Purpose
Fix the modular trainer's
opsactivation-checkpoint policy. It previouslywrapped the transformer root and retained only a small set of PyTorch op
objects, so custom attention backends silently fell back to full attention
recomputation. Several modular model plugins also still imported the separate
legacy-training helper, which meant the corrected policy reached MiniMax H3
but not the other modular families.
Changes
import-time dependencies on optional backend registrations.
block-sparse attention forwards, including the current SM90, SM100a, and
Triton VSA ops.
the selective policy sees a retainable attention boundary.
modular trainer's checkpoint helper; the legacy training stack is unchanged.
checkpoint-safe causal KV-cache snapshots.
fastvideo_kernelisunavailable on a supported platform.
fullversusopsmemory/runtime tradeoff and correct thecanonical example-config path.
Supported and fallback paths
opsretains supported dispatcher-visible fused attention outputs and canreduce backward recomputation when memory headroom exists. It uses more
activation memory than
full. Math SDPA, VMoBA, FA3, andATTN_QAT_TRAINdonot expose a retainable dispatcher boundary today, so their attention still
fully recomputes under
ops. Memory-constrained jobs, including tight GB10configurations, should retain
full.Regression coverage
The CPU behavioral suite uses a real autograd-enabled custom op across four
transformer blocks. It verifies:
full, 4 whenopsretains the custom op, and 8 for an unsupported op;
Fresh verification on rebased head
cce7fdf819a164b616cf946ac0e1889033f66f1e:A real CUDA probe on the local NVIDIA GB10 confirmed that PyTorch 2.12
dispatches the tested shape through
aten::_scaled_dot_product_flash_attention. Theopspolicy executed fourunderlying fused forward kernels across four blocks versus eight under
full,with exact output, loss, input-gradient, and parameter-gradient parity.
Performance evidence scope
The earlier author measurements were single-sequence-parallel-rank GB200
experiments on an earlier/private H3 setup. They show the intended
speed-for-memory direction but are not presented here as a reproducible
current-tree SP=8 benchmark. This change's merge contract is functional
checkpoint behavior and numerical parity; production throughput should be
validated with each job's actual backend, sharding, and memory headroom.
SSIM is not required: this changes which activations are retained versus
recomputed during modular training, not inference output or model weights.
Checklist
mainafter PR [perf] Disable every offload path on unified memory, unblocking MiniMax H3 generation on one GB10 #1715and causal-cache tests