qwen35_w8a8: the int8 linears take their rotated codes from the norm and silu producers

- ActFP8::q8_rot marks fed codes as rotated. NormQuantFP8 declares (ar_)rmsnorm_had_quant_i8g and
  GateQuantFP8 declares gated_had_quant_i8g when an activation is fed and rotated. LinearFP8 takes
  fed codes on an i8a8h weight only if their rotation is the weight's.
- The MLP no longer writes the bf16 silu product when the down projection is fed.
- qwen35_w8a8 feeds the normed input and the FFN activation only where libr4d declares the ops
  (at TP2 the all-reduce form too), so the CPU graphs are unchanged.

A decode step's had_quant_act_i8g launches fall from 288 to 64; the 64 left quantise the attention
and delta-net outputs. The codes are the same bytes. On 2x R9700, against 1.9.0 with the RTN
container:
- KL rows are identical, and greedy answers are byte-identical at TP2 and TP1, with acceptance
  unchanged.
- TP2: 33.98 -> 32.87 ms a decode step, 111.2 -> 114.9 tok/s.
- TP1: 55.81 -> 54.59 ms, 62.7 -> 64.1 tok/s.
- Prefill: +2%.

arch_test pins the unfused chain where the ops are undeclared, and the fed path where they are
(had_quant_act_i8g 8, rmsnorm_had_quant_i8g 16, gated_had_quant_i8g 8). The every-op-declared graph
hashes are re-pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
eddie168168andClaude Opus 5.5 authored and StillDeadcode committed 2026-10-21 09:25:39 +02:00
1 parent d999524054
commit e28e2d89f8
4 files changed
+91 -25

No files matched your search

+14
View File
@@ -750,6 +750,20 @@ static int declare(RadBuilder* b, const RadModelMeta* meta, const RadBuildCtx* c
RAD_ARCH_TRY(m.a_ffn.declare_qs(b, nm, g, "ffn", g.n_ff, 0, m.trunk_i8));
#endif
#if QWEN35_W8A8
/* ---- the rotated trunk's quantisers in their producers. Every reader of `h`'s codes is a
* rotated int8 projection (q, k, v; the delta net's qkv|z; gate_up), and of `ffn`'s the down
* projection, so where libr4d serves the `_had_quant_i8g` forms the norms and the gated
* product write had_quant_act_i8g's codes themselves (ActFP8::q8_rot) and those projections
* declare no quantiser: one launch for q, k and v instead of three, and none before down. The
* codes are the same bytes. Where the forms are not declared (the CPU kernels), each
* projection quantises its own input from the bf16 plane, as before. */
if (rad_op_declared(b, "rmsnorm_had_quant_i8g") &&
(g.world != 2 || rad_op_declared(b, "ar_rmsnorm_had_quant_i8g")))
m.a_h.q8_fed = m.a_h.q8_rot = true;
if (rad_op_declared(b, "gated_had_quant_i8g")) m.a_ffn.q8_fed = m.a_ffn.q8_rot = true;
#endif
m.b_hout = decl_b(b, nm.f("h_out"), g.act_dtype, {g.max_logit_rows, g.n_embd});
/* The auxiliary taps, only when the container carries the drafter and the deployment