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

+46 -10
View File
@@ -445,8 +445,8 @@ TEST(bf16_and_four_bit_containers_keep_their_graphs) {
}
/* What the plugin refuses by name: a rotated trunk over unrotated experts, rotated int8 experts
* under an unrotated trunk, an IQ8R trunk over a clamped SwiGLU (flash's last layers), and the
* tiny IQ8R trunk at four ranks, whose 1152-column dense slice cuts a 256-column scale group. */
* under an unrotated trunk, and the tiny IQ8R trunk at four ranks, whose 1152-column dense slice
* cuts a 256-column scale group. */
TEST(refuses_mismatched_forms) {
{
MetaKV mk = tiny_meta();
@@ -468,14 +468,6 @@ TEST(refuses_mismatched_forms) {
CHECK_EQ(stderr_of_rc([&] { return bailing_hybrid::declare(&b, mk.meta(), &ctx); }),
RAD_E_UNSUPPORTED);
}
{
MetaKV mk = flash_meta();
RadBuilder b;
iq8r_encs(&b);
RadBuildCtx ctx = build_ctx();
CHECK_EQ(stderr_of_rc([&] { return bailing_hybrid::declare(&b, mk.meta(), &ctx); }),
RAD_E_UNSUPPORTED);
}
{
MetaKV mk = tiny_meta();
RadBuilder b;
@@ -509,6 +501,50 @@ TEST(flash_iq8r_without_clamps_declares_its_drafter_on_the_int8_trunk) {
}
}
/* Flash's IQ8R trunk with its clamp lists declares at one, two and four ranks. Each clamped gated
* product (routed in layers 35-41, shared in 34-41) is two launches: the clamp into the bf16 plane
* (swiglu_step) and the rotating int8 quantiser reading it (had_quant_act_i8g, at the 128-column
* group of the int8 down projection that reads the codes). Against the same container without
* the clamp lists, those 15 gated_had_quant_i8g become 15 such pairs and no other op changes; no
* unrotated int8 and no E4M3 quantiser exists, and the steps run lint-clean. */
TEST(flash_iq8r_clamps_its_gated_products_then_quantises_them_rotated) {
for (int world : { 1, 2, 4 }) {
for (int rank = 0; rank < world; ++rank) {
MetaKV plain = flash_meta();
plain.drop("expert_swiglu_limit_list").drop("share_expert_swiglu_limit_list");
RadBuilder b0;
iq8r_encs(&b0);
RadBuildCtx c0 = build_ctx(rank, world);
REQUIRE_EQ(bailing_hybrid::declare(&b0, plain.meta(), &c0), RAD_OK);
MetaKV mk = flash_meta();
RadBuilder b;
iq8r_encs(&b);
RadBuildCtx ctx = build_ctx(rank, world);
REQUIRE_EQ(bailing_hybrid::declare(&b, mk.meta(), &ctx), RAD_OK);
CHECK(bailing_hybrid::g_model[0].trunk_rot);
CHECK_EQ(count_op(b, "swiglu_step"), 15);
CHECK_EQ(count_op(b, "had_quant_act_i8g") - count_op(b0, "had_quant_act_i8g"), 15);
CHECK_EQ(count_op(b0, "gated_had_quant_i8g") - count_op(b, "gated_had_quant_i8g"), 15);
CHECK_EQ(b.ops.size(), b0.ops.size() + 15);
CHECK_EQ(count_op(b, "quant_act_i8g"), 0);
CHECK_EQ(count_op(b, "quant_act_fp8"), 0);
CHECK_EQ(count_op(b, "swiglu_clamped"), 0);
for (size_t i = 0; i + 1 < b.ops.size(); ++i) {
if (b.ops[i].op != "swiglu_step") continue;
const RecOp& q = b.ops[i + 1];
CHECK_EQ(q.op, std::string("had_quant_act_i8g"));
REQUIRE_EQ(b.ops[i].writes.size(), (size_t)1);
CHECK(std::find(q.reads.begin(), q.reads.end(), b.ops[i].writes[0]) !=
q.reads.end());
const RecParam* g = param(&q, "group");
REQUIRE(g != nullptr);
CHECK_EQ(g->ival, 128LL);
}
steps_lint_clean(b, rank, world);
}
}
}
/* Per-instance state lives in the declaring instance's slot, so a second engine in the process
* leaves the first one's model alone. */
TEST(declares_into_its_own_slot) {