libr4d: mla_attn_paged splits by heads alone, so a verify row matches its single-row decode

The history split was sized by rows * heads and clamped by the step's longest table: at eight heads
one and two rows split 16 ways and three rows 11, so the k + 1 rows of a speculative verify summed
their partials in another order than the single-row decodes at the same positions, and Ling-3.0's
greedy text left the run without speculation from MTP depth 2 on. The count now comes from the
head count only; a scratch hook sizes the partials for up to 32 rows a launch, and a larger batch
takes as many splits as its scratch holds. r4d_emu's mla test holds verify launches of 2 to 32
rows to their single-row decodes bit for bit.
This commit is contained in:
keptn42 authored and StillDeadcode committed 2026-11-03 19:07:34 +01:00
1 parent 303060f210
commit ab736ca3e3
5 files changed
+110 -6

No files matched your search

+1 -1
View File
@@ -6314,7 +6314,7 @@ static const RadKernelInfo kKernels[] = {
"latent_dim=512, rope_dim=64, heads<=64, block_size<=256; one page table a sequence",
"bf16 Q/rotary/cache/gate/output, f32 softmax and partials",
RAD_DOMAIN_DEVICE, R4D_PRIO_ONLY, ROW(cMlaAttnPaged), NOTUNE,
nullptr, nullptr, r4d_rad_mla_attn_paged, r4d_rad_mla_attn_scratch, nullptr, nullptr,
nullptr, nullptr, r4d_rad_mla_attn_paged, r4d_rad_mla_attn_paged_scratch, nullptr, nullptr,
r4d_shape_mla_attn_paged },
{ "mla_project_bf16", "mla_project", "attn", "per-head absorbed MLA projections",
"head_dim 128 or 256, latent_dim=512; pitched tensors", "bf16 input, weights and output; fp32 arithmetic",