← Back to Pull requests

feat(tensilelite): select fused GEMM+A2A kernels per world and A2A extent #13619

Closed
unknown closed this pull request without merging on Nov 04, 2026 13:33 UTC
View on GitHub
unknown unknown commented on Oct 14, 2026 09:10 UTC
Author

Motivation

The fused GEMM + all-to-all (A2A) kernel computes a GEMM on each of several GPUs and, in the same kernel, sends slices of its output D to the other GPUs. Besides the matrix sizes, two numbers shape that work: the world, or number of GPUs taking part, and the A2A extent, the number of leading M indices of D that are split across those GPUs and sent (the rest stays local). hipBLASLt already passes both to kernel selection, but the TensileLite tuning flow has no place for them: the tuning YAML cannot set them, and the results file and the generated logic (the table hipBLASLt uses to pick a kernel for a problem) do not record them. As a result, tuning cannot keep a different winning kernel per world or extent, and the gfx950 logic shipped for this kernel holds 3 placeholder rows with an unmeasured performance of 1000, keyed only on sizes and leading dimensions.

JIRA ID : AIHPBLAS-4534

Technical Details

This PR is stacked on #12472; only the 3 commits after it belong here.

  • Tuning YAML: a fused problem is written Exact: {sizes: [M, N, B, K], world: W, a2aExtent: E}. world is required (1 to 8) and a2aExtent defaults to M. Fused problem types reject list-form Exact, Range, batch above 1, and the bias, scale, activation, grouped and sparse options.

  • Client: world and A2A extent become per-problem configuration lines instead of the run-wide --fused-a2a-world and --fused-a2a-am; the new --world-filter runs a subset. Each problem runs on its first world GPUs. FusedA2ARunner is deleted, and its receive buffer becomes a problem tensor, A2A_BUF.

  • Logic: fused results files record World and A2AExtent, LibraryLogic picks one winner per (sizes, world, A2A extent), and fused logic rows end with those 2 values. The runtime exact-match lookup gets matching World and FusedA2AExtent keys. Fused logic must use the Equality distance; a fused row without world and extent is rejected. Non-fused logic is unchanged.

  • Kernel eligibility: ContractionProblem::world() (default 1) replaces fusedA2AWorld(). The GemmA2AShape check replaces FusedA2ATileDivisible and adds limits on the extent, batch, D type and layout and copy-engine (SDMA) transfer sizes.

  • Shipped gfx950 logic: 6 tuned rows (3072×512×2048 and 18432×2048×8192, each at world 2, 4 and 8) replace 3 placeholder rows. Other problems fall back to searching all eligible solutions.

  • Fix: TensileLibLogicToYaml no longer turns a dict-form Exact from benchmark data into the list of its keys.

  • Tests: the fused comm test also runs LibraryLogic and LibraryClient, and runs once per world, skipping a world when fewer GPUs are visible.
  • Effects on other paths: every GEMM problem gains an A2A_BUF slot that stays empty unless fused, the client synchronizes its GPUs after each solution outside the timed region, benchmark problem lists are written as valid YAML, and rotating-buffer copies start on 256-byte boundaries.

    Test Plan

  • Host without GPUs: pytest -m unit. tensilelite-tests (C++ unit tests for the TensileLite runtime and client) and hipBLASLt built in a ROCm 7.14 container.

  • 4× MI355X (gfx950): tensilelite-tests; tox -e comm -- -k fused_a2a; the existing single-GPU GEMM test configs; hipBLASLt A2A gtests; hipblaslt-bench --verify at world 2 and 4 on both shipped shapes, plus an extent and a K not in the logic.

  • 8× MI355X (gfx950): tox -e comm -- -k fused_a2a; hipBLASLt A2A gtests; hipblaslt-bench --verify at world 2, 4 and 8 on both shipped shapes, plus world 5, an extent and a K not in the logic.

  • Tuning: fused_a2a.yaml with the 2 shipped shapes at world 2, 4 and 8, SyncsPerBenchmark: 1, EnqueuesPerSync: 40, NumWarmups: 40, NumBenchmarks: 10, UseEffLike: False, and full validation of each winner.
  • Test Result

  • pytest -m unit: 10428 passed, 375 skipped; the 5 failures need hip/hip_runtime.h, which the host lacks.

  • 4 GPUs: tensilelite-tests 657 passed, 4 skipped. tox -e comm world 2 and 4 passed, each writing logic rows for its own world only; world 8 was skipped. 29 single-GPU configs passed. A2A gtests 45 passed, 4 skipped (the 5- to 8-GPU cases). The bench used the tuned row at world 2 and 4, and the fallback for the other extent and K.

  • 8 GPUs: tox -e comm world 2, 4 and 8 passed, each writing logic rows for its own world only. A2A gtests 49 passed. The bench used the tuned row at world 2, 4 and 8, and the fallback at world 5 and for the other extent and K.

  • Tuning: the UseSubtileImpl=True kernel won all 6 problems in 2 independent runs, and every winner passed full validation.
  • Submission Checklist

  • Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.
  • Diff: 596 lines (+447 / -149) across 7 files Reviewer: yzhang93 Review duration: 30502m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 596 lines diff across 7 files
    0.50
    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.382
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #13619"
    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: 50% (MEDIUM) · Higher = larger blast radius
    50%
    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: 19.8% · Safe to merge
    19.8%