← Back to Pull requests

feat(hipblaslt): W4A16 gfx1151 prefill kernels selected by Origami #15736

Closed
unknown closed this pull request without merging on Nov 18, 2026 16:38 UTC
View on GitHub
unknown unknown commented on Nov 13, 2026 13:17 UTC
Author

ISSUE ID #15737

Motivation

<!-- Explain the purpose of this PR and the goals it aims to achieve. -->

On gfx1151 (Strix Halo), each W4A16 type (int4 weights with block scales, bf16/fp16 activations) had a single prefill kernel (MT64x160), far from the hardware roofline on most shapes. This PR adds a set of Stream-K kernels per type and lets Origami pick the kernel and its launch grid.

  • 84.9% of roofline (median) over 5,152 prefill problems; every type above 83%.

  • By M: 91% at M ≥ 801, 86% at M 129-800, 73-74% at M ≤ 128. M not a multiple of 16: 80.3% (86.2% for the rest).

  • Origami's pick is on average 2.7% slower than the fastest kernel of the set.

  • 1.57x faster than vLLM's Triton W4A16 kernels (median, 216 problems, vLLM's own strides).

  • Correct output on all 10,304 problems checked (8 types).

  • Requirement: rows of weights, activations and output padded to an odd multiple of 128 bytes, provided by the caller.
  • Technical Details

    <!-- Explain the changes along with any relevant GitHub links. -->

    Everything below applies only to W4A16 (int4 A with block scales) on gfx1151.

  • Kernels. 134 Stream-K kernels as TensileLite custom kernels (pre-generated assembly), with 8 Origami Prediction logic files that replace the previous FreeSize files. No StaggerU: with padded rows it is not needed, and the freed registers let every tile run as Stream-K. The generator changes that produce these kernels are not in this PR.

  • Origami. W4A16 latency model (dequantize cost, K-loop cost, Stream-K partial tiles) and a Stream-K grid rule (grid_k_split_aware_gfx1151_w4a16). Constants live in w4a16_defaults_t and are only used on gfx1151.

  • hipBLASLt host. Int4 maps to Origami's data type; gfx11 W4A16 custom kernels get their real occupancy; the Stream-K launch grid gets the kernel's wave layout, as Origami ranks it.

  • Limits. Row strides that are a multiple of 256 bytes are slower (no stagger). Group 3584 (per channel) stays unsupported, as on develop.
  • Kernels

    | type | tiles (× Signed, UnsignedBias8) | MT0 (weight rows) | MT1 (tokens) |
    |---|---|---|---|
    | bf16 symmetric | 19 | 32-256 | 16-256 |
    | bf16 zero-point | 15 | 32-160 | 16-256 |
    | fp16 symmetric | 16 | 32-256 | 16-256 |
    | fp16 zero-point | 17 | 32-160 | 16-256 |

    How they were chosen:
    1. Per tile: TensileLite parameters searched on the tile's ideal problem (M = MT1, a whole number of tiles per CU, K = 4096). On it the kernels reach 81-87% of roofline (median per type).
    2. Set: each type keeps the tiles that give the best time over the shape lists when Origami picks the kernel. Origami's constants are calibrated on hipBLASLt kernel times of these kernels.

    Test Plan

    <!-- Explain any relevant testing done to verify this PR. -->

  • Types: {bf16, fp16} × {symmetric, zero-point} × {Signed, UnsignedBias8}, groups 32 and 128, fp32 accumulation.

  • Shapes: 1,291 problems per type: an LLM prefill grid (66 projection layers × M 16-4096), vLLM's model list, layers of 5 other models (Gemma-2-9B, Llama-3.1-70B, Mistral-Nemo, Phi-3-medium, Qwen2.5-14B) and vLLM's Triton W4A16 list. Rows padded to an odd multiple of 128 bytes.

  • Correctness: hipblaslt-bench -v, 8 types, every output element.

  • Performance: GPU kernel time (rocprofv3, 50 iterations after 10 warm-up, 512 MB rotating buffer) of Origami's pick, 4 Signed types, 3 boards. Roofline = max(bytes / 230 GiB/s, FLOPs / 43 TFLOPS); padding bytes not counted.

  • Origami's pick: on 158 sampled problems × 4 types, every kernel timed in its own process (--algo_method index) and compared with the pick.

  • Against Triton: vLLM's Triton list with vLLM's own strides, against Triton's profiled % of roofline on the same roofline (rocm-scripts tools/roofline).

  • Unit tests: Origami ctest; TensileLite test_custom_kernel_occupancy.py, test_custom_kernel_staggeru_metadata.py; PredictionLibraryTest.Int4MapsToOrigamiInt4.
  • Test Result

    <!-- Briefly summarize test outcomes. -->

  • Correctness: 10,304 problems pass (max normalized error 2.8e-3); the 24 group-3584 problems are rejected as unsupported.

  • Unit tests: Origami 164/164; TensileLite custom-kernel tests 968 pass, 3 skipped.

  • Performance (% roofline, median; share ≥ 80%):
  • | | problems | median | ≥ 80% |
    |---|---|---|---|
    | all | 5152 | 84.9 | 64% |
    | bf16 symmetric | 1288 | 84.7 | 62% |
    | bf16 zero-point | 1288 | 83.3 | 59% |
    | fp16 symmetric | 1288 | 87.0 | 70% |
    | fp16 zero-point | 1288 | 85.0 | 64% |
    | M ≤ 48 | 840 | 72.7 | 29% |
    | M 49-128 | 892 | 73.9 | 29% |
    | M 129-800 | 1864 | 85.8 | 71% |
    | M ≥ 801 | 1556 | 90.8 | 94% |
    | M multiple of 16 | 4328 | 86.2 | 66% |
    | M not a multiple of 16 | 824 | 80.3 | 51% |
    | layers of other models | 384 | 82.0 | 56% |

  • Origami's pick: fastest kernel on 53% of problems, within 5% on 82%; 1.027x the fastest (geomean); 80.8% against 82.7% of roofline.

  • Against Triton: 1.57x median (1.65x geomean), 77.2% against 48.3% of roofline. Triton is faster on 2 of 216 problems: 992×64×2048 bf16 symmetric (0.91x) and 128×896×896 fp16 zero-point (0.98x).
  • <details>
    <summary>By type and M, and by group</summary>

    | type | M ≤ 48 | M 49-128 | M 129-800 | M ≥ 801 | G32 | G128 |
    |---|---|---|---|---|---|---|
    | bf16 symmetric | 69.7 | 71.2 | 86.3 | 90.5 | 85.0 | 84.1 |
    | bf16 zero-point | 71.5 | 70.7 | 82.6 | 89.7 | 83.5 | 82.6 |
    | fp16 symmetric | 74.8 | 79.7 | 87.8 | 94.0 | 87.0 | 87.0 |
    | fp16 zero-point | 74.4 | 74.6 | 86.3 | 90.4 | 85.4 | 84.6 |

    </details>

    Submission Checklist

  • Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: yzhang93 Review duration: 7400m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 650 lines diff across 8 files
    0.57
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #15736"
    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: 57% (MEDIUM) · Higher = larger blast radius
    57%
    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: 22.5% · Safe to merge
    22.5%