bailing_hybrid: Ling-3.0-flash on an IQ8R trunk

Flash clamps its SwiGLU in its last layers (routed 35-41, shared 34-41). The plugin and MoeFP8's
check for int8 activations refused a rotated int8 trunk over them, since the int8 gated products
had no clamped form. With the previous commit they have one, so both refusals go. MoeFP8
keeps the refusal for a W5NL down projection: no clamp writes its rotated E4M3 codes.

flash_iq8r_clamps_its_gated_products_then_quantises_them_rotated declares flash's IQ8R container
at one, two and four ranks, every rank: 15 swiglu_step, each followed by had_quant_act_i8g reading
its plane at group 128; against the same container without the clamp lists 15 ops more and 15
gated_had_quant_i8g fewer, and no unrotated int8 or E4M3 quantiser. The steps run lint-clean. It
fails without the previous commit. The graph hashes of the bf16 and four-bit containers stay the
same. bailing_hybrid_arch_test: 9 of 9 pass; ctest -LE 'gpu|oot': 181 of 181 (3 skipped).
This commit is contained in:
keptn42 authored and StillDeadcode committed 2026-11-17 18:26:13 +01:00
1 parent 2e558e2dcc
commit 33f9644701
5 files changed
+65 -29

No files matched your search

+3 -10
View File
@@ -42,7 +42,8 @@
* library serves the rotating norm, each linear quantises the norm's bf16 output itself and
* the routed experts read a rotated copy written once a layer. The linears the recipe keeps
* bf16 (the KDA beta, the MLA's low-rank q and kv and its head gate) read the norm's bf16
* output in either case. Unclamped SwiGLU only: the int8 gated products have no clamped form.
* output in either case. A clamped SwiGLU (flash's last layers) writes the bf16 product,
* which had_quant_act_i8g quantises: one launch more than the unclamped gated product.
* - any other (bf16, the four-bit experts of ling3-w4a8-rtn and ling-3.0-tiny-iq4, the GGUF
* releases): the norms write E4M3 codes, each linear reads the bf16 plane or quantises it
* itself, and four-bit experts read the E4M3 pair (rotated ones a rotated copy of it).
@@ -854,7 +855,7 @@ static int declare(RadBuilder* b, const RadModelMeta* meta, const RadBuildCtx* c
int64_t shared_g8 = m.trunk_g8;
if (m.trunk_rot) {
/* The routed experts read the trunk's rotated int8 codes (MoeFP8::a8), which only a
* rotated expert meets; and the int8 gated products have no clamped form. */
* rotated expert meets. A clamped layer clamps, then quantises (GateQuantFP8). */
for (int l = (int)s.dense_layers; l < (int)s.n_layer + (mtp ? 1 : 0); ++l) {
const MoeFP8::Config& c = msrc[(size_t)l].cfg;
if (c.expert_bf16 || !c.expert_rot) {
@@ -864,14 +865,6 @@ static int declare(RadBuilder* b, const RadModelMeta* meta, const RadBuildCtx* c
l, c.expert_bf16 ? "plain bf16" : "unrotated");
return RAD_E_UNSUPPORTED;
}
if (c.swiglu_limit > 0 || c.shared_swiglu_limit > 0) {
fprintf(stderr, "radiance: bailing_hybrid: layer %d clamps its SwiGLU (routed %g, "
"shared %g) and the trunk is rotated int8, whose gated products "
"write int8 codes with no clamped form; this checkpoint is served "
"with a bf16 or four-bit trunk\n",
l, c.swiglu_limit, c.shared_swiglu_limit);
return RAD_E_UNSUPPORTED;
}
}
m.norm_fed = rad_op_declared(b, "rmsnorm_had_quant_i8g") != 0;
/* The shared expert's down projection is a trunk linear whose input codes take the group
+9 -4
View File
@@ -1087,15 +1087,20 @@ inline int MoeFP8::declare(RadBuilder* b, Names& nm, const Geom& geom, int l,
const bool pair = w.eff.q8 && w.eff.s8 && w.eff.q8_rot && w.eff.g8 == RAD_FP8_BLOCK;
const bool down_supported = down_w5_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;
if (!pair || !c.expert_rot || !kServed8[fmt[0]] || !down_supported || c.calib ||
c.swiglu_limit > 0) {
clamp_w5) {
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, unclamped, outside "
"calibration; these are %s / %s%s\n", l,
"rotated codes at one scale a 128 of K, outside calibration; these "
"are %s / %s%s%s\n", 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");
pair ? "" : ", and the gated product's int8 pair is not that",
clamp_w5 ? ", and a W5NL down projection is served unclamped only" : "");
return RAD_E_UNSUPPORTED;
}
}