Skip to content

[ROCm] wvSplitK: launch rows of their own for gfx1151 and gfx1150 - #1406

Closed
roberteg16 wants to merge 3 commits into
rogarcia.upstream-main-basefrom
rogarcia.upstream-skinny-tune
Closed

roberteg16 wants to merge 3 commits into
rogarcia.upstream-main-basefrom
rogarcia.upstream-skinny-tune

Conversation

@roberteg16

@roberteg16 roberteg16 commented Oct 26, 2026 •

Copy link
Copy Markdown

Port to upstream of the wvSplitK changes in #1401. The base branch is upstream/main (9e3db48), so the diff is what an upstream PR would contain.

Purpose

Faster wave32 wvSplitK on gfx1151 and gfx1150/1152/1153 with one launch tile per arch, from a sweep of every non-spilling launch configuration.

Changes

  1. bigType sized by A_CHUNK: with A_CHUNK = 16 it was twice as large, reading past an activation row and overlapping LDS. No launch used A_CHUNK = 16 before commit 3.
  2. bf16 DOT2C on gfx11/gfx12 issues v_dot2_f32_bf16, as fp16 issues v_dot2_f32_f16.
  3. Launch rows:
    • gfx1151: (YTILE 1, UNRL 4, A_CHUNK 16); (2, 4, 8) for K < 1024.
    • gfx1150/1152/1153: (2, 1, 16); (1, 2, 16) when M <= 32 * CUs.
    • A_CHUNK 8 when K % 16 != 0.
    • Other archs: generic rows, unchanged.

The dispatch code is identical to #1401's.

Results

Against upstream/main. Interleaved A/B, cold caches, padded weights, median of 5 rounds; 43 shapes x N = 1..5, bf16/fp16 (13 shapes not used for tuning, odd M, K 768/1000/2880), plus bias.

gfx1150 gfx1151
Shapes used for tuning +1.8% to +1.9% +2.7% to +3.0%
Other shapes +0.8% to +4.9% +1.8% to +3.2%
With bias +1.7% +4.1%

Cells slower by more than 2%: 0-1 per set (at 0.98). 99.3-99.8% of the per-shape best tile, against 96-98% for upstream/main.

Tests

Related

AI assistance was used; the submitter reviews every line.

mgehre-amd and others added 3 commits October 26, 2026 11:42
The bigType union in wvSplitK_hf_sml_, wvSplitK_hf_ and wvSplitK_hf_big_
defines half4 as (A_CHUNK / 2) x bf16, so h4[A_CHUNK / 4] grows as
A_CHUNK^2 / 4 bytes while every other member is A_CHUNK halves:

  A_CHUNK | h[A_CHUNK] | h4[A_CHUNK/4] | sizeof(bigType)
  --------|------------|---------------|----------------
        8 |       16 B |          16 B |  16 B
       16 |       32 B |          64 B |  64 B

With A_CHUNK = 8 the two agree; with 16 every bigType copy moves 64 B
where the kernel assumes 32 B: it reads past the end of an activation
row (hipErrorIllegalAddress when the row ends at a page boundary) and
adjacent threads overwrite each other's LDS. No launch uses A_CHUNK = 16
today; the next commit does.

half4 is now 4 x bf16, the operand of its only consumer
(__builtin_amdgcn_mfma_f32_4x4x4bf16_1k), which keeps sizeof(bigType)
at A_CHUNK halves for every A_CHUNK.

Signed-off-by: Matthias Gehre <matthias.gehre@amd.com>
Signed-off-by: Robert Esclapez Garcia <robert.garcia@amd.com>
On gfx11 and gfx12 the fp16 DOT2C already issues v_dot2_f32_f16, while
the bf16 one widens both operands to f32, multiplies and adds. Issue
v_dot2_f32_bf16 instead (VOP3-P, available on gfx11 and gfx12): the
weights stay packed, as with fp16, and the bf16 path no longer needs
twice the registers for them.

AI assistance was used for this patch.

Signed-off-by: Robert Esclapez Garcia <robert.garcia@amd.com>
The wave32 wvSplitK launches took either a gfx1151 chain or, on every
other gfx11/gfx12 arch, the generic YTILE-by-M rows, all with
A_CHUNK = 8. A sweep of every non-spilling launch configuration on
gfx1151 and gfx1150 (YTILE 1-4 x UNRL 1/2/4/8 x A_CHUNK 8/16/32 x
WvPrGrp 16/32, N = 1..5, bf16 and fp16) finds one tile per arch within
~1% of the best for nearly every shape:

- gfx1151: (YTILE 1, UNRL 4, A_CHUNK 16); (2, 4, 8) for K < 1024.
- gfx1150, gfx1152, gfx1153: (2, 1, 16); (1, 2, 16) when M <= 32 * CUs.
- A_CHUNK 8 when K % 16 != 0.

WVSPLITK_CFG_AC takes A_CHUNK; WVSPLITK_CFG keeps 8. Other archs keep
the generic rows.

AI assistance was used for this patch.

Signed-off-by: Robert Esclapez Garcia <robert.garcia@amd.com>
@roberteg16

Copy link
Copy Markdown
Author

Already in upstream vllm-project#63835

@roberteg16 roberteg16 closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants