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

+103 -27
View File
@@ -69,18 +69,17 @@ struct context {
context(const context & parent) : context() {
// inherit variables (for example, when entering a new scope)
auto & pvar = parent.env->as_ordered_object();
for (const auto & pair : pvar) {
set_val(pair.first, pair.second);
}
env->copy_entries_from(*parent.env);
current_time = parent.current_time;
is_get_stats = parent.is_get_stats;
src = parent.src;
}
value get_val(const std::string & name) {
value default_val = mk_val<value_undefined>(name);
return env->at(name, default_val);
if (value * v = env->find_string_key(name)) {
return *v;
}
return mk_val<value_undefined>(name);
}
void set_val(const std::string & name, const value & val) {
@@ -316,30 +315,37 @@ struct identifier : public expression {
// Literals
/* A literal's value made once, at parse time: literals sit inside the loops a template runs
* per message, and allocating a fresh value (and copying the text) for every evaluation was
* thousands of allocations per render for values nothing ever mutates -- every operation on
* a string works on an as_string() copy, and numbers are only read. */
struct integer_literal : public expression {
int64_t val;
explicit integer_literal(int64_t val) : val(val) {}
value cached;
explicit integer_literal(int64_t val) : val(val), cached(mk_val<value_int>(val)) {}
std::string type() const override { return "IntegerLiteral"; }
value execute_impl(context &) override {
return mk_val<value_int>(val);
return cached;
}
};
struct float_literal : public expression {
double val;
explicit float_literal(double val) : val(val) {}
value cached;
explicit float_literal(double val) : val(val), cached(mk_val<value_float>(val)) {}
std::string type() const override { return "FloatLiteral"; }
value execute_impl(context &) override {
return mk_val<value_float>(val);
return cached;
}
};
struct string_literal : public expression {
std::string val;
explicit string_literal(const std::string & val) : val(val) {}
value cached;
explicit string_literal(const std::string & val) : val(val), cached(mk_val<value_string>(val)) {}
std::string type() const override { return "StringLiteral"; }
value execute_impl(context &) override {
return mk_val<value_string>(val);
return cached;
}
};
@@ -598,19 +604,35 @@ struct rethrown_exception : public std::exception {
static void gather_string_parts_recursive(const value & val, value_string & parts) {
// TODO: probably allow print value_none as "None" string? currently this breaks some templates
if (is_val<value_string>(val)) {
const auto & str_val = cast_val<value_string>(val)->val_str;
parts->val_str.append(str_val);
// A uniquely owned string is a statement result being consumed by this gather; move its
// parts instead of copying every byte again at each nesting level. A shared one is an
// input value the context still holds, and is copied as before.
if (val.use_count() == 1) {
auto & src = const_cast<value_string_t *>(cast_val<value_string>(val))->val_str.parts;
auto & dst = parts->val_str.parts;
dst.reserve(dst.size() + src.size());
for (auto & part : src) {
dst.push_back(std::move(part));
}
src.clear();
} else {
const auto & str_val = cast_val<value_string>(val)->val_str;
parts->val_str.append(str_val);
}
} else if (is_val<value_int>(val) || is_val<value_float>(val) || is_val<value_bool>(val)) {
std::string str_val = val->as_string().str();
parts->val_str.append(str_val);
} else if (is_val<value_array>(val)) {
auto items = cast_val<value_array>(val)->as_array();
const auto & items = cast_val<value_array>(val)->as_array();
for (const auto & item : items) {
/* RADIANCE: `val` is a block's statement results, and every block statement returns
* a string, so a list or a dict among them is the value of an expression the template
* prints. jinja2 prints its repr; flattening it ran its strings together and printed
* nothing for a dict. */
if (is_val<value_array>(item) || is_val<value_object>(item)) {
* nothing for a dict. A statement-results carrier is the one array that is not a
* value: flattening it is its whole purpose. */
if (is_val<value_stmt_results>(item)) {
gather_string_parts_recursive(item, parts);
} else if (is_val<value_array>(item) || is_val<value_object>(item)) {
parts->val_str.append(item->as_string().str());
} else {
gather_string_parts_recursive(item, parts);
@@ -620,11 +642,54 @@ static void gather_string_parts_recursive(const value & val, value_string & part
}
static std::string render_string_parts(const value_string & parts) {
std::ostringstream oss;
std::string out;
out.reserve(parts->val_str.length());
for (const auto & part : parts->val_str.parts) {
oss << part.val;
out += part.val;
}
return out;
}
// The flat text of a statement-result tree, gathered without building a parts list: the parts
// (and their is_input flags) matter to the capability probe, but a caller that only wants the
// rendered string otherwise pays to copy every byte into parts, join them, and copy them out.
static size_t gather_string_length_recursive(const value & val) {
if (is_val<value_string>(val)) {
return cast_val<value_string>(val)->val_str.length();
} else if (is_val<value_int>(val) || is_val<value_float>(val) || is_val<value_bool>(val)) {
return val->as_string().str().size();
} else if (is_val<value_array>(val)) {
size_t len = 0;
for (const auto & item : cast_val<value_array>(val)->as_array()) {
if (!is_val<value_stmt_results>(item) &&
(is_val<value_array>(item) || is_val<value_object>(item))) {
len += item->as_string().str().size();
} else {
len += gather_string_length_recursive(item);
}
}
return len;
}
return 0;
}
static void gather_string_recursive(const value & val, std::string & out) {
if (is_val<value_string>(val)) {
for (const auto & part : cast_val<value_string>(val)->val_str.parts) {
out += part.val;
}
} else if (is_val<value_int>(val) || is_val<value_float>(val) || is_val<value_bool>(val)) {
out += val->as_string().str();
} else if (is_val<value_array>(val)) {
for (const auto & item : cast_val<value_array>(val)->as_array()) {
if (!is_val<value_stmt_results>(item) &&
(is_val<value_array>(item) || is_val<value_object>(item))) {
out += item->as_string().str();
} else {
gather_string_recursive(item, out);
}
}
}
return oss.str();
}
struct runtime {
@@ -643,18 +708,29 @@ struct runtime {
static value_string gather_string_parts(const value & val) {
value_string parts = mk_val<value_string>();
gather_string_parts_recursive(val, parts);
// join consecutive parts with the same type
// Join consecutive parts with the same type, in one compaction pass: erasing each
// merged part from the middle shifts the rest of the vector every time.
auto & p = parts->val_str.parts;
for (size_t i = 1; i < p.size(); ) {
if (p[i].is_input == p[i - 1].is_input) {
p[i - 1].val += p[i].val;
p.erase(p.begin() + i);
} else {
i++;
if (!p.empty()) {
size_t w = 0;
for (size_t r = 1; r < p.size(); ++r) {
if (p[r].is_input == p[w].is_input) {
p[w].val += p[r].val;
} else {
p[++w] = std::move(p[r]);
}
}
p.resize(w + 1);
}
return parts;
}
static std::string gather_string(const value & val) {
std::string out;
out.reserve(gather_string_length_recursive(val));
gather_string_recursive(val, out);
return out;
}
};
} // namespace jinja