← Back to Pull requests

sGPU Test Scheduling: Global Work Queue #696

Closed
unknown closed this pull request without merging on Nov 09, 2026 06:11 UTC
View on GitHub
unknown unknown commented on Aug 07, 2026 14:24 UTC
Author

What this changes

sGPU and mGPU tests now run as two seperate global work queue per box instead of a static suite-per-GPU split. A single script, ci/run_queue.sh, drives both (--queue sgpu / --queue mgpu); items are dispatched to corresponding 4 gpu runner for sgpu and 8 gpu runner for mgpu , longest-first, from a duration table the queue learns from its own runs.

Features added

  • Path-based suite selection. ci/change_scope.py reads a PR's changed paths and selects only the suites those paths can affect. A path matching no rule selects everything. Pushes to dev/release, manual runs, and the ci-skip-scope label bypass it entirely.

  • Per-test re-runs. "Re-run failed jobs" still re-runs the whole GitHub job, but the queue inside it now runs only the items that failed, and within each item only the individual tests that failed.
  • Flow


    1. What runs, and why


    flowchart TD
        PR["Pull request"] --> SCOPE["Select Test Suites<br/>ci/change_scope.py: Contains rules to filter which tests to run"]
        SCOPE -->|run_build| BUILD["Build wheels"]
        SCOPE -->|"sgpu_suites != ''"| SG["sGPU Tests<br/>(per arch)"]
        SCOPE -->|"mgpu_suites != ''"| MG["mGPU Tests<br/>(per arch)"]
        BUILD --> SG
        BUILD --> MG
        SG --> RQ1["ci/run_queue.sh --queue sgpu<br/>examples · torch · jax · core"]
        MG --> RQ2["ci/run_queue.sh --queue mgpu<br/>torch-mgpu · jax-mgpu"]
    

    Inside run_queue.sh (both queues share it)


    flowchart TD
        P0["Phase 0 · read configs"] --> P1
        P1["Phase 1 · expand each suite into work items<br/>TE_CI_LIST_ITEMS=1 → queue.tsv + items.tsv"] --> P2
        P2["Phase 2 · narrow to the re-run, then weight and order<br/>longest-first from the learned table"] --> P3
        P3["Phase 3 · one-time setup<br/>CK JIT prebuild + pip prereqs"] --> P4
        P4["Phase 4 · run the queue<br/>items dispatched to free GPUs, widest first"] --> P5
        P5["Phase 5 · per-suite verdict<br/>record what failed, down to the test"] --> P6
        P6["Phase 6 · update the learned weight table"] --> P7
        P7["Phase 7 · scheduling report → job summary"] --> P8
        P8["Phase 8 · failure summary"]
    
        W[("cache: ci-weights/")] -.->|restore| P2
        P6 -.->|save| W
        R[("cache: ci-rerun/")] -.->|restore| P2
        P5 -.->|save| R
    

    How "Re-run failed jobs" narrows


    flowchart LR
        A1["Attempt 1<br/>full queue"] --> P5["Phase 5 records<br/>failed items + failed nodeids"]
        P5 --> C[("ci-rerun/&lt;queue&gt;/<br/>cached per run_id")]
        C --> A2["Attempt 2<br/>GitHub re-runs the whole job"]
        A2 --> L1["Phase 2 keeps only<br/>the items that failed"]
        L1 --> L2["result-sink plugin keeps only<br/>the tests that failed"]
        L2 --> RUN["runs a fraction of the original work"]
    

    How an item gets dispatched

    The scheduler reconstructs nothing. It sets TEST_FILTER=<tag> and re-enters the suite script, which replays that one call line with its own env prefix and -k expression while every other item is filtered out. The tag is the only thing crossing the boundary, so per-item configuration cannot be dropped in transit. An mGPU item takes the GPU count its call site declares via TE_CI_GPUS=N, or the whole box if it declares none.

    State carried between runs

    | cache | holds | effect if missing |
    |---|---|---|
    | ci-weights/ | measured seconds per item, per (arch, level) | the run is unordered, never wrong |
    | ci-rerun/ | items that failed + their failing nodeids | a re-run runs everything |

    Both are GitHub Actions caches. ci-rerun is keyed on run_id so attempts of
    the same run chain, and parallel PRs never collide.

    Results (level 3, gfx950, 4 GPUs)

    | | wall clock |
    |---|---:|
    | static suite-per-GPU | 6935s |
    | global queue | 2643s |
    | theoretical optimum | 2624s |

    2.62x, 99.3% GPU utilization. Test coverage is unchanged — same files, same
    items; nothing is skipped to get there.

    Diff: 498 lines (+373 / -125) across 6 files Reviewer: VeeraRajasekhar Review duration: 134867m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 498 lines diff across 6 files
    0.47
    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.372
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #696"
    general weight: 0.35
    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: 47.5% (MEDIUM) · Higher = larger blast radius
    47.5%
    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: 18.8% · Safe to merge
    18.8%