logits_gemm_fp8: 65..128 rows in one pass, the head read once

lm_wmma_kernel held at most four 16-row tiles a wave, so past 64 rows the launcher made passes of 64
and read the fp8 head again for each. With MH = 2 the workgroup's eight waves split into two M halves
of four tiles over 64 weight rows that share one staged tile: Qwen3.8's per-rank head (124160 x 5120)
at 128 rows 3059 -> 1984 us, TranslateGemma's 3242 -> 2036 us; 65..128 rows -33..-39 %, 160..256
-26..-37 %, 64 and fewer unchanged. Same scale blocks, WMMAs and K order per output: the same bytes.
r4d_selftest: the heads' numeric cases at 65..150 rows, --perf times the head up to 256 rows, and
R4D_PERF_ONLY=<row> times one row alone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
mici81andClaude Opus 5.5 committed 2026-10-22 12:23:58 +00:00
1 parent 123c439684
commit b90723eabe
3 files changed
+53 -19

No files matched your search

+2 -1
View File
@@ -5699,7 +5699,8 @@ static const RadKernelInfo kKernels[] = {
"the lm_head projection over an fp8 head: C[M, n_vocab] f32 = x[M, n_embd] @ dequant(W)^T, "
"one wave a vocabulary row, the row's own scales in its tail",
"any M -- one pass to 32 rows, instantiated exactly to 8 and rounded up to a multiple of 4 above "
"it, then chunked; n_embd a multiple of 128, which is the group the scales are taken over. The "
"it, to 64 rows in four tiles a wave, to 128 in two M halves of four that share the staged head "
"tile, then chunked by 128; n_embd a multiple of 128, which is the group the scales are taken over. The "
"stored row is padded to 16 bytes so the uint4 load stays aligned at any such n_embd",
"bf16 x, E4M3 head with a bf16 scale per 128x128 tile stored PER ROW, F32 LOGITS OUT, fp32 "
"accumulate",