libr4d: rmsnorm_had_quant_i8g, ar_rmsnorm_had_quant_i8g, gated_had_quant_i8g -- producers that write rotated int8 codes

An i8a8h linear quantises its own input from the bf16 plane with had_quant_act_i8g, so a decode
step of the int8 Qwen3.8-27B issues 288 of them after the norms and the silu product. These three
device ops write those codes from the producer instead:

- rmsnorm_had_quant_i8g and ar_rmsnorm_had_quant_i8g (exact and wire=6): norm_quant_row gains an
  HI8 form, r4d_fwht_wave<128> and then quant_group<I8>, on the lane mapping, rotation and rounding
  had_quant_act_i8g uses.
- gated_had_quant_i8g: the gated kernel's existing ROT && I8 instance, which the shim refused.

Each writes the bytes its producer followed by had_quant_act_i8g writes. They are ops of their own,
not a flag on the fp8 forms, as gated_had_quant_fp8 is: a rotated and a plain quantiser must not be
substitutable. n % 128 == 0; device only, so a graph falls back to the pair where they are not
declared.

r4d_selftest checks each against its pair byte for byte (plain, with the residual add and the
residual it leaves, and the gated product) and that each refuses E4M3 codes. The all-reduce form
is skipped like ar_rmsnorm_quant_fp8, since it needs a peer rank.

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 3ef9ce33ae
commit d999524054
8 files changed
+430 -50

No files matched your search

+6
View File
@@ -381,6 +381,7 @@ int r4d_rad_ar_twoshot_4rank_ti8 (const RadArgs*, RadStream);
int r4d_rad_ar_ln_init(const RadParam*, int, int rank, int world, void** out);
int r4d_rad_ar_ln_had_quant_i8(const RadArgs*, RadStream);
int r4d_rad_ar_rmsnorm_quant_fp8(const RadArgs*, RadStream);
int r4d_rad_ar_rmsnorm_had_quant_i8g(const RadArgs*, RadStream);
int r4d_rad_ar_hc_write(const RadArgs*, RadStream);
/* ar_hc_write at four ranks, exact wire only, on an instance of the wide family keyed by its own
* M bound. */
@@ -493,8 +494,10 @@ int r4d_rad_quant_act_fp8 (const RadArgs*, RadStream);
int r4d_rad_had_quant_act_fp8 (const RadArgs*, RadStream);
int r4d_rad_givens_rotate (const RadArgs*, RadStream);
int r4d_rad_rmsnorm_quant_fp8(const RadArgs*, RadStream);
int r4d_rad_rmsnorm_had_quant_i8g(const RadArgs*, RadStream);
int r4d_rad_gated_quant_fp8 (const RadArgs*, RadStream);
int r4d_rad_gated_had_quant_fp8(const RadArgs*, RadStream);
int r4d_rad_gated_had_quant_i8g(const RadArgs*, RadStream);
int r4d_rad_gate_quant_fp8 (const RadArgs*, RadStream);
int r4d_rad_gram_accum (const RadArgs*, RadStream);
/* The same accumulator over a plain bf16 activation, no scale operand. */
@@ -783,6 +786,7 @@ int r4d_shape_all_reduce (const RadParam*, int, int operand, RadOpdDes
int r4d_shape_all_gather (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_ar_ln_had_quant_i8 (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_ar_rmsnorm_quant_fp8 (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_ar_rmsnorm_had_quant_i8g (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_ar_hc_write (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_ar_gather_hc_write (const RadParam*, int, int operand, RadOpdDesc*);
@@ -813,6 +817,8 @@ int r4d_shape_gdn_gated_norm_had_quant_i8(const RadParam*, int, int operand,
int r4d_shape_quant_act_fp8 (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_rmsnorm_quant_fp8 (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_gated_quant_fp8 (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_rmsnorm_had_quant_i8g (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_gated_had_quant_i8g (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_gate_quant_fp8 (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_gram_accum (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_qsa_block_key (const RadParam*, int, int operand, RadOpdDesc*);