arch/gemma4: the DFlash head reads a block-fp8 copy of the table where the container holds one

The drafter's head was `gemm_nt` over the target's bf16 table -- 352 MiB a rank at tp 4, every draft
pass, 566 us of a 26B-A4B decode step under --profile-ops on 4x R9700: the widest read on the draft
path, and the "first thing to change once the model runs" its own comment named.

A container may now hold the table a second time as `dflash.draft_head.weight`, block fp8 -- one
checkpoint tensor, two logical weights, as rad_block_dflash2.h does it -- made by the recipe line

    dflash.draft_head.weight  rtn codes=fp8_e4m3 block=128x128 scale=bf16

which the three gemma4-26b-a4b -df recipes now carry. Where the copy is there, the head is
quant_act_fp8 over the gathered rows and gemm_nt_q over the copy at fp8a8: half the bytes, for 176
MiB a rank more. The copy is row-sharded exactly as the table, so a rank's rows are the same
vocabulary slice and row_topk's vocab_off, the all_gather and pair_argmax are unchanged. Drafts are
verified, so the coarser logits change what is proposed and never what is accepted --
draft_n_accepted says whether they propose worse; there is no rerank against the bf16 table yet.

Where the copy is not there -- every container converted before this, or one whose recipe made it
something other than block fp8 -- the head reads the bf16 table exactly as before. The decision is
the stored encoding's (weight_enc on the copy's name), and the copy's name map entry alone writes
nothing: rad-convert walks the declared weights. The startup note names the head in use. The
block-fp8 test moves to one helper, which the routed experts' encoding check now uses too.

arch_test: with the copy's encoding block fp8, the copy is declared and the head is gemm_nt_q over
it from the quantised rows; without, nothing is declared and the head is gemm_nt over the table;
a draft pass issues the head once either way. ARCHITECTURES.md says so.

Not yet run on the cards; it needs a container converted with the new recipe line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AshlynandClaude Opus 5.5 committed 2026-10-12 14:40:04 -05:00
1 parent 73c3dc38be
commit 743b7e1a6a
7 files changed
+157 -20

No files matched your search

@@ -15,3 +15,9 @@ dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
# The drafter's head: the target's tied table again under a name of its own, block fp8, which the
# draft head reads instead of the bf16 table -- half the widest read on the draft path, for half
# the table's bytes again (176 MiB a rank at tp 4). Drafts are verified, so this changes what is
# proposed, never what is accepted.
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
@@ -23,3 +23,9 @@ dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
# The drafter's head: the target's tied table again under a name of its own, block fp8, which the
# draft head reads instead of the bf16 table -- half the widest read on the draft path, for half
# the table's bytes again (176 MiB a rank at tp 4). Drafts are verified, so this changes what is
# proposed, never what is accepted.
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
+6
View File
@@ -25,3 +25,9 @@ dflash.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
dflash.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
# The drafter's head: the target's tied table again under a name of its own, block fp8, which the
# draft head reads instead of the bf16 table -- half the widest read on the draft path, for half
# the table's bytes again (176 MiB a rank at tp 4). Drafts are verified, so this changes what is
# proposed, never what is accepted.
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16