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

+10 -6
View File
@@ -329,6 +329,14 @@ int Ctx::bind_ops() {
p.n_bands = (int32_t)oi.bands.size();
p.plan_off = (int32_t)issue_table_.size();
p.n_opd_schema = oi.schema ? (int32_t)oi.schema->n_operands : -1;
p.n_opd_required = -1;
if (oi.schema) {
/* One past the last required operand: an issue may leave out the optional ones after
* it. */
for (int o = 0; o < oi.schema->n_operands; ++o)
if (!oi.schema->operands[o].optional) p.n_opd_required = o + 1;
if (p.n_opd_required < 0) p.n_opd_required = 0;
}
/* Matched by name once here, not on the issue path; see OpPlan::billed. */
p.billed = (oi.op == "all_reduce");
p.collective = p.billed;
@@ -959,10 +967,7 @@ uint64_t Ctx::pass_key(const RadBatch* b) const {
mix((uint64_t)k.group); ptr(k.slot_mapping); ptr(k.block_table);
mix((uint64_t)k.block_table_pitch); ptr(k.seqused); ptr(k.state_index);
mix((uint64_t)k.state_index_pitch); mix((uint64_t)k.block_size); mix((uint64_t)k.max_blocks);
/* Null on a fully resident group, a fixed set of addresses on a streamed one. Two groups
* that differ here hand a kernel different memory, so they are different passes -- and the
* view's *address* must not enter the key: the builder's Out slot rotates every step, which
* would make every streamed pass a new one (kvstream/bind.h, kvstream_view_key). */
/* A streamed group's view by the memory it names, never its address (kvstream_view_key). */
mix(kvstream_view_key(k.stream));
}
mix((uint64_t)level_);
@@ -1267,8 +1272,7 @@ int Ctx::run_pass(const RadBatch* b) {
/* A pass the stager armed for is issued live: see runtime/stager.h. */
if (!tape_on_ || staging_) { bump(pc_unkeyed_); arch_step_(this, b); return RAD_OK; }
const uint64_t key = pass_key(b);
if (key == 0) { bump(pc_unkeyed_); arch_step_(this, b);
return RAD_OK; }
if (key == 0) { bump(pc_unkeyed_); arch_step_(this, b); return RAD_OK; }
if (std::find(tape_refused_.begin(), tape_refused_.end(), key) != tape_refused_.end()) {
bump(pc_refused_);
arch_step_(this, b);
+22 -29
View File
@@ -75,9 +75,11 @@ struct OpPlan {
int32_t band_off = 0; /* into Ctx::band_table_ */
int32_t n_bands = 0;
int32_t plan_off = 0; /* into Ctx::issue_table_, band * RAD_N_DOMAINS + domain */
/* The schema's operand count, cached so the arity check avoids a cold OpInfo. -1 when the op
* has no schema. */
int32_t n_opd_schema = -1;
/* The schema's operand count, cached so the arity check avoids a cold OpInfo, -1 when the op
* has no schema; and the count without its trailing optional operands, which an issue may
* leave out. */
int32_t n_opd_schema = -1;
int32_t n_opd_required = -1;
bool issued = false; /* did the run phase ever issue it (spec §16's graph dump) */
/* Whether issuing it puts bytes on the interconnect. Set at bind from the resolved rows
* (rad_kernel_collective) and the conventional all_reduce. The weight stager's copies share
@@ -141,11 +143,9 @@ struct RouteSlot {
* LINEAR [n_states, n_head_kv, state_dim[0], state_dim[1]]
* CONV [n_states, n_head_kv * head_dim, conv_slots] channel-major, then time
*/
/* One of the two views a streamed group's allocation is addressed through. `depth` is the number
* of layer stripes the view presents: the ring keeps the group's `n_layers`, the stage presents
* one and every layer aliases offset 0. The field is a depth and NOT a rewritten `layer_slot`:
* that table is also the host mirror's row (rad_kv_layer_index), so collapsing it would write all
* layers into one mirror row (docs/KV-STREAMING.md §3.5.1). */
/* One of a streamed group's two views of its allocation (kvstream/bind.h). `depth` is the stripe
* count it presents: 0 for the ring's `n_layers`, 1 for the stage, where every layer aliases
* offset 0. */
struct KVViewState {
int64_t layer_stride = 0;
int64_t bytes = 0;
@@ -164,24 +164,19 @@ struct KVPoolBinding {
std::vector<int32_t> layer_slot;
uint32_t rank = 0; /* 0 when the group has no plan: the operand stays a flat span */
int64_t shape[RAD_MAX_RANK] = {0};
/* The active view's stripe count: 0 is n_layers, 1 is the one-layer prefill stage. */
/* The active view's stripe count, as KVViewState::depth. */
int64_t depth = 0;
/* Both fixed views over the group's one allocation. The ring is always present; the stage only
* for a group whose plan depth is 1 (its ring is smaller than its context). The active fields
* above are set from one of these before each pass (kvstream_enter), so a recorded pass that
* used a view replays against it: the pass key already carries the phase, which selects it. */
/* Both views of a streamed group's allocation; the stage only when the plan's depth is 1. The
* active fields above are set from one of them before each pass (kvstream_enter). */
KVViewState ring;
KVViewState stage;
bool has_stage = false;
/* Bytes of one layer's mirror row a staged pass must copy, from the block manager's highest
* held block (kvstream/stage.h). 0 copies the whole row, which is always correct and is what a
* caller with no manager (a test, a harness) leaves it at. Set once per step, before the pass,
* because the bound grows as a prefill appends blocks. */
/* Bytes of a layer's mirror row a staged pass copies, from the held bound (kvstream/stage.h,
* "Volume"), set each step. 0 copies the whole row. */
int64_t stage_live_bytes = 0;
};
/* The KV stage's driver, run again where a recorded pass made it (kvstream/stage.cpp). `after` is
* the call the architecture makes after a layer's attention instead of before it. */
/* The KV stage's driver (kvstream/stage.cpp), declared here for Ctx::tape_kv_stage. */
int kvstage_run(Ctx* c, int group, int layer, bool after);
struct CtxDesc {
@@ -243,19 +238,18 @@ public:
int rank() const { return rank_; }
/* Whether repeated passes are recorded and played back (prepare() says when they are not). */
bool records_passes() const { return tape_on_; }
/* Whether the pass being issued is being recorded. Work a tape cannot record -- a DMA
* submission -- must be re-run where the pass made it instead (tape_kv_stage). */
/* Whether the pass being issued is being recorded. */
bool recording() const { return rec_ != nullptr; }
/* While recording: a KV stage call becomes a host step that re-runs at every play, because the
* DMA list it hands the engine and the stream wait on the list's completion word are neither of
* them queue packets (kvstream/stage.cpp; xprefetch.cpp does the same for the prefetch). */
/* A KV stage call while recording: a host step that re-runs at every play, because its DMA
* list is not a queue packet (kvstream/stage.cpp; xprefetch.cpp does the same). */
int tape_kv_stage(bool after, int group, int layer) {
TapeStep st;
st.kind = (uint8_t)(after ? kTapeKvStageAfter : kTapeKvStage);
st.a = group;
st.b = layer;
return tape_host(st, [&] { return kvstage_run(this, group, layer, after); });
} /* This rank's device ordinal, for the calls that name a card rather than a stream. */
}
/* This rank's device ordinal, for the calls that name a card rather than a stream. */
int device() const { return device_; }
int world_size() const { return world_size_; }
RadStream stream() const { return stream_; }
@@ -274,11 +268,10 @@ public:
void* weight_ptr(rad_weight w);
void* buf_ptr(rad_buf b);
/* The group-local position of absolute model layer `layer` in the binding's layer_slot, or -1.
* rad_kv_layer_index (rad_runtime.h) exposes it to a plugin, which needs it for the host
* mirror: that is laid out by the group's layers, not by model layer numbers. */
/* The group-local position of model layer `layer` in the binding's layer_slot, or -1: the
* index of its host mirror row (rad_kv_layer_index). */
int64_t kv_layer_index(rad_kvgroup g, int layer) const;
/* The group's pool binding, for the view switch and the stage copy. */
/* The group's pool binding, for the view switch and the stage. */
const KVPoolBinding* kv_binding(rad_kvgroup g) const {
return g < kv_.size() ? &kv_[(size_t)g] : nullptr;
}
+21 -11
View File
@@ -596,8 +596,8 @@ int Ctx::issue_body(rad_op h, const RadOperand* opd, int n_opd, int64_t n) {
/* The second lane's window (rad_lane1_window_begin): its concurrent buffers are live only across
* it, so lane 1 runs nothing outside it, and lane 0 joins lane 1 before it runs an op outside
* it, on either side: a transient of such an op may share bytes with a concurrent buffer. An op
* that names no buffer (a weight read into the cache, prefetch_beside) touches nothing the window
* keeps live and has no transient: it runs on lane 1 anywhere and leaves no window work to join. */
* that names no buffer (prefetch_beside's weight read) touches nothing the window keeps live,
* so it may run on lane 1 anywhere. */
bool names_buf = false;
for (int i = 0; i < n_opd && !names_buf; ++i) names_buf = opd[i].kind == RAD_OPK_BUF;
if (program_ && program_->lane1_w1 >= 0 && names_buf) {
@@ -627,13 +627,23 @@ int Ctx::issue_body(rad_op h, const RadOperand* opd, int n_opd, int64_t n) {
return abort_step_msg(h, RAD_E_INVAL,
fmt("issued with %d operands; the runtime carries at most %d",
n_opd, MAX_OPERANDS));
if (p.n_opd_schema >= 0 && n_opd != p.n_opd_schema)
/* A count below the schema is legal only when every dropped slot is a *trailing optional*
* operand (rad_abi.h: "an absent optional operand is a null RadTensor.data" -- the shims
* branch on exactly that: r4d_opt(), rad_args_have(), libref's finish()). A count below the
* required floor shifts positions or drops a required operand, and operands are positional,
* so a miscount is silent numerical garbage. */
if (p.n_opd_schema >= 0 && (n_opd > p.n_opd_schema || n_opd < p.n_opd_required))
return abort_step_msg(h, RAD_E_SCHEMA,
fmt("issued with %d operands; the op's schema declares %d. Operands "
"are positional, so a miscount is silent numerical garbage",
n_opd, (int)p.n_opd_schema));
fmt("issued with %d operands; the op's schema declares %d "
"(%d required, only trailing optional operands may be omitted). "
"Operands are positional, so a miscount is silent numerical "
"garbage",
n_opd, (int)p.n_opd_schema, (int)p.n_opd_required));
RadTensor* t = tbuf_;
/* The schema slots the issue stopped short of: absent operands, null tensors rather than
* stale ones, since args.n_t covers every schema slot (rad_plugin.h). */
for (int i = n_opd; i < p.n_opd_schema; ++i) t[i] = RadTensor{};
bool touches_host = false; /* a host-domain buffer among the operands; see host_touch_ev_ */
for (int i = 0; i < n_opd; ++i) {
@@ -841,8 +851,9 @@ int Ctx::issue_body(rad_op h, const RadOperand* opd, int n_opd, int64_t n) {
}
}
/* The rest of RadArgs was filled in at prepare; args.t already points at tbuf_. */
ip.args.n_t = n_opd;
/* The rest of RadArgs was filled in at prepare; args.t already points at tbuf_. There is one
* entry per schema operand, the trailing optional ones the issue left out null. */
ip.args.n_t = std::max(n_opd, (int)p.n_opd_schema);
p.issued = true;
++n_issues_;
@@ -857,7 +868,7 @@ int Ctx::issue_body(rad_op h, const RadOperand* opd, int n_opd, int64_t n) {
/* The oracle snapshots every operand before the launch, so the host kernel sees the same
* input bytes even for an in-place op. */
const IssuePlan* horacle = oracle_ ? oracle_before(h, b, n_opd) : nullptr;
const IssuePlan* horacle = oracle_ ? oracle_before(h, b, ip.args.n_t) : nullptr;
/* ============================== a host launch is a join ==============================
*
@@ -1049,7 +1060,6 @@ int Ctx::issue_body(rad_op h, const RadOperand* opd, int n_opd, int64_t n) {
g_iss_lau_p = g_iss_lau;
}
} else {
/* The launch alone, split from the band scan and operand resolution `own` covers above. */
s = ip.launch(la, cur_stream());
}
if (hold) {
@@ -1075,7 +1085,7 @@ int Ctx::issue_body(rad_op h, const RadOperand* opd, int n_opd, int64_t n) {
if (er < 0) return abort_step(h, b, dom, ip, n, er);
host_touch_pending_[l] = true;
}
if (horacle) oracle_after(h, *horacle, ip, n_opd);
if (horacle) oracle_after(h, *horacle, ip, ip.args.n_t);
return RAD_OK;
}
+2 -6
View File
@@ -13,8 +13,7 @@ void bind_kv_pools(const Program& p, const std::function<const KVGroupPlan*(int3
const KVGroupPlan* gp = plan_of((int32_t)g);
if (!gp) continue;
KVPoolBinding& b = (*out)[g];
/* Stateful groups keep these as they always were; a paged group's are overwritten by
* kv_bind_views with the active view's arithmetic. */
/* A paged group's are then set from its active view by kv_bind_views. */
b.base = gp->base;
b.layer_stride = gp->layer_stride();
b.bytes = gp->pool_bytes;
@@ -37,14 +36,11 @@ void bind_kv_pools(const Program& p, const std::function<const KVGroupPlan*(int3
case RAD_KV_WINDOW:
case RAD_KV_RING:
b.rank = 4;
/* `shape[0]` follows the view and is filled by kv_bind_views below: the resident
* window's depth for the ring, the group's context for the prefill stage
* (docs/KV-STREAMING.md §3.1, §4.1). */
/* Set again per view by kv_bind_views. */
b.shape[0] = gp->pool_blocks();
b.shape[1] = d.n_head_kv;
b.shape[2] = gp->block_size;
b.shape[3] = 2 * d.head_dim;
/* Both fixed views over the group's one allocation, with the ring active. */
kv_bind_views(*gp, &b);
break;
case RAD_KV_LINEAR:
+4 -13
View File
@@ -1,7 +1,6 @@
#include "runtime/tierexec.h"
#include "rad_internal.h"
#include "kvstream/plan.h"
#include <algorithm>
#include <cstdlib>
@@ -32,17 +31,13 @@ int TierExec::configure(Registry* reg, KVManager* kv, IdleTiers* tiers,
for (int32_t g : groups) {
const KVGroupPlan* p = kv->plan(g);
if (!p || !p->paged()) continue;
/* A streamed group's pool is one layer of its context, so a gather of layer L would copy
* the last staged layer n_layers times. Its mirror is the tier and the residency map
* restores a block on the next resolve (docs/KV-STREAMING.md §4.1). */
if (!kv_tier_cached(*p)) continue;
/* A streamed group's host mirror is its tier (docs/KV-STREAMING.md §4.1). */
if (p->streamed()) continue;
GroupInfo gi;
gi.g = g;
gi.n_layers = p->n_layers;
gi.frag = p->layer_bytes_per_block();
gi.layer_stride = p->layer_stride();
/* The pool's depth: a streamed group backs fewer blocks than it addresses, and the tier
* gathers fragments of the blocks that are here (docs/KV-STREAMING.md §3.1). */
gi.n_blocks = p->pool_blocks();
gi.base = p->base;
gi.replicated = p->replicated;
@@ -116,12 +111,8 @@ int TierExec::slot_layout(const std::vector<const KVManager*>& ranks,
for (int32_t g : groups) {
const KVGroupPlan* p0 = ranks[0]->plan(g);
if (!p0 || !p0->paged()) continue;
/* A streamed group is not part of a tier entry: its pool is one layer deep, so a gather
* of layer L would copy the last staged layer n_layers times, and its host mirror is the
* tier (docs/KV-STREAMING.md §4.1). TierExec::stage skips the same groups, so this
* arithmetic and its gather offsets agree. A streamed group is never replicated, so
* leaving it out of the replicated window too is the safe rule. */
if (!kv_tier_cached(*p0)) continue;
/* Skipped as in configure(), so the slot layout and the gather offsets agree. */
if (p0->streamed()) continue;
bool replicated = false;
for (size_t i = 0; i < ranks.size(); ++i) {
const KVGroupPlan* p = ranks[i]->plan(g);