Skip to content

strix-hip 27B decode kernels: w8a16 n2 load hoist + w4a16 gate/up dual split (C8 +13%, bit-identical) - #326

Merged
AzeezIsh merged 3 commits into
mainfrom
train/hip-27b-decode-kernels
Nov 4, 2026
Merged

AzeezIsh merged 3 commits into
mainfrom
train/hip-27b-decode-kernels

Conversation

@AzeezIsh

@AzeezIsh AzeezIsh commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Two bit-identical gfx1151 decode-kernel changes, found by the DevLab kbench loop. Each was gated on its own, then the exact train was gated together.

Changes

  1. f1b0d48, kernels/strix-hip/common/w8a16_gemv_batch4.cu. w8a16_gemv_batch8_dyn_vl2_n2 issues the second half's weight loads and scales before the first half's FMAs. Only issue order changes; the arithmetic is the same.
  2. a5fe0ea, crates/spark-model/src/layers/dense_ffn_dp4a.rs. For m 5..=8 on atlas_hip, gate and up run as two launches of the single-matrix w4a16_gemv_dp4a_batch8_d4 tier instead of the vl2 dual.
    • Why it is bit-identical: the single tier's 64 threads per output split groups across two warps exactly as the dual's two virtual lanes do. The accumulate expression and the reduce are the same.
    • Opt-out: ATLAS_W4A16_DUAL_SPLIT=0 restores the dual.
    • gb10 is unaffected: it has no vl2 dual.

Kernel bench

DevLab runner. Weights rotate over more than 256 MB of copies, so DRAM, not the 32 MB MALL, serves them.

w8a16 n2 hoist (41798114848, 41818234797):

shape before after change
16384×5120 151 GB/s 167 GB/s +10%
12288×5120 147 GB/s 163 GB/s +11%
5120×6144 110 GB/s 124 GB/s +12%
2048×5120 99 GB/s 117 GB/s +18%

Bit-identical at M = 8, 7, 6, 5 (MTP verify runs this tier at M = 5).

w4a16 gate/up split (41808247496): N=17408, K=5120, M=8 goes from 768 µs (131 GB/s) to 562 µs (178 GB/s). Bit-identical.

End-to-end

framework, nvidia/Qwen3.8-27B-NVFP4, MAX_BATCH 8, Gufo steady aggregate, ×2 rounds.

job build C8 tok/s C4 tok/s
f203 hoist alone 52.1 → 54.3 (+4.3%) +3.6%
f204 split alone (same binary, env A/B) 52.3 → 56.7 (+8.4%) +7.6%
f206 exact train 4faa5bd 52.0 → 58.9 (+13.1%) 44.1 → 49.0 (+11.2%)
  • C1: unchanged (19.9 tok/s).
  • Faults: 0.

Output identity

  • Without prefix caching (f205): main×2 and hoist×2 match in text and every logprob on 4/4 greedy prompts.
  • f204: dual vs split match in text and logprobs, 4/4.
  • f206: text matches 4/4. One logprob vector differs on the prefix-cache run, as f203's did; f205 shows that comes from the prefix-cache run, not the kernels.

Gates

  • kbench bit-identity and speed
  • e2e A/B on the box for each change and for the exact train (f203, f204, f205, f206)
  • DevLab native build of the exact train (41821504094)
  • post-merge build + serve on strix and framework

🤖 Generated with Claude Code

AzeezIsh and others added 3 commits November 4, 2026 03:15
…t loads before the first half's FMAs

All four 16-byte weight loads of an iteration are now in flight together. Only
the issue order moved; every output's arithmetic is unchanged (bit-identical).
kbench (DevLab 41797477178, weights rotated over >256 MB so DRAM serves them),
27B FP8 shapes at M=8: 16384x5120 151 -> 159 GB/s, 12288x5120 147 -> 157,
5120x6144 110 -> 119, 2048x5120 99 -> 118.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… instead of the vl2 dual (bit-identical, ~1.37x)

The single batch8_d4 tier's 64 threads per output split the groups across two
warps exactly as the vl2 dual's two virtual lanes do, with the same accumulate
expression and reduce, so each output is bit-identical. kbench (DevLab
41808247496, weights rotated over >256 MB, N=17408 K=5120 M=8): dual 768 us /
131 GB/s vs 2x single 562 us / 178 GB/s. m 5..=8 on atlas_hip only (gb10 has no
vl2 dual); ATLAS_W4A16_DUAL_SPLIT=0 restores the dual for A/B.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh
AzeezIsh merged commit a523a07 into main Nov 4, 2026
19 of 21 checks passed
AzeezIsh added a commit that referenced this pull request Nov 4, 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.

1 participant