[AffineIR] Affine storage maps for live ZeRO parameters and optimizer states #8885
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 380 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.356
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8885"
general
weight: 0.35
jinyouzhi
Summary
Describes, as affine maps in global ranks, where a live ZeRO engine stores each element of a parameter and its optimizer states, so
plan_transfercan read from or write into training storage directly (e.g. training → rollout weight sync) without gathering full parameters first.zero_affine.py-
zero_param_storage_affine_map: low-precision replicas under ZeRO-0/1/2 (DP or expert-DP group),ds_tensorpartitions under ZeRO-3, padding excluded.-
zero_optimizer_storage_affine_maps: fp32 master + optimizer states (ZeRO-1/2, bf16 optimizer, ZeRO-3).-
zero_param_storage_shard/zero_optimizer_storage_shard: flat views of ZeRO's own buffers matching the maps.-
autotp_storage_affine_maps: AutoTP layout × ZeRO storage, one all-gather over the TP group.affine.py:nest_affine_mapscomposes a layout map (TP/EP shard placement) with per-shard storage maps. A process's stored run of an N-D shard is described as at most2·ndim−1N-D boxes in the parameter's own shape, so plans stay small (row-parallel shards are not cut per row).affine_transfer.py:plan_transferaccepts an N-D piece in a 1-D (flat) shard only when the piece is dense there; every other rank mismatch is still refused.affine_ir_spec.md: phase-2 section on layout vs storage maps.test_convert_checkpointstat().size→st_size(from #8515).No change to ZeRO, AutoTP or the executor. Offloaded optimizer states raise
NotImplementedError; MiCS / hpZ are not covered.Tests
tests/unit/checkpoint/test_zero_affine.py,test_affine_transfer_plan.py: ZeRO-0/1/2/3 param + optimizer maps checked against ZeRO's own buffers (bitwise rebuild), AutoTP nest, N-D box count, flat-shard acceptance/refusal.- ≤2 ranks: Intel Arc B70 (XPU) ×2, pass. >2 ranks: CPU (gloo), pass.
autotp_storage_affine_maps+plan_transfer+ executor (#8809), ZeRO-2 and ZeRO-3, weights bitwise equal after every sync. Plans are built once and reused.| Qwen3-8B, 8×L20 | ZeRO-2 gather | ZeRO-2 affine
lowest| ZeRO-2 affinebalanced| ZeRO-3 gather | ZeRO-3 affine ||---|---|---|---|---|---|
| maps + plan (once) | - | 0.63 + 0.57 s | 0.70 + 0.70 s | - | 0.82 + 0.60 s |
| first sync | 1.01 s | 1.16 s | 0.48 s | 1.71 s | 1.18 s |
| repeated syncs | 0.78-0.82 s | 1.05-1.35 s | 0.49-0.55 s | 1.22-1.28 s | 0.45-0.74 s |
| device memory added | 3.48 GB | 0.30 GB | 0.16 GB | 3.48 GB | 0.66 GB |
| sent / local copy | - | 35.2 / 5.0 GB | 15.1 / 25.1 GB | - | 34.0 / 6.3 GB |
| executor rounds | - | 96 | 41 | - | 32 |
Each map has 3,192 pieces on both sides; before N-D boxes (one piece per stored row) the same ZeRO-3 maps had 592k source / 2.36M target pieces and planning took 207 s. Under ZeRO-2 every DP rank holds a replica:
lowestis the planner's default holder choice,balancedis areplica_selectorin the example (local copy first, else the least-loaded holder).