← Back to Pull requests

feat(ci): scope the test matrix to the specific superrepo (submodule / external repo) #10434

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Dec 02, 2026 15:19 UTC
Author

During submodule bumps or external repo runs, for example, rocm-libraries runs rocm-systems tests even though it has no impact. This is a waste of GPU resources + time!

Tests ran here:

  • rocm-systems github actions workflow touched - ran expected tests

  • rocm-libraries github actions workflow touched - ran only rocm-libraries expected tests

  • rocm-libraries rocprim change only - ran only rocprim tests

  • Local test ran for submodule bump (in TheRock) and the output of tests:

  • Driving the real pipeline — configure_multi_arch_ci.py → determine_rocm_test_dependencies.py
    → fetch_test_configurations.py — on gfx94X-dcgpu / standard:

    ### Coverage — 20/20, gfx94X-dcgpu / standard

    | Scenario | changed_projects | Jobs | rocm-systems jobs |
    |---|---|---:|---:|
    | rocm-libraries (external caller) | | | |
    | one project (rocprim) | ['projects/rocprim'] | 6/53 | 0/13 |
    | two projects | ['projects/rocblas','projects/rocprim'] | 12/53 | 0/13 |
    | shared subtree (rocroller) | ['shared/rocroller'] | 7/53 | 0/13 |
    | caller workflow only | ['rocm-libraries'] | 40/53 | 0/13 |
    | scheduled, no diff | ['rocm-libraries'] | 40/53 | 0/13 |
    | docs only | ['rocm-libraries'] | 40/53 | 0/13 |
    | project + workflow | ['projects/rocprim'] | 6/53 | 0/13 |
    | rocm-systems (external caller) | | | |
    | one project (clr) | ['projects/clr'] | 49/53 | 11/13 |
    | leaf project (amdsmi) | ['projects/amdsmi'] | 2/53 | 2/13 |
    | caller workflow only | ['rocm-systems'] | 53/53 | 13/13 |
    | scheduled, no diff | ['rocm-systems'] | 53/53 | 13/13 |
    | TheRock | | | |
    | bump rocm-libraries | ['rocm-libraries'] | 40/53 | 0/13 |
    | bump rocm-systems | ['rocm-systems'] | 53/53 | 13/13 |
    | bump both monorepos | ['rocm-libraries','rocm-systems'] | 53/53 | 13/13 |
    | bump amd-llvm | [] | 53/53 | 13/13 |
    | bump rocm-libraries + loose file | [] | 53/53 | 13/13 |
    | bump rocm-libraries + amd-llvm | [] | 53/53 | 13/13 |
    | ordinary PR, no bump | [] | 53/53 | 13/13 |
    | no git context | [] | 53/53 | 13/13 |
    | caller pins changed_projects | ['projects/rocblas'] | 9/53 | 0/13 |

    A rocm-libraries bump drops 13 jobs, all rocm-systems components:

    amdsmi, aqlprofile, hip-tests, hipfile, profiler-hub, rccl, rocdecode,
    rocjpeg, rocprofiler-compute, rocprofiler-sdk, rocprofiler-systems,
    rocrtst, rocshmem

    ---

    The rule: start from everything, then drop only what the consumer graph proves
    the bump cannot reach — a component is dropped only when the superrepo map
    attributes it to a different monorepo and no consumer edge reaches it.
    Components with no attribution (amd-llvm, third-party, synthetic nodes like
    tensilelite) are never dropped, since absent means unknown, not unaffected.

    The asymmetry CI wants falls out of the graph rather than a hardcoded rule.
    Nothing in rocm-systems consumes rocm-libraries — an invariant already asserted
    by cmake_consumer_graph_test.py — so a rocm-libraries bump drops all of
    rocm-systems, while a rocm-systems bump reaches the whole stack and drops nothing
    (it emits *, exactly today's behavior).

    ## How it works

    1. configure_multi_arch_ci.py detects a run whose diff touches exactly one
    superrepo submodule and emits its name on a new changed_projects output.
    Any other bump (amd-llvm, or a bump alongside other edits) stays empty, i.e.
    all tests.
    2. determine_rocm_test_dependencies.py reads a bare monorepo name as a
    whole-superrepo bump and scopes from the graph, parsing attribution on demand
    via build_superrepo_map() (~0.4s, no configure, no submodules) rather than
    from a committed artifact that could go stale.

    This reuses the changed_projects channel that already reaches
    test_artifacts.yml, so no new workflow inputs. A caller's project-level list
    still wins.

    This does not change any build decision

    changed_projects does reach one build decision: _drop_stages_affected_by_changed_projects
    drops any prebuilt stage a changed project compiles into, so a caller's
    prebuilt_stages list cannot copy a stage the run invalidated.

    A bare monorepo name is not a subproject and resolves to no stage, so it is
    discarded there and the scope falls back to the repo_projects upper bound —
    exactly what an unscoped run uses. Stage copying therefore comes out identical:

    copied, scope []                  : runtime-tests, comm-libs, storage-libs, debug-tools,
                                        dctools-core, profiler-apps, media-libs, wsl-rocdxg
    copied, scope ['rocm-libraries']  : (identical)
    

    cv-libs still rebuilds when projects/rpp is in scope. Stage selection
    (build_stages) and artifact reuse are not fed by changed_projects at all —
    reuse comes solely from compute_auto_stage_reuse().

    TestMonorepoScopeDoesNotNarrowTheBuild pins this, and fails if the monorepo
    filter is removed.

    The substantive difference from the original: it no longer claims the build is untouched by
    construction (that's false), but that the monorepo name specifically is filtered out of the one
    build path it reaches, so the decision is provably unchanged. That's a weaker but true claim — and
    it's the honest one to make to a reviewer who may already know
    _drop_stages_affected_by_changed_projects exists.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: erman-gurses Review duration: 4073m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #10434"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 27.7% · Safe to merge
    27.7%
    Repository