Archived
gemm_mxfp4a8_decode_shortk: the decode kernel at 33..64 rows of a wide, short weight, above gemv_wide
gemv_wide's blocks hold three or four row tiles over the whole K, so on a short K the cross-wave reduction of a block outweighs its WMMAs, and on a wide N there are many such blocks. Swept over 24 per-rank shapes (Qwen3.8 and TranslateGemma at TP1/2/4/8, 1B/4B/8B-class dense) at 24..64 rows, each row timed alone: gemv_wide is at least upstream's decode kernel everywhere except N >= 8192 with K <= 2560 past 32 rows, where it lost by 7..30 % (19456 x 2560 at 64 rows 131.8 us against upstream's 104.5; 16384 x 2048 92.8 / 76.1; 9728 x 2560 74.1 / 67.4). This decode kernel takes that corner: 93.3, 68.6 and 52.5 us. A row of its own (same entry, scratch hook and tunables as the decode row, priority 59, constraints M 33..64, N 8192..36864, K <= 2560) rather than a rule in the gemv entry, so the planner's choice stays a table lookup. Narrower N stays with gemv_wide (5120 x 2176 at 40 rows 39.2 against 52.8), as does every shape of the models we serve. r4d_selftest: five numeric cases over the corner, both activation grids and parts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d4eacec5c6
commit
f3429d8c13
4 files changed
+38
-1
No files matched your search
@@ -51,6 +51,9 @@ enum {
|
||||
R4D_PRIO_GEMM_MXDEC = 55,
|
||||
/* The MXFP4 gemv row (one to eight rows) outranks the decode row, whose band it shares there. */
|
||||
R4D_PRIO_GEMM_MXGEMV = 58,
|
||||
/* The decode kernel's short-K row outranks gemv_wide in the one corner of its band where the
|
||||
* decode kernel is faster (33..64 rows, N >= 8192, K <= 2560). */
|
||||
R4D_PRIO_GEMM_MXDEC_SHORTK = 59,
|
||||
/* The skinny m64 row has no upper bound on M, so the tiled bf16 row (M > 64 only) must outrank
|
||||
* it, and stays below m16, whose band it never enters. */
|
||||
R4D_PRIO_GEMM_BF16_TILED = 55,
|
||||
|
||||
Reference in new issue
Block a user