minimaxh3: fuse the int8 modulated-norm producer, dropping the bf16 plane

b025018's W8A8 DiT path unfused the norm: rms_mod wrote a bf16 plane and
each int8 linear re-quantised it. That bf16 plane grew the activation arena
14.41->15.54 GiB, which left vram_kv=0 and the server aborted at startup.

Mirror the E4M3 path instead. rms_mod_kernel gains a third quant mode (i8),
sharing r4d_q8.h's q8_top/q8_pack4 with the int8 quantiser, exposed as the
new rms_mod_quant_i8 op; the block's modulated norm now writes a_hm's int8
code pair directly (a_hm is q8_fed, so qkv/gate_up read the codes with no
per-linear quantiser) and a_hm carries no bf16 plane. ActFP8::cq()/cs()
resolve the pair by trunk format, so the norm producer and both step issues
collapse to one path. LinearFP8's int8 guard now demands the bf16 plane only
when it quantises itself, matching the fp8 branch, which never required it.

Arena is back to fp8 parity (243 buffers, vram_kv 938 MiB); the container
serves at TP2 and renders all five task types device-clean.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
gearwave00001andClaude committed 2026-10-20 10:40:03 -05:00
1 parent cbbab03183
commit 0fe7771210
5 files changed
+82 -85

No files matched your search

+11
View File
@@ -3041,6 +3041,9 @@ static const RadOpSchema kSchemas[] = {
SCHEMA("rms_mod_quant_fp8", pRmsModQ, oRmsModQ,
"rms_mod with the chain in bf16, then (q, scale) = quant_act_fp8(z, group); z written "
"when bound."),
SCHEMA("rms_mod_quant_i8", pRmsModQ, oRmsModQ,
"rms_mod with the chain in bf16, then (q, scale) = quant_act_i8g(z, group) -- int8 codes "
"a quarter of E4M3's error on the same byte; z written when bound."),
SCHEMA("flow_x0_step", pGenMn, oFlowX0,
"x = r x + (1 - r) (x + (1 - t) v), r = sigma_next / sigma, each step one f32 "
"rounding."),
@@ -7291,6 +7294,14 @@ R4D_WIN_PAIR(512, 1) R4D_WIN_PAIR(512, 2) R4D_WIN_PAIR(512, 4) R4D_WIN_PAIR(512,
ROW(cRmsModQ), NOTUNE,
nullptr, nullptr, r4d_rad_rms_mod_quant_fp8 },
{ "rms_mod_quant_i8_bf16", "rms_mod_quant_i8", "norm",
"gated residual, modulated RMS norm and quant_act_i8g in one pass: a workgroup a row",
"n % 128 == 0, n <= 8192, group 128; s a column slice at its own pitch",
"bf16 rows, gain and table, int8 codes and f32 scales",
RAD_DOMAIN_DEVICE, R4D_PRIO_ONLY,
ROW(cRmsModQ), NOTUNE,
nullptr, nullptr, r4d_rad_rms_mod_quant_i8 },
{ "flow_x0_step_f32", "flow_x0_step", "elem",
"a sampler step toward the clean estimate", "any M, row pitches honoured",
"f32 state, f32 or bf16 velocity",