radiance 2.0.0

Radiance becomes a multi-model engine: one process serves several models behind one port, loads
each when a request names it, parks it in host memory or restores it from its container, and
shares the cards between them (docs/MULTIMODEL.md). The configuration is one YAML file; the
command line flags are gone (`radiance --config FILE`, hot reload on SIGHUP).

Formats. IQ8R (rotated int8) and IQR-V4 replace FP8 and MXFP4 as whole-model formats, with an
int8 KV cache (`kv-cache-dtype: i8`) in place of the fp8 one. Containers whose weights are block
FP8, MXFP4, M2XFP4, NVFP4 or ParoQuant are refused at startup by the name of the first such
weight. Not served until they have int8 containers: GLM-5.3-Flash, Ornith-1.5, Sage-A1.5,
Nemotron-3.5-Bolt-74B, Ling-3.0-flash, drama-3 and Anima's FP8 container; Nemotron-3.5-Bolt-E4B,
the Gemma 4 31B DFlash containers and MiniCPM5-2B bf16 serve without their drafter. 1.17.0
serves all of them.

Speed. Chained launches for Qwen3.8-27B, Gemma 4, Gemma 3 and the small bf16 models, a new
Qwen3.8-Flash-Next container (IQR-V4 experts, int8 trunk) with its decode step and prefill
reworked, and a reworked adaptive draft window.

Deployment. deploy/compose has two fleet files, tp1.yaml and tp2.yaml, each with its
configuration beside it, in place of the per-model files. `host-pool-mib` is a model's host pool
in all, split among its ranks. The dashboard is rebuilt: an hour of history kept by the server,
each accelerator's memory by model, model states over time.

Merged since 1.17.0: Nemotron-3.5-Bolt-74B-A9B by keptn42 (#339); GLM-5.3-Flash on four cards by
AnimusNull (#397); chained launches for Flash-Next's decode step (#396) and preempted requests
keeping their prefix and place (#405) by mici81; --prefill-interleave auto by Code000 (#410);
eight more libr3d kernels and the w4a4 reference by RikshaDriver (#403, #407, #408); libr3d
large-BAR and E4M3 decode fixes by neuromanMD (#438, #439); int4/int5 decode tiles by Kezi
(#426); attention for Nanbeige 4.3 33B by everplays (#417); expert_stats_report.py by baKon
(#431). Fixed: #398, #402, #419, #437 (dschmitz's patch); added the metrics of #392, and
multi-model serving as asked for in #367 and #109.

Plugin ABI 39: out-of-tree plugins need to be rebuilt.

Thanks to @keptn42, @AnimusNull, @mici81, @Code000, @RikshaDriver, @neuromanMD, @Kezi, @everplays, @baKon and @dschmitz.
This commit is contained in:
Deadcode committed 2026-11-14 22:32:28 +01:00
1 parent b4c04b6042
commit ddcb9c69bb
696 files changed
+120770 -56596

No files matched your search

+44 -4
View File
@@ -24,6 +24,7 @@ int Ctx::init(const CtxDesc& d) {
if (!d.program) return RAD_E_INVAL;
program_ = d.program;
rank_ = d.rank;
slot_ = d.slot >= 0 ? d.slot : d.rank;
world_size_= d.world_size < 1 ? 1 : d.world_size;
device_ = d.device;
record_passes_ = d.record_passes;
@@ -80,7 +81,8 @@ void Ctx::shutdown() {
route_.clear();
if (route_pool_) { rad_dev_free(route_pool_, RAD_MEM_HOST_PINNED); route_pool_ = nullptr; }
if (route_dev_) { rad_dev_free(route_dev_, RAD_MEM_DEVICE); route_dev_ = nullptr; }
if (route_dev_ && !route_dev_arena_) rad_dev_free(route_dev_, RAD_MEM_DEVICE);
route_dev_ = nullptr;
/* After the syncs: the device half is a grouped GEMM operand, the host half a copy source. */
free_weight_tables();
@@ -197,11 +199,19 @@ int Ctx::bind_arena() {
return RAD_OK;
}
void Ctx::refresh_buf_numel() {
buf_numel_.assign(buf_tmpl_.size(), 0);
for (size_t i = 1; i < buf_tmpl_.size(); ++i)
buf_numel_[i] = rad_tensor_numel(&buf_tmpl_[i]);
}
int Ctx::bind_buffers() {
Program& P = *program_;
buf_tmpl_.assign(P.buffers.size(), RadTensor{});
buf_bits_.assign(P.buffers.size(), 0);
buf_host_.assign(P.buffers.size(), 0);
buf_live0_.assign(P.buffers.size(), -1);
buf_live1_.assign(P.buffers.size(), -1);
for (size_t i = 1; i < P.buffers.size(); ++i) {
BufferInfo& bi = P.buffers[i];
@@ -231,9 +241,12 @@ int Ctx::bind_buffers() {
bi.ptr = t.data;
buf_bits_[i] = rad_dtype_bits(bi.decl.dtype);
buf_host_[i] = bi.decl.domain == RAD_DOMAIN_HOST ? 1 : 0;
buf_live0_[i] = bi.first_def;
buf_live1_[i] = bi.last_use;
}
level_tmpl_.assign(1, buf_tmpl_);
level_ = 0;
refresh_buf_numel();
return RAD_OK;
}
@@ -275,6 +288,7 @@ int Ctx::set_level(int level) {
if (level == level_) return RAD_OK;
buf_tmpl_ = level_tmpl_[(size_t)level];
level_ = level;
refresh_buf_numel(); /* a level's transient extents differ from level 0's */
return RAD_OK;
}
@@ -284,6 +298,7 @@ int Ctx::bind_weights() {
Program& P = *program_;
w_tmpl_.assign(P.weights.size(), RadTensor{});
w_bits_.assign(P.weights.size(), 0);
w_numel_.assign(P.weights.size(), 0);
for (auto& g : waited_gen_) g.assign(P.weights.size(), UINT32_MAX);
w_direct_.assign(P.weights.size(), 0);
@@ -304,6 +319,7 @@ int Ctx::bind_weights() {
rad_tensor_pack(&t);
t.data = wi.ptr;
w_bits_[i] = rad_dtype_bits(t.dtype);
w_numel_[i] = rad_tensor_numel(&t);
}
return RAD_OK;
}
@@ -566,19 +582,34 @@ int Ctx::bind_routing() {
*
* The card rows are not banked: reports and the end-of-pass flush are both on the compute
* stream, so the next pass's reports queue behind the flush. A report's copy then targets the
* same address every step, so recorded passes replay unchanged. */
* same address every step, so recorded passes replay unchanged.
*
* The rows are the plugin's own buffer where it declared one (rad_route_table): its routers
* write them as declared operands and no report copies. */
const int64_t elems = n_layer * kRouteBanks * n_expert;
const int64_t bytes = elems * (int64_t)sizeof(int32_t);
const int64_t dbytes = n_layer * n_expert * (int64_t)sizeof(int32_t);
void* tab = nullptr;
if (P.route_table != RAD_NULL_HANDLE) {
const BufferInfo& bi = P.buffers[P.route_table];
if (bi.bytes < dbytes) {
RAD_ERR("routing: the routing table '%s' holds %s, and %lld reporting layers of %lld "
"experts need %s (rad_route_table)", bi.name.c_str(), humanb(bi.bytes).c_str(),
(long long)n_layer, (long long)n_expert, humanb(dbytes).c_str());
return RAD_E_SHAPE;
}
tab = buf_tmpl_[P.route_table].data; /* this context's, not the program's last */
}
void* p = rad_dev_alloc(bytes, RAD_MEM_HOST_PINNED);
void* d = rad_dev_alloc(dbytes, RAD_MEM_DEVICE);
void* d = tab ? tab : rad_dev_alloc(dbytes, RAD_MEM_DEVICE);
if (!p || !d) {
RAD_ERR("routing: %s of %s staging failed: %s", humanb(p ? dbytes : bytes).c_str(),
p ? "device" : "pinned", rad_dev_last_error());
if (p) rad_dev_free(p, RAD_MEM_HOST_PINNED);
if (d) rad_dev_free(d, RAD_MEM_DEVICE);
if (d && !tab) rad_dev_free(d, RAD_MEM_DEVICE);
return RAD_E_NOMEM;
}
route_dev_arena_ = tab != nullptr;
route_pool_ = static_cast<int32_t*>(p);
route_dev_ = static_cast<int32_t*>(d);
std::memset(route_pool_, 0, (size_t)elems * sizeof(int32_t));
@@ -1216,6 +1247,7 @@ bool Ctx::tapes_agree(const PassTape& a, const PassTape& b, std::string* why) {
const TapeHost& x = a.host[i];
const TapeHost& y = b.host[i];
bool same = x.h == y.h && x.launch == y.launch && x.n == y.n && x.drain == y.drain &&
x.touch[0] == y.touch[0] && x.touch[1] == y.touch[1] &&
x.args.n_t == y.args.n_t && x.args.scratch == y.args.scratch;
for (int k = 0; same && k < x.args.n_t; ++k)
same = std::memcmp(&x.t[k], &y.t[k], sizeof(RadTensor)) == 0;
@@ -1270,6 +1302,14 @@ int Ctx::play_pass(PassTape& t) {
case kTapeHost: {
TapeHost& th = t.host[(size_t)st.a];
lane_ = st.lane;
/* The join as the recording made it. The stretches played so far submitted the
* pass's device ops, their host-arena touches' event records among them, without
* passing issue(), which is where a touch is marked pending; the mark the pass was
* entered with says nothing about them. Without this a pass entered with no touch
* pending ran its host op at once, on what the previous step left in the host arena
* (a host gather on the previous step's row ids). */
host_touch_pending_[0] = host_touch_pending_[0] || th.touch[0];
host_touch_pending_[1] = host_touch_pending_[1] || th.touch[1];
rc = host_join_wait(th.drain);
if (rc >= 0) {
th.args.t = th.t;