← Back to Pull requests

[AffineIR] Analyze affine transfer batches before execution (Plan analysis & calibration Part-1) #8967

Closed
unknown closed this pull request without merging on Nov 23, 2026 04:03 UTC
View on GitHub
unknown unknown commented on Oct 31, 2026 14:23 UTC
Author

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 StagingBudget dominates 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 public schedule_transfers, so it reports what execute_transfers will 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's TransferStats.

  • report_to_dict returns a JSON-ready summary.

  • Messages use the same path_of labels as calibrate_links, so per-path totals can be priced with fit_links.
  • It does not choose replicas, rank plans, or model time.

    Tests


  • Hand-counted rounds and bytes on an uneven handoff.

  • Staging of strided sources.

  • A batch with a shared plan.

  • Path and pair labels in the JSON summary.

  • 4 ranks: expected_stats == the executor's TransferStats, for a strided and a replicated parameter under budgets of 3 and 64 elements.

  • 2 ranks: on a batch with an in-place local copy, the predicted local_copy_bytes exceeds the executor's by exactly the in-place bytes, and every other field matches.
  • Results:

  • CPU (gloo): 7 passed; the two 4-rank tests need four devices and are skipped.

  • 4× Intel Arc Pro B70 (xccl): the 2-rank and 4-rank tests pass.

  • 4× L20 (nccl): all passed before the in-place test was added; not re-run since.
  • 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 that execute_transfers drops as in place (source and target the same memory at the same strides); TransferStats.local_copy_bytes does not. The docstrings and affine-transfer.rst state 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 to analyze_transfers. That is left for a follow-up.
  • Diff: 326 lines (+244 / -82) across 4 files Reviewer: jinyouzhi Review duration: 32500m
    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
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42% (MEDIUM) · Higher = larger blast radius
    42%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.6% · Safe to merge
    16.6%