[AffineIR] Analyze affine transfer batches before execution (Plan analysis & calibration Part-1) #8967
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 326 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.346
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8967"
general
weight: 0.35
jinyouzhi
Analyze affine transfer batches before execution
Builds on #8809 (executor) and #8966 (calibration path labels), both merged.
Why
Plans that move the same bytes can differ a lot in time (up to 1.75× on 8× B70 between replica choices), and executor measurements show that the round count under a
StagingBudgetdominates sync time. A policy (#8935/#8936) or cost model (#8252) needs these facts before it runs a plan.What
deepspeed/checkpoint/affine_transfer_analysis.py:analyze_transfers(plans, endpoints, element_size, budget, path_of)is a pure function with no communication. It reads the schedule from the executor's publicschedule_transfers, so it reports whatexecute_transferswill run:- volume;
- segment, chunk and message size distributions;
- rounds;
- per process: sent/received bytes, peers, messages, pack/unpack bytes, staging arena;
- per-pair and per-path bytes.
expected_stats(report, process)predicts that process'sTransferStats.report_to_dictreturns a JSON-ready summary.path_oflabels ascalibrate_links, so per-path totals can be priced withfit_links.It does not choose replicas, rank plans, or model time.
Tests
expected_stats== the executor'sTransferStats, for a strided and a replicated parameter under budgets of 3 and 64 elements.local_copy_bytesexceeds the executor's by exactly the in-place bytes, and every other field matches.Results:
Mutation checks (dropping the receiver's round count, or the local bytes in the path summary) are caught.
Follow-up
expected_stats(...)['local_copy_bytes']is an upper bound. The analysis sees no buffers, so it also counts local copies thatexecute_transfersdrops as in place (source and target the same memory at the same strides);TransferStats.local_copy_bytesdoes not. The docstrings andaffine-transfer.rststate this, and the 2-rank test pins the difference. Making this field exact would need the analysis to know which copies are in place, for example by passing the buffers or the in-place copies toanalyze_transfers. That is left for a follow-up.