Archived
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.