radiance 1.13.0

New models:
- Tencent Hy-Memory (HYV3) from its BF16, FP8 and GGUF checkpoints, with its native tool calls
- M2XFP4: metadata-augmented MXFP4 weights for Qwen3.8-27B and its DFlash2 drafter (top-1 89.1% ->
  92.4% against plain MXFP4), its quantiser and recipe, and ParoQuant's M2XFP4 checkpoints
- Gemma 4 E2B/E4B audio input; NVIDIA-Nemotron-3.5-Bolt-E4B in int8 and 4-bit, on two cards by
  default; Ornith-1.5-122B compose files

Speed:
- Weight reads beside the decode all-reduces (qwen35_fp8, gemma3; --weight-prefetch, on by default):
  the 27B MXFP4 with DFlash2 61.2 -> 67.9 tok/s at c1, TranslateGemma 27B +13%
- Head-256 split-KV decode attention at 256 workgroups and without bank conflicts (27B: +3-5% a
  step at 25-41K context), and the prefill KV split for small launches (a short turn over a long
  context decodes the other sequences 27% faster in that step)
- MXFP4 decode gate_up, activation and fp8 quantiser in one launch (27B, Gemma 3 up to 64 rows:
  TranslateGemma +2-5% at 2-8 streams)
- ParoQuant int4/int5 tiled GEMMs 6-9% faster
- Speculation: a step's tokens are sent before the drafter's passes end, no step waits behind one
  that ends its requests, and the MTP head's first draft no longer collapses after short chats in
  the prefix cache

Features:
- --kv-resident N: KV streaming for a context bigger than VRAM (qwen4exp_fp8, GLM-5.3)
- MiniMax-H3: reference media and keyframe conditioning with the VAE encoders
- Krea 2 rebalance presets balanced, detail and subtle
- The dashboard's request history; a stall watch that reports a frozen step's thread and stack
- rad-tune at the served configuration, collectives measured as the exchange; Gemma 4 E2B/E4B's
  per-layer embeddings read ahead off the step path
- A GPTQ calibration tap and recipe for Gemma 4 31B's w4a8 container

Fixes:
- The two-rank all-reduce checks that a peer's push has landed before reducing it
- z-lab's DFlash drafter on Gemma 4 31B keeps drafting after a prefix-cache hit
- MiniMax-H3's modulation rows

Changes: Plugin ABI 31: out-of-tree plugins must be rebuilt. RADIANCE_PREFETCH_BESIDE is
--weight-prefetch now; RADIANCE_NO_HUGE_PAGES, RADIANCE_IDS_EARLY, RADIANCE_ATTN_BAND_SPLIT,
R4D_PREFILL_SPLITS, RAD_PLE_TIMING and RAD_PLE_CACHE_ROWS are gone.
This commit is contained in:
Deadcode committed 2026-10-27 16:47:35 +01:00
198 files changed
+20904 -3240

No files matched your search

+191
View File
@@ -18,6 +18,9 @@
#include "runtime/ctx.h"
#include "runtime/kvbind.h"
#include "mem/kv.h"
#include "kvstream/bind.h"
#include "kvstream/plan.h"
#include "kvstream/stage.h"
#include "runtime/rank_barrier.h"
#include "runtime/residency.h"
#include "runtime/wtab.h"
@@ -1696,6 +1699,9 @@ TEST(too_many_operands_or_an_unknown_handle_is_refused) {
/* ================================================================== KV operands */
namespace {
alignas(64) uint16_t g_kv_pool[4 * 2048];
/* One layer of a 13-layer group's context: [8 blocks, 2 heads, 4 tokens, 2*4] fp8 = 512 B. A
* prefill pool for a streamed group is this deep, not 13 of these. */
alignas(64) uint8_t g_alias_pool[8 * 2 * 4 * 2 * 4];
/* Group 1: full attention over layers 3, 7 and 11, rank 4. Group 2: a conv state, rank 3, over
* layer 0. Group 0 is the sentinel every handle table carries, with no pool. */
@@ -1802,6 +1808,132 @@ TEST(kv_pools_bind_each_layer_to_its_place_in_the_group) {
CHECK_EQ(b[3].layer_slot[2], 0);
}
/* A streamed group's prefill pool is ONE layer deep and every layer of the group addresses it.
*
* Above `qsa_exact_to` one prefill launch selects 70-100% of the live history (docs/KV-STREAMING.md
* §3.5), so a decode-sized ring overflows and the prefill path stages one layer's history into an
* identity-layout buffer instead. Layer L is staged into that buffer, read, and then overwritten by
* layer L+1, so the buffer is one layer deep rather than `n_layers` deep: 128 MiB at 262K fp8 on
* two ranks, against 1.66 GiB.
*
* The operand resolution accepts it, and the depth is the whole arithmetic: `layer_slot` is a
* lookup and the only bound is `off + layer_stride <= bytes` (runtime/issue.cpp:781-789), which a
* one-layer-deep pool satisfies at `off == 0` for every layer. This case pins that, pins that an
* identity table over the same pool is refused (so the depth is not silently tolerated), and pins
* the two facts that make aliasing a *binding* change rather than a hand-built layer table: the
* same table is the host mirror's row (`rad_kv_layer_index`, arch/common/rad_arch.h:1028-1032), so
* mapping every layer to 0 collapses the mirror; and bind_kv_pools derives the table from each
* layer's position in the group, so an aliased table cannot come from it. */
TEST(a_streamed_groups_layers_may_all_alias_one_pool_slot) {
const int64_t n_blocks = 8, heads = 2, block = 4, hd = 4;
const int64_t lbpb = heads * block * 2 * hd; /* one block of ONE layer */
const int64_t stride = n_blocks * lbpb; /* one whole layer: the stage's depth */
const int64_t shape[4] = { n_blocks, heads, block, 2 * hd };
const int64_t st[4] = { heads * block * 2 * hd, block * 2 * hd, 2 * hd, 1 };
Fixture f;
f.kv.assign(2, rad::KVPoolBinding{});
rad::KVPoolBinding& alias = f.kv[1];
alias.base = g_alias_pool;
alias.layer_stride = stride;
alias.bytes = stride; /* 13 layers share these bytes */
alias.depth = 1; /* every layer resolves to offset 0 */
alias.dtype = RAD_F8E4M3;
alias.layer_slot.assign(13, 0);
for (int l = 0; l < 13; ++l) alias.layer_slot[(size_t)l] = l; /* the MIRROR row */
alias.rank = 4;
for (int d = 0; d < 4; ++d) alias.shape[d] = shape[d];
rad_op op = loose_op(f, "attn_paged");
CHECK_OK(f.start());
/* The recorder keeps eight operands, so the 13 layers go in two issues. Every layer reads the
* same pool base because `depth` is 1, and the operand's shape follows the stage view. */
for (int first = 0; first < 13; first += 8) {
const int last = first + 8 < 13 ? first + 8 : 13;
std::vector<RadOperand> some;
for (int l = first; l < last; ++l) some.push_back(RAD_KV(1, l));
CHECK_OK(issue_once(f, first, op, some));
REQUIRE_EQ(g_rec.size(), (size_t)1);
REQUIRE_EQ(g_rec[0].n_t, last - first);
for (int l = first; l < last; ++l) {
const RadTensor& t = g_rec[0].t[l - first];
CHECK(t.data == (void*)g_alias_pool);
CHECK_EQ((int)t.rank, 4);
CHECK_EQ((int)t.dtype, (int)RAD_F8E4M3);
for (int d = 0; d < 4; ++d) {
CHECK_EQ(t.shape[d], shape[d]);
CHECK_EQ(t.stride[d], st[d]);
}
}
}
/* The mirror's row comes from the same lookup, which is why aliasing has to be a depth of the
* binding and not a rewritten layer_slot: with depth 1 every layer would read layer 0's mirror
* row. The lookup itself is untouched and still positional. */
for (int l = 0; l < 13; ++l) CHECK_EQ(f.ctx.kv_layer_index(1, l), (int64_t)l);
/* The same one-layer-deep pool with depth 0 is a positional table, and `bytes` is the only
* bound: it serves exactly layer 0 and refuses the rest. This is what makes the aliasing a
* deliberate depth rather than something issue.cpp silently tolerates. */
Fixture g;
g.kv.assign(2, rad::KVPoolBinding{});
g.kv[1] = alias;
g.kv[1].depth = 0;
for (int l = 0; l < 13; ++l) g.kv[1].layer_slot[(size_t)l] = l;
rad_op op_g = loose_op(g, "attn_paged");
CHECK_OK(g.start());
refused(g, issue_once(g, 0, op_g, { RAD_KV(1, 1) }), RAD_E_INVAL, "outside the");
next_step_clean(g, 1, op_g, { RAD_KV(1, 0) });
/* The plan's arithmetic: the ring is n_slots blocks of every layer, the stage is the context
* one layer deep, and the carve is their maximum, never their sum. */
rad::KVGroupPlan p;
p.kind = RAD_KV_FULL;
p.n_layers = 13;
p.n_blocks = n_blocks;
p.n_slots = 2; /* a decode-sized ring, smaller than the context */
p.depth = 1;
p.block_size = block;
p.bytes_per_block = 13 * lbpb;
CHECK_EQ(p.layer_stride(), 2 * lbpb);
CHECK_EQ(p.streamed(), true);
CHECK_EQ(p.n_blocks * p.layer_bytes_per_block(), stride); /* one layer, not 13 */
CHECK_EQ(rad::kv_ring_bytes(p, 2), 2 * 13 * lbpb);
CHECK_EQ(rad::kv_pool_bytes(p), 2 * 13 * lbpb); /* ring wins here */
CHECK_EQ(rad::kv_ceiling_bytes(p, 200, 2), 200 * lbpb); /* stage wins at context */
/* The engine's own builder places each bound layer at its position in the group and keeps the
* pool alias a view, so both views are fixed from bring-up and the ring is active first. */
Program P;
P.kv_groups.resize(2);
P.kv_groups[1].decl.kind = RAD_KV_FULL;
P.kv_groups[1].decl.n_head_kv = heads;
P.kv_groups[1].decl.head_dim = hd;
for (int l = 0; l < 13; ++l) P.kv_groups[1].layers.push_back(l);
std::vector<rad::KVGroupPlan> plans(2);
plans[1] = p;
plans[1].base = g_alias_pool;
plans[1].pool_bytes = rad::kv_pool_bytes(p);
std::vector<rad::KVPoolBinding> b;
rad::bind_kv_pools(P, [&](int32_t x) -> const rad::KVGroupPlan* {
return x == 0 ? nullptr : &plans[(size_t)x];
}, &b);
REQUIRE_EQ(b.size(), (size_t)2);
REQUIRE_EQ(b[1].layer_slot.size(), (size_t)13);
for (int l = 0; l < 13; ++l) CHECK_EQ(b[1].layer_slot[(size_t)l], l);
REQUIRE(b[1].has_stage);
CHECK_EQ(b[1].depth, 0); /* the ring is the active view */
CHECK_EQ(b[1].layer_stride, 2 * lbpb);
CHECK_EQ(b[1].shape[0], 2);
CHECK_EQ(b[1].stage.layer_stride, stride);
CHECK_EQ(b[1].stage.shape0, n_blocks);
rad::kv_binding_enter(b[1], rad::KVView::Stage);
CHECK_EQ(b[1].depth, 1);
CHECK_EQ(b[1].layer_stride, stride);
CHECK_EQ(b[1].shape[0], n_blocks);
for (int l = 0; l < 13; ++l) CHECK_EQ(rad::kv_binding_offset(b[1], l), 0);
}
/* ================================================================== arena levels */
/* A level packs the transient buffers for smaller steps at new offsets with smaller shapes; the
* active level decides every buffer's address and the extent an operand is checked against, so a
@@ -2219,6 +2351,65 @@ TEST(the_pass_key_changes_with_the_arena_level) {
CHECK_EQ(f.ctx.pass_key(&b), k0);
}
/* A streamed pass's key names the memory its view reads, not the address of the struct that
* carries it, which rotates through the builder's Out slots: keyed on that, no streamed decode pass
* would ever replay. Two views with the same bytes must agree, a view that hands a kernel different
* memory must not, and on a card the same streamed pass twice must play. The host backend records
* no tape, so only the key is checked there. */
TEST(a_streamed_pass_is_keyed_by_its_view_and_replays) {
Fixture f;
rad_buf x = f.add_buffer("x", RAD_BF16, 64, 4, 0);
rad_op op = loose_op(f);
CHECK_OK(f.start(nullptr, false, /*record=*/true));
std::vector<int32_t> res(64, -1), sblk(64, -1), sst(128, 0), ctl(16, 0);
std::vector<uint8_t> host(1024, 0);
RadKVStream view{};
view.host = host.data(); view.res = res.data(); view.slot_block = sblk.data();
view.slot_state = sst.data(); view.ctl = ctl.data();
view.block_bytes = 16; view.host_layer_stride = 1024; view.slots = 64;
view.host_bytes = 2048;
RadKVGroupBatch kg[1]{};
f.batch.kv = kg;
f.batch.n_kv_groups = 1;
f.batch.phase = RAD_PHASE_DECODE;
f.batch.n_tok = 1; f.batch.n_seq = 1;
kg[0].stream = &view;
const uint64_t k0 = f.ctx.pass_key(&f.batch);
CHECK(k0 != 0);
/* The Out slot moves; the bytes a kernel reads do not. */
RadKVStream copy = view;
kg[0].stream = &copy;
CHECK_EQ(f.ctx.pass_key(&f.batch), k0);
/* A different ring or a different map is a different pass. */
copy.slots = view.slots + 1;
CHECK(f.ctx.pass_key(&f.batch) != k0);
copy = view;
copy.res = res.data() + 1;
CHECK(f.ctx.pass_key(&f.batch) != k0);
kg[0].stream = &view;
const auto body = [&](Ctx& c) {
const RadOperand o[1] = { RAD_B(x) };
CHECK_OK(c.issue(op, o, 1, RAD_N_BATCH));
};
/* First sighting records, the second is the audit every recording gets before its first play,
* the third is the play. A key that moved each step would never get past the first. */
/* The first pass settles the runtime state the key also names (the host-touch and scratch
* flags a pass leaves behind), then: one sighting records, the next is the audit every
* recording gets before its first play, the third is the play. A key that moved with the view
* slot would never get past the first. */
for (int i = 0; i < 4; ++i) CHECK_OK(f.step(1, i, body));
if (f.ctx.records_passes()) {
const Ctx::PassCounts pc = f.ctx.pass_counts();
CHECK(pc.recorded > 0);
CHECK(pc.audited > 0);
CHECK(pc.played > 0); /* the streamed pass replayed, not reissued */
}
}
/* ================================================================== the op oracle */
namespace {
std::string radiance_home() {