hc_read: a second prefill form behind R4D_HC_READ_PF2

The wide prefill form reads h and builds N once per 128-column tile, three
times a call, decodes both E4M3 mixing matrices again in every row tile,
and launches the norm scales on their own. PF2 decodes the matrices once in
a prologue that also computes the norm scales in the same order, runs the
down product one workgroup per 64 rows over all columns with B straight
from WMMA fragment order, and the up product and mix at 256 rows.
R4D_HC_READ_PF2 picks 1 both halves, 2 or 3 one of them, 4 a 128-row down
product. Bit-identical to the wide and the decode tiles' forms; unset, as
before. At M = 2048: 711 -> 611 us a call.
This commit is contained in:
keptn42 authored and StillDeadcode committed 2026-10-06 11:22:32 +02:00
1 parent 0eeee5bb3a
commit 075dfefe54
3 files changed
+748 -34

No files matched your search

+4 -2
View File
@@ -629,8 +629,10 @@ void r4d_qsa_score_pin_form(int form);
void r4d_moe_gemm_pin_prefill(int form);
// THE GATED RESIDUAL READ'S PREFILL TILE, pinned for a test: 0 is the launcher's rule, 1 the decode
// tiles' kernels at 128 rows (hc_down_tiled, then hc_up_tiled into `ubuf` and hc_mix), 2 the wide
// kernels (which then refuse a shape they are not built for). The two are bit-identical by
// construction, and r4d_selftest compares their bytes.
// kernels (which then refuse a shape they are not built for), 3..6 the PF2 forms that
// R4D_HC_READ_PF2=1..4 puts in the rule (the same, and also refused where the band cannot hold
// their weight planes). All are bit-identical by construction, and r4d_selftest compares their
// bytes.
void r4d_hc_read_pin_prefill(int form);
// THE SAME NARROW GEMM WITH r4d_gated_quant_fp8's PASS IN ITS EPILOGUE, for a gate_up projection
// whose only consumer is that quantiser. `wq` is the [2*nout][K] gate_up plane -- gate first, the