Files
vetta-infer/kernels
adm 755626fae2 [HIP] P1: FP16 WMMA grouped NVFP4 MoE GEMM (tensor cores)
First P1 WMMA brick (Federico approved relaxing the bit-exact M=1-vs-M=B parity
to a numeric tolerance; greedy-vs-reference stays the blocking gate). Adds gfx11
(RDNA3.5) FP16 WMMA helpers (v_h16/v_f8, wmma_f32_16x16x16_f16_w32, acc lane map
2r+(lane>>4)) + k_nvfp4_grouped_gemm_wmma: a drop-in for the fdot2 grouped GEMM
with the same arena/CSR I/O. BM=16 (one M tile ~ tokens/expert at chunk 256),
BN=128 (8 waves, one 16x16 N tile each), BK=64 K-slab in LDS. NVFP4 E2M1 -> exact
FP16 prescaled e4m3*0.0625, WMMA f32 accumulation, epilogue *outer*16. Wired into
expert_arena_grouped_gemv_f16 for NVFP4 (K%64==0); VETTA_NO_MOE_WMMA=1 A/B fallback.
M=1 decode keeps fdot2 (WMMA needs M>=16 tiles).

Verified: WMMA-vs-CPU-oracle parity max_rel=1.2e-4; gw serve_gen greedy-vs-
reference EXACT (16 tokens + Paris + EOS, 4/4); forward_batch argmax batch==seq.
Relaxed the internal batched-vs-sequential tolerances to the P1 numeric budget
(global-scale normalization, not per-entry near-zero): forward_batch max_abs<0.15
(~2e-3 rel on +/-30 logits), single-layer cur + MoE global-scale <3e-3, KV cache
stays BYTE-IDENTICAL (attention precedes MoE). MEASURED prefill 2048tok A/B:
fdot2 41.6s -> WMMA 36.9s (-11%), moe_launch ~1888->1400ms (-26%). Gain bounded by
dequant/bandwidth (the reference INT8-fused sf4_i8 path is the further 2x axis).
Suite green: hip34 ld23 gw4 GPU serial, CPU -D warnings, Lean 0 sorryAx.
2026-12-02 03:04:58 +01:00
..