Repository navigation
perf(hip): bit-identical 32-row w4a16 GEMM twin for M<=32 verify (+17-20% Ripple DFlash2 decode) - #354
Merged
Conversation
…<= 32 verify GEMMs
At Ripple's DFlash2 verify width (M = 17) m128_f16a multiplies six zero-row
WMMA tiles for every two useful ones; on the runner it is 64% of DFlash2
decode GPU time (rocprof 43291803106). w4a16_gemm_t_m32_f16a_n{128,64} keeps
the same A staging, exact NVFP4 -> f16 dequant and K loop for a 32-row CTA,
with the 4 warps splitting N, so every output tile sees the same WMMA operands
in the same order: bit-identical (kbench 43302086666, 0 differing outputs at
every shape), and 2.3x (gate/up), 2.45x (q|gate), 1.27x (down, NT 64), 1.25x
(o, NT 64) faster.
w4a16_gemm_n128_m128 swaps it in when the launch is the f16a twin and M <= 32;
the twins are resolved beside m128_f16a, so targets without them (and CUDA)
are unchanged. ATLAS_W4A16_M32=0 keeps m128_f16a for A/B.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Race follow-up (DevLab runner, Ripple [email protected], |
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A 32-row twin of
w4a16_gemm_t_m128_f16a(gfx1151, strix-hip) used for small-M GEMMs (M ≤ 32: DFlash/MTP verify widths). At Ripple's M=17 verify, the 128-row CTA spends 6 of its 8 WMMA row tiles on empty rows. The twin keeps the same LDS staging, the same exact NVFP4→f16 dequant and the same K order, but each CTA covers 32 rows and the warps split N. Every 16×16 output tile sees the same WMMA operands in the same order, so the result is bit-identical.The NT=128 variant is used for N > 8192 and NT=64 for narrower N.
ATLAS_W4A16_M32=0turns it off. M > 32 is unchanged.Evidence (DevLab Strix runner, gfx1151)
HIP_LAUNCH_BLOCKING=1 AMD_SERIALIZE_KERNEL=3, 43342612809 / 43342616857), on and off produce byte-identical probes, and on is still faster (4.8 vs 4.0 steady).Note: pre-existing DFlash timing sensitivity on main (not caused by this PR)
Unserialized, the
skyprobe under DFlash2 lands at 64 or 69 tokens depending on launch timing. Main alone flips between the two depending on the serialization env var (43357178780 → 69, 43357182991 → 64). Each configuration is deterministic, but the result depends on timing, so there is a race somewhere in the DFlash verify/draft path. This is tracked separately.Gates
🤖 Generated with Claude Code