From 9b6eba80c6cdfa0b5c6605ca3a27dafe541ce427 Mon Sep 17 00:00:00 2001 From: Deadcode Date: Tue, 17 Nov 2026 21:25:44 +0100 Subject: [PATCH] arch/common: the clamp refusal reads the codebook-down flag (#503) The W6NL change renamed down_w5_fp8 to down_codebook_fp8, and the Ling-3.0-flash change, merged after it, still read the old name, so no target that includes rad_block_moe_fp8.h built. A W6NL down projection takes the W5NL route (rotated E4M3 codes), which no clamp writes, so a clamped layer is refused before either. Reported by DokterSmol. --- arch/common/rad_block_moe_fp8.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/common/rad_block_moe_fp8.h b/arch/common/rad_block_moe_fp8.h index d011a6e4..7ca842fa 100644 --- a/arch/common/rad_block_moe_fp8.h +++ b/arch/common/rad_block_moe_fp8.h @@ -1099,11 +1099,11 @@ inline int MoeFP8::declare(RadBuilder* b, Names& nm, const Geom& geom, int l, const bool down_supported = down_codebook_fp8 ? (w.eff.q && w.eff.s && kServed[fmt[1]]) : kServed8[fmt[1]] != nullptr; /* A clamped layer is served too: GateQuantFP8 clamps into the bf16 plane, then - * quantises it into the rotated codes. Not before a W5NL down projection, which reads - * rotated E4M3: no clamp writes those codes. */ - const bool clamp_w5 = down_w5_fp8 && c.swiglu_limit > 0; + * quantises it into the rotated codes. Not before a codebook (W5NL, W6NL) down + * projection, which reads rotated E4M3: no clamp writes those codes. */ + const bool clamp_codebook = down_codebook_fp8 && c.swiglu_limit > 0; if (!pair || !c.expert_rot || !kServed8[fmt[0]] || !down_supported || c.calib || - clamp_w5) { + clamp_codebook) { fprintf(stderr, "radiance: layer %d: int8 activations meet rotated experts (int8, " "four-bit, or the codebook at E4M3 scales a 64 or 32 of K) through " "rotated codes at one scale a 128 of K, outside calibration; these " @@ -1111,7 +1111,8 @@ inline int MoeFP8::declare(RadBuilder* b, Names& nm, const Geom& geom, int l, kServed[fmt[0]] ? kServed[fmt[0]] : kServed8[fmt[0]], kServed[fmt[1]] ? kServed[fmt[1]] : kServed8[fmt[1]], pair ? "" : ", and the gated product's int8 pair is not that", - clamp_w5 ? ", and a W5NL down projection is served unclamped only" : ""); + clamp_codebook ? ", and a W5NL or W6NL down projection is served unclamped only" + : ""); return RAD_E_UNSUPPORTED; } }