r4d mla_attn: E4M3 latent cache twins of the three rows

mla_attn takes an optional `kv_dtype`; at fp8_e4m3 the cache is E4M3 as kv_store_fp8 writes it at its
default descale of 1. mla_attn_fp8kv, mla_attn_matrix_fp8kv and mla_attn_rows_fp8kv are the bf16
rows' kernels with the cache element as a template parameter: the key load decodes E4M3 to bf16
(v_cvt_pk_f32_fp8, then the high half), which is exact since every E4M3 value is a bf16, so the
tiles and all arithmetic past the load are the bf16 instance's. The twins carry the bf16 rows'
constraints plus kv_dtype fp8_e4m3 and rank above all three bf16 rows, in their order. At uint16_t
the loads are the plain loads the bf16 kernels made; their launchers still refuse any cache that
is not bf16.

r4d_emu test_mla runs every kernel form (wave, matrix and its element load, rows forms 0-3) on E4M3
codes against its bf16 instance on the decoded cache: bit-identical on all 23 form/case pairs, and
each launcher refuses the other cache dtype.
This commit is contained in:
AnimusNull authored and AnimusNull committed 2026-11-05 14:09:13 +00:00
1 parent b632c72f5d
commit 17f0eae420
6 files changed
+249 -24

No files matched your search

+3
View File
@@ -883,6 +883,9 @@ int64_t r4d_rad_mla_attn_paged_scratch(const RadArgs*);
int r4d_rad_mla_attn_matrix(const RadArgs*, RadStream);
int64_t r4d_rad_mla_attn_matrix_scratch(const RadArgs*);
int r4d_rad_mla_attn_rows(const RadArgs*, RadStream);
int r4d_rad_mla_attn_fp8kv(const RadArgs*, RadStream);
int r4d_rad_mla_attn_matrix_fp8kv(const RadArgs*, RadStream);
int r4d_rad_mla_attn_rows_fp8kv(const RadArgs*, RadStream);
int r4d_shape_mla_attn(const RadParam*, int, int, RadOpdDesc*);
int r4d_rad_router_sigmoid_topk(const RadArgs*, RadStream);
int r4d_rad_router_sigmoid_group_topk(const RadArgs*, RadStream);