← Back to Pull requests

[Mutant Race Kernels - 2] Pin assembly files for baseline kernel #55

Closed
unknown closed this pull request without merging on Oct 28, 2026 18:43 UTC
View on GitHub
unknown unknown commented on Oct 06, 2026 15:38 UTC
Author

[!NOTE]

Stacked on https://github.com/ROCm/rocjitsu-test-corpus/pull/48

This pins the device assembly (.s) of each baseline race-corpus kernel for gfx950 and
gfx1250, and adds the tooling that regenerates that assembly, records how it was built, and
checks it.

Pinning keeps the baselines identical across toolchains and runs, so the mutants derived from
them are deterministic. The pinned baselines are what mutant generation and the race-detection
runs consume.

python corpus/race/scripts/regenerate_asm.py                  # regenerate every corpus target
python corpus/race/scripts/regenerate_asm.py --target gfx950  # one target
python corpus/race/scripts/regenerate_asm.py --check          # manual drift check (needs ROCm)
python corpus/race/scripts/check_cases.py                     # compiler-free inventory check

Motivation

1. Converting HIP to assembly needs a compiler step, which is hard to add and manage in CI.
2. Our tools should run on a fixed set of instructions.
3. A toolchain update should not silently change the instructions, and with them the mutants.

Technical Details

Pinned listings. 21 cases, 37 listings: 16 for gfx950 and 21 for gfx1250, under
corpus/race/asm/<target>/<kernel>.s. hipcc's per-invocation __hip_cuid hash is normalized, so
regenerating with the same toolchain reproduces the files exactly. The baselines have no races;
each mutant should be detected as having at least one.

Inventory: cases.toml. It declares the corpus targets, and each case's kernel, targets and
optional headers. inventory.py reads and validates it for both scripts.

Recipe: asm/<target>/recipe.toml. It records how a target's listings were built:

  • the compiler, and its --version;

  • the SDK release and build;

  • the explicit flags, as the compiler received them.
  • recipe.py reads and validates it. Assemble the listings, and the mutants derived from them, with
    the SDK their recipe names.

    Regeneration: regenerate_asm.py.

  • Toolchain. The SDK comes from ROCM_PATH, rocm-sdk, or /opt/rocm. It and its compiler are

  • resolved once per run, and only that SDK's own hipcc or clang++ is used.
  • Environment. Variables that would change the build without being recorded (CPATH, HIP_,

  • HIPCC_*_FLAGS_APPEND, CCC_OVERRIDE_OPTIONS, ...) are removed from the compile. Extra flags and
    include directories go through --cxxflags, which the recipe records.
  • Per-target publication. Each case compiles into a temporary directory. A target's listings and

  • recipe are replaced together, only when all of its cases compiled, and with exactly the listings
    its cases produce. A failed or skipped case leaves the target as committed, and an interrupted run
    leaves a state the inventory check rejects.
  • --check. It regenerates into a temporary directory and compares the result with the

  • committed assembly, reporting a changed recipe separately from a toolchain update.

    | Exit code | Meaning |
    |---:|---|
    | 0 | Success |
    | 1 | Drift |
    | 2 | A case failed to compile, or an argument is invalid |
    | 3 | Incomplete: a case was skipped (see --allow-skipped), or nothing was compared |
    | 4 | The inventory or the toolchain cannot be used |

    Inventory check: check_cases.py. It needs no compiler and is suited to CI. It checks:

  • cases.toml against kernels/ and asm/, so every listing belongs to a case;

  • that each listing's .amdgcn_target matches its directory;

  • that each target has a valid recipe.toml.
  • It exits 0 on success and 1 on any problem.

    The workflow is documented in corpus/race/README.md.

    Test Plan

    Will be included & used as an artifact in an overall testing workflow in a later PR.
    This PR also has a suite of unit tests.

    Test Result

    Submission Checklist

  • Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.
  • Diff: 502 lines (+376 / -126) across 6 files Reviewer: stbaione Review duration: 31865m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 502 lines diff across 6 files
    0.48
    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 #55"
    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: 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%