moe_gemm_q decode form: two K blocks a pass, and weight loads without serial waits

In the decode form every weight load is a flat_load through a table pointer
in VGPRs, and the waitcnt pass puts s_wait_loadcnt 0 in front of each, so a
pass's scale, activation and weight loads go out one after the other.
R4D_MOE_UWLOAD=1 makes the table entries uniform and reads them through
address_space(1), issues the scale loads unconditionally, and uses LDS
barriers in the K loop with one release fence for the prefetch: one wait a
pass. R4D_MOE_GU_FK256=1 (or =N, up to N routed rows) stages two 128-wide
K blocks a gate_up pass. Both bit-identical and off by default; the default
kernels are instruction-identical to before. r4d_selftest compares every
variant byte for byte.
This commit is contained in:
keptn42 authored and StillDeadcode committed 2026-10-06 11:22:43 +02:00
1 parent d7aa401568
commit 6e14caaedd
3 files changed
+387 -64

No files matched your search

+8
View File
@@ -627,6 +627,14 @@ void r4d_qsa_score_pin_form(int form);
// prefill form, 2 the (tile, run) decode form, 3 the uniform prefill grid. r4d_selftest --perfmoe
// times each and compares it with form 1.
void r4d_moe_gemm_pin_prefill(int form);
// THE DECODE FORM'S STAGED K, pinned for a test: 0 is R4D_MOE_GU_FK256's rule, 1 one 128-wide block
// a pass, 2 two wherever the shape allows it (the token-operand projection, every class's K a
// multiple of 256, a format that folds scale groups). The two are bit-identical, and r4d_selftest
// compares their bytes.
void r4d_moe_gemm_pin_fk(int pin);
// THE DECODE FORM'S WEIGHT ADDRESS, pinned for a test: 0 is R4D_MOE_UWLOAD's rule, 1 the generic
// table pointer, 2 a uniform global base. Bit-identical, and r4d_selftest compares their bytes.
void r4d_moe_gemm_pin_uw(int pin);
// 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), 3..9 the PF2 forms that