← Back to Pull requests

feat(hipblaslt): add vLLM wvSplitKQ FP8 TN skinny GEMMs (n ≤ 4) on gfx950 #15717

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 13, 2026 07:00 UTC
Author

JIRA ID : AIHPBLAS-5126

Motivation

Skinny FP8 TN GEMMs, decode with one to four tokens through torch._scaled_mm with per-tensor scales, are bound by streaming the weights. vLLM runs them with its wave-split-K FP8 kernels (wvSplitKQ). This brings those kernels to hipBLASLt on gfx950 as GFA custom kernels, as #13489 did for BF16 and FP16, with the bias epilogue built in as in #14855: the same kernels serve GEMMs with and without a bias.

On MI355X, these GEMMs get a +14% to +28% perf lift over develop on average (BF16 and FP16 D, with and without a bias, weights streamed from HBM or in cache), over ~600 shapes per D type, n = 1 to 4. The kernels win most for one token (+36% to +43%) and least for four (+7% to +9%).

Technical Details

Kernels

tensilelite/CustomKernels/vllm/wvSplitKQ_vllm_f8_{bf16,f16}_tn_n<N>_y<YTILE>u<UNRL>.s: 8 kernels, vLLM's tile for each n.

| D | n | Tiles (YTILE, UNRL) |
| - | - | ------------------- |
| BF16, FP16 | 1, 2 | (2, 2) |
| BF16, FP16 | 3, 4 | (2, 1) |

D = alpha scaleA scaleB A^T B + beta C + bias[m], with OCP FP8 (E4M3) A and B and FP32 accumulation in v_mfma_f32_16x16x32_fp8_fp8. The K loop, the MFMA accumulation and the DPP reduction are vLLM's wvSplitKQ_hf_sml_ and wvSplitKQ_hf_ (csrc/rocm/skinny_gemms.cu at 9163190dda00; on vLLM main they now live in csrc/rocm/skinny_gemms.cuh). Each kernel picks between them at run time: all n K token bytes staged once in the 160 KB of LDS, or the bytes that fit staged and the rest read from global memory.

Changes from vLLM, for hipBLASLt's interface, as in #13489:

  • alpha/beta epilogue with separate C and D and their own leading dimensions; C is not read when beta == 0. The scales are folded into alpha, and a null scale address reads as 1;

  • the tokens are staged packed at stride K and only within bounds, so a padded ldb neither overflows LDS nor reads past the last token; LDS DMA only for 16-byte-aligned token rows;

  • 64-bit row offsets, vLLM's host-side wave balancing (mindiv) computed on the device, and sml handling m that is not a multiple of YTILE;

  • hipBLASLt's bias vector (bias source D, one value of D's type per row of D) instead of vLLM's broadcast bias. Each wave loads its rows' bias when it starts a row tile and converts it only after the K loop, so the K loop does not wait for the load; it is added in FP32 before the conversion to D's type. A null bias address adds nothing.
  • The arguments are the wvSplitK ones followed by the scale A, scale B and bias addresses (96 bytes, same kernarg preload). Predicates: batch == 1, n == N, K % 16 == 0, unit strides. Rows past m read the last row and are not written, so m needs no bound. Each row of D is reduced by one wave in the same order, and the epilogue is compiled without contraction, so every row rounds the same way whether its row tile is whole or not; the kernels declare uniformSummationOrder: true. The kernels support no activation, scale-alpha vector, scale vectors or FP32 bias: problems with any of them get the kernels they get today.

    Library logic

  • gfx950/gfx950/Range/gfx950_Cijk_Alik_Bljk_F8BS_BH_SAB_UserArgs.yaml (BF16 D) and gfx950_Cijk_Alik_Bljk_F8HS_BH_SAB_UserArgs.yaml (FP16 D), both new, with the plain GEMM problem type and scalar A and B scales. FP8 GEMMs without scales match them too (hipBLASLt accepts a problem without scales in any scale mode) and take the kernels, which read a null scale as 1. gfx950 ships no other plain FP8 GEMM logic for these problem types, so each file forms a placeholder of its own; the FP16 file has the BF16 file's header with D's data types set to FP16.

  • gfx950_Cijk_Alik_Bljk_F8BS_BH_Bias_B_SAB_UserArgs.yaml and gfx950_Cijk_Alik_Bljk_F8HS_BH_Bias_H_SAB_UserArgs.yaml, both new: the same problem types with a bias of D's type, and the same kernels. Each forms a placeholder of its own, searched after the plain one and before the FP8 Bias/activation/scale-vector libraries (checked in the built library's index on MI350). The bias problem type also accepts problems without a bias, and those reach the plain files first; the bias rows lie inside the plain rows.

  • The solutions refuse a user split-K or WGM override (SupportUserGSU and SupportCustomWGM false): the kernels take neither, and hipBLASLt would run a split-K by passing the workspace as C and D. #14855 does the same for the BF16 and FP16 skinny entries.

  • Rows were chosen on MI355X as in #13489. For each n and each cell of m (9 to 1536, 3072, 6144, 12288, 24576, 49152, 98304, and above) and K (1024 to 1280, 2560, 5120, 10240, 20480, and 36864), a file keeps the kernel where it is at least 3% faster than develop's pick over the cell's shapes, hot and cold, counting every kernel that pick launches (a split-K Tensile kernel also launches a reduction kernel). A bias cell needs its plain cell. 514 of the 732 measured cells keep the kernel: 39 and 32 rows for BF16 and FP16 D without a bias, 37 and 33 with one. Cells without measurements and K above 36864, the largest K measured, keep develop's kernels, so no row reaches the path for n K past the LDS stage.

  • The FP8 Bias logic with BF16 D, which also accepts GEMMs without a bias, tunes 24 skinny shapes with n of 1, 2 or 4, in both the MI350 file and MI355X's (gfx950_id75a3). MI355X searches its own tuned logic first, so there those shapes keep their tuned kernels; on MI350 these files come first, so the rows take over the 20 of them inside the BF16 rows. On MI355X the wvSplitKQ kernel beats the tuned kernel on 12 of the 24 by 3% or more and loses on 8; 5 of the 8 lie inside the rows: 8192×8192 with n = 2 (−25%) and n = 4 (−33%), 10240×8192 with n = 4 (−8%), and 57344×8192 with n = 2 (−6%) and n = 4 (−22%).
  • Test Plan

    On MI300X, with the same kernel source built for gfx942 (FNUZ FP8, 64 KB LDS) as a proxy for everything but gfx950's encoding, LDS size and LDS DMA:

  • Standalone harness against an FP64 reference, launching each code object the way hipBLASLt does, for all 56 candidate kernels (both D types, n = 1 to 4, 7 tiles).
  • On the branch, host side:

  • Unit tests (test_CustomKernelMetadata.py, test_CustomKernels_buffer_oob.py), ValidateMetadata --strict, TensileLogic --check-all on the four Range files, pre-commit.

  • gfx950 device-library build.
  • On gfx950:

  • gtests matmul_skinny_f8_ and the row-uniformity cases RowUniformity_pre_checkin.SkinnyTnF8, in Math CI precheckin and on MI355X.

  • Performance on MI355X, hipBLASLt built for gfx950 from this branch with one row per n and from its merge base with develop (8b6dd4d7e43): each pick timed with rocprofv3 as the sum of its kernels' median times over 500 calls after 150 warm-up ones, develop and this branch back to back on one GPU for each shape, alternating which goes first. "hot" = weights reused across iterations, "cold" = --rotating 512. Shapes, per D type, bias and n = 1 to 4: 46 model decode (m, K) pairs, 57 power-of-two pairs (m from 64 to 131072, K from 1024 to 32768) and 50 random pairs.
  • Test Result

  • Harness: all 56 candidates pass 113 cases each, 6,328 in all. The cases cover tails in m, K from 16 to past the LDS stage, K = 0 and M = 0, padded and misaligned leading dimensions, B's base off a 16-byte boundary, in-place C == D, null scales, a bias and a null bias address, CU budgets from 1 to 304, and identical rows of A and C (alpha 0.7, odd m) that must give bitwise-identical rows of D. Exact-value cases are compared bit for bit and random FP8 codes within the accumulation error. D's padding and a tail past its last column must stay unchanged, C is NaN when beta == 0, and row padding and buffer tails hold FP8 NaNs to catch out-of-bounds reads.

  • Unit tests: 586 pass, among them the FP8 kernels' metadata; Range-logic checks for all four files (problem type, rows inside the kernels' predicates and the bias rows inside the plain rows, no overlaps, every kernel used, each solution listing its kernel's arguments and refusing user split-K and WGM overrides); a check that every skinny kernel's custom.config arguments match its kernarg metadata; code object v4; the buffer-OOB scan. ValidateMetadata --strict (294 kernels, no errors), TensileLogic --check-all on the four Range files (16 solutions kept) and hipBLASLt's pre-commit hooks pass.

  • gfx950 device-library build of the TN logic, and the gtests on MI355X: matmul_skinny_f8_tn_dst_{bf16,f16} (288 cases: padded and misaligned leading dimensions, a K tail inside a wave's step with weight rows off any boundary, a partial LDS DMA wave, a scale on only A or only B, n = 5 and pointer-array fall-back), matmul_skinny_f8_tn_dst_{bf16,f16}_bias and _bias_epilogue (216 cases: a bias of D's type and an FP32 one, beta 0 and 2, GELU and scale-alpha vector fall-back), and the two row-uniformity cases: all 506 pass.

  • The rows leave 1031×4×41984 and 1031×4×41008, where n K is past the LDS stage, to Tensile kernels, so the gtests check those kernels there. The TensileLite tests custom_vllm_wvsplitkq_f8_ run the wvSplitKQ kernels one K step past the LDS stage for every n, and RowUniformity_pre_checkin.SkinnyTnF8F16BiasTail_1031x4x41984 runs the n = 4 FP16 kernel there by name.

  • The FP16 _bias_epilogue cases now use hpl data. With rand_int data, a scale-alpha vector of up to 10 and A and B scales of up to 1 sent 109 of the 4,124 outputs of the K = 41984 case past the FP16 range, on the GPU and in the CPU reference alike, and the norm check reported a NaN error (inf minus inf). Whether that happened depended on the scales the test drew, which change with the tests that ran before it in the same process, so these four cases failed in Math CI and passed when run alone.
  • Performance (MI355X, perf lift over develop)

    Perf lift = develop's time / this branch's time − 1, as a geometric mean over the shapes. Shapes in cells that keep develop's kernels are counted at develop's time.

    | D | bias | shapes | hot | cold | n=1 | n=2 | n=3 | n=4 |
    | - | ---- | ------ | --- | ---- | --- | --- | --- | --- |
    | BF16 | none | 581 | +26.3% | +13.8% | +36% | +27% | +12% | +7% |
    | BF16 | BF16 | 581 | +27.2% | +15.6% | +38% | +29% | +13% | +8% |
    | FP16 | none | 608 | +27.6% | +19.9% | +43% | +31% | +15% | +9% |
    | FP16 | FP16 | 608 | +27.2% | +19.7% | +42% | +30% | +16% | +9% |

    The n columns combine hot and cold. With a row per n for every m from 9 and K from 1024, the same shapes gained +11% to +27%, and 16% of the results were at least 3% slower than develop; with the measured rows, 4.9% are. 77 cells lie within 2 points of the 3% threshold.

  • MI350: keep or carve out the 5 tuned BF16 shapes above that ran slower on the wvSplitKQ kernel on MI355X.
  • Submission Checklist

  • Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests.
  • Risk level

    Medium. New kernels and library logic for gfx950 FP8 TN GEMMs with n up to 4, scalar or no A and B scales, and no bias or a bias of D's type; other problems, devices and data types are unchanged. The rows were measured on MI355X; on MI350 they also take over 20 tuned FP8 Bias shapes, 5 of which ran slower on the wvSplitKQ kernel on MI355X.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: yzhang93 Review duration: 31739m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.57) × (1 − Review Confidence (0.47)). 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.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
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #15717"
    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: 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: 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: 30.4% · Safe to merge
    30.4%