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

+45 -12
View File
@@ -1,6 +1,9 @@
/* kv.cpp -- see kv.h. */
#include "mem/kv.h"
#include "kvstream/carve.h"
#include "kvstream/plan.h"
#include <algorithm>
#include <cassert>
#include <cstring>
@@ -71,7 +74,7 @@ std::string BundleComparison::report() const {
/* ------------------------------------------------------------------ configure */
static const char* kv_kind_name(int k) {
const char* kv_kind_name(int k) {
switch (k) {
case RAD_KV_FULL: return "full";
case RAD_KV_WINDOW: return "window";
@@ -133,6 +136,7 @@ int KVManager::plan_groups(const std::vector<KVGroupInfo>& groups, const Config&
* other plan-path code has to know the kind. */
p.kind = g.decl.kind == RAD_KV_RING ? RAD_KV_WINDOW : g.decl.kind;
p.n_layers = (int64_t)g.layers.size();
p.dense_read = g.dense_read;
if (p.n_layers <= 0) {
RAD_ERR("KV group '%s': no layers are bound to it, so its page size is unknown "
@@ -309,8 +313,10 @@ int64_t KVManager::ceiling(int64_t ctx) const {
int64_t blocks = max_seqs_ * ((ctx + p.block_size - 1) / p.block_size);
if (p.kind == RAD_KV_WINDOW && !p.runtime_win && p.window_blocks > 0)
blocks = std::min(blocks, window_pool_cap(p));
need += blocks * p.bytes_per_block;
need += kv_ceiling_bytes(p, blocks, stream_.resident_blocks(p));
}
/* The streamed groups' maps come out of this pool too (kvstream/carve.h). */
need += kvstream_maps_charged(plans_, stream_, ctx, max_seqs_);
return need;
}
@@ -415,9 +421,15 @@ int64_t KVManager::paged_split(int64_t budget_bytes, std::vector<int64_t>* block
/* Zero groups take no part in the split; they get the shared table's block count, which is
* what the costed groups settle on here or, under the cap, on the ranks holding the cache. */
std::vector<int32_t> open, zeros;
for (const auto& p : plans_)
if (p.paged()) (p.zero ? zeros : open).push_back(p.index);
/* Every paged group zero: this rank limits nothing, so take the cap, or report unbounded. */
bool dense = false;
for (const auto& p : plans_) {
if (!p.paged()) continue;
if (p.zero) zeros.push_back(p.index);
else if (kvstream_dense(p, plans_, stream_)) dense = true; /* its carve is a floor */
else if (!stream_.windowed(p.index)) open.push_back(p.index);
}
kvstream_split_windows(plans_, stream_, max_ctx_, max_seqs_, &remaining, &out);
/* Every paged group is zero: this rank limits nothing, so take the cap, or report unbounded. */
if (open.empty() && !zeros.empty()) {
const int64_t tokens = tokens_cap_ > 0 ? tokens_cap_ : kUnboundedTokens;
if (blocks) {
@@ -453,6 +465,9 @@ int64_t KVManager::paged_split(int64_t budget_bytes, std::vector<int64_t>* block
}
for (int32_t i : open) out[i] = remaining > 0 ? tokens / plans_[i].block_size : 0;
for (int32_t i : zeros) out[i] = remaining > 0 ? zero_blocks(plans_[i], tokens) : 0;
/* A dense-read group's floor is already charged; with no other open group the pool still pages
* one full-length sequence, which is what the report and the admission cap see. */
if (dense && open.empty() && remaining > 0) tokens = max_ctx_;
if (blocks) *blocks = std::move(out);
return tokens;
}
@@ -486,8 +501,11 @@ int64_t KVManager::zero_blocks(const KVGroupPlan& p, int64_t tokens) const {
}
int KVManager::carve_into(Pool& kv_pool) {
/* The pool size is the resolver's; this only splits it between the groups. */
const int64_t budget_bytes = kv_pool.avail();
/* The pool size is the resolver's; this only splits it between the groups. The streamed
* groups' maps were reserved from it before the carve and paged_split() charges them, so they
* are added back here rather than charged twice. */
const int64_t budget_bytes = kv_pool.avail() +
kvstream_maps_charged(plans_, stream_, max_ctx_, max_seqs_);
const int64_t fixed = fixed_;
pool_base_ = kv_pool.base();
pool_ = &kv_pool;
@@ -505,11 +523,19 @@ int KVManager::carve_into(Pool& kv_pool) {
return RAD_E_NOMEM;
}
/* ---- the resident windows, before anything is split (kvstream/carve.h) ---- */
RAD_TRY(kvstream_window_fit(plans_, stream_, fixed, budget_bytes, max_ctx_, max_seqs_));
/* ---- the paged split; under a cap, the least rank's ---- */
std::vector<int64_t> blocks;
(void)paged_split(budget_bytes, &blocks);
for (auto& p : plans_) if (p.paged()) p.n_blocks = blocks[p.index];
/* How much of that the pool backs, and the refusal of an unbacked streamed plan. */
RAD_TRY(kvstream_apply(plans_, stream_, max_ctx_, max_seqs_));
/* A streamed group's `n_blocks` is its context, so this asks whether it can address anything,
* not whether its window is large enough. */
for (auto& p : plans_) {
if (!p.paged()) continue;
if (p.n_blocks <= 0 && p.zero) {
@@ -531,7 +557,7 @@ int KVManager::carve_into(Pool& kv_pool) {
/* ---- carve. Every reservation comes from the KV pool only; the mover works inside the
* weight slab and cannot reach it (spec §6). ---- */
for (auto& p : plans_) {
int64_t bytes = p.paged() ? p.n_blocks * p.bytes_per_block
int64_t bytes = p.paged() ? kv_pool_bytes(p)
: p.n_states * p.bytes_per_state;
if (p.zero) {
p.base = nullptr;
@@ -625,14 +651,16 @@ int KVManager::carve_into(Pool& kv_pool) {
return p.runtime_win ? "ring" : kv_kind_name(p.kind);
};
for (const auto& p : plans_) {
if (p.paged())
if (p.paged()) {
report_ += fmt(" %-14s %-6s %3lld layers block %4lld tok page %8s "
"%7lld blocks = %9s (%lld tokens)\n",
p.name.c_str(), kind_of(p), (long long)p.n_layers,
(long long)p.block_size, humanb(p.bytes_per_block).c_str(),
(long long)p.n_blocks, humanb(p.pool_bytes).c_str(),
(long long)(p.n_blocks * p.block_size));
else
if (p.streamed())
report_ += kvstream_report_line(p);
} else
report_ += fmt(" %-14s %-6s %3lld layers state %8s %7lld slots = %9s\n",
p.name.c_str(), kind_of(p), (long long)p.n_layers,
humanb(p.bytes_per_state).c_str(),
@@ -758,6 +786,9 @@ int64_t KVManager::total_blocks(int32_t g) const {
int64_t KVManager::live_blocks(int32_t g) const {
return (g >= 0 && g < (int32_t)live_.size()) ? live_[(size_t)g] : 0;
}
int64_t KVManager::held_top_blocks(int32_t g) const {
return (g >= 0 && g < (int32_t)plans_.size()) ? held_top((size_t)g) : 0;
}
/* The larger of one prefill chunk and the recent shortfall peak (see buffer_bytes in kv.h). */
int64_t KVManager::buf_blocks(size_t i) const {
@@ -786,8 +817,10 @@ int64_t KVManager::available_blocks(int32_t g) const {
bool KVManager::lendable(int32_t g) const {
const KVGroupPlan* p = plan(g);
/* A streamed group never lends: its pool is the ring, and a lent block would leave fewer
* slots than one launch's selection needs. */
return p && p->kind == RAD_KV_FULL && p->n_blocks > 0 && p->block_size > 0 &&
p->bytes_per_block > 0;
p->bytes_per_block > 0 && !p->streamed();
}
int64_t KVManager::lent_blocks(size_t i, int64_t tokens) const {
@@ -905,7 +938,7 @@ int64_t KVManager::pool_bytes(int32_t g) const {
int64_t KVManager::pool_bytes_carved(int32_t g) const {
const KVGroupPlan* p = plan(g);
if (!p) return 0;
if (p->paged()) return p->n_blocks * p->bytes_per_block;
if (p->paged()) return kv_pool_bytes(*p);
if (p->stateful()) return p->n_states * p->bytes_per_state;
return 0;
}