Archived
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:
1 parent
b4c04b6042
commit
ddcb9c69bb
696 files changed
+120770
-56596
No files matched your search
@@ -261,66 +261,6 @@ AVX_KERNEL(gate_add) {
|
||||
/* gate_add (with `gated` 1), ln_mod and quant_act_fp8 in one pass over each row: the residual
|
||||
* rounded to x's dtype and stored, the norm to bf16, the codes as quant_act_fp8 writes them over
|
||||
* that bf16 row (avx_had.h: fp8_emit), and the bf16 row into `z` when bound. */
|
||||
AVX_KERNEL(ln_mod_quant_fp8) {
|
||||
if (a->n_t < 8) return RAD_E_INVAL;
|
||||
const RadTensor *Yv = rad_arg_in(a, 0), *G = rad_arg_in(a, 1), *S = &a->t[2], *cu = &a->t[3];
|
||||
const RadTensor *X = &a->t[4], *Q = &a->t[5], *SC = &a->t[6], *Z = rad_arg_in(a, 7);
|
||||
const int64_t n = p_int(a, "n", 0), grp = p_int(a, "group", 0);
|
||||
const bool gated = p_int(a, "gated", 0) != 0;
|
||||
const float eps = p_f32(a, "eps", 1e-6f);
|
||||
if (n <= 0 || grp <= 0 || n % grp || (gated && (!Yv || !G))) return RAD_E_SHAPE;
|
||||
const int64_t rows = rows_of(Q, n), n_seq = numel(cu) - 1, ngrp = n / grp;
|
||||
if (rows <= 0 || n_seq <= 0 || rows_of(X, n) < rows || numel(SC) < rows * ngrp)
|
||||
return RAD_E_SHAPE;
|
||||
if (!S->data) return RAD_E_INVAL;
|
||||
/* Both tables from one scratch_raw call: a second may reallocate the first. */
|
||||
float* tabs = (float*)scratch_raw((size_t)(2 * n_seq * n + 32) * sizeof(float));
|
||||
{
|
||||
const int64_t s_rs = row_stride(S, n), s_cs = laststride(S);
|
||||
const int64_t g_rs = gated ? row_stride(G, n) : 0, g_cs = gated ? laststride(G) : 0;
|
||||
for (int64_t e = 0; e < n_seq; ++e)
|
||||
for (int64_t i = 0; i < n; ++i) {
|
||||
tabs[e * n + i] = narrow1(RAD_BF16, 1.0f + ldt(S, e * s_rs + i * s_cs));
|
||||
if (gated)
|
||||
tabs[(n_seq + e) * n + i] =
|
||||
narrow1(X->dtype, sc_tanh(ldt(G, e * g_rs + i * g_cs)));
|
||||
}
|
||||
}
|
||||
const float* gain = tabs;
|
||||
const float* gate = tabs + n_seq * n;
|
||||
|
||||
AVX_PARALLEL_FOR_IF(rows * n >= AVX_PAR_MIN)
|
||||
for (int64_t r = 0; r < rows; ++r) {
|
||||
float* buf = scratch_f32((size_t)(5 * n + 80));
|
||||
float *xs = buf, *v = buf + n + 16, *o = v + n + 16, *codes = o + n + 16;
|
||||
float* tmp = codes + n + 16;
|
||||
const int64_t e = seq_of(cu, n_seq, r);
|
||||
const float* xv = in_row(X, rowoff(X, r, n), n, xs);
|
||||
if (gated) {
|
||||
const float* yv = in_row(Yv, rowoff(Yv, r, n), n, codes);
|
||||
const float* t = gate + e * n;
|
||||
int64_t i = 0;
|
||||
for (; i + VF_N <= n; i += VF_N)
|
||||
vf_storeu(v + i, vf_mul(vf_loadu(t + i), vf_loadu(yv + i)));
|
||||
for (; i < n; ++i) v[i] = t[i] * yv[i];
|
||||
narrow_row(X->dtype, v, n, tmp);
|
||||
add_rows(v, xv, n);
|
||||
narrow_row(X->dtype, v, n, tmp);
|
||||
out_row(X, rowoff(X, r, n), n, v);
|
||||
} else {
|
||||
std::memcpy(v, xv, (size_t)n * sizeof(float));
|
||||
}
|
||||
const float mean = row_sum(v, n) / (float)n;
|
||||
const float rs = 1.0f / std::sqrt(dev_sumsq(v, mean, n) / (float)n + eps);
|
||||
center_scale(v, mean, rs, o, n);
|
||||
narrow_row(RAD_BF16, o, n, tmp);
|
||||
mul_rows(o, gain + e * n, n);
|
||||
narrow_row(RAD_BF16, o, n, tmp);
|
||||
fp8_emit(o, codes, n, grp, Q, SC, Z, r);
|
||||
}
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ rms_mod / rms_mod_quant_fp8 */
|
||||
/* Both forms: with `gated` the branch added through the gate row (no tanh) and the residual stored
|
||||
* in x's dtype; then n1 = rd(x rsqrt(mean(x^2) + eps)), n2 = rd(n1 w), m = rd(n2 rd(1 + scale)),
|
||||
@@ -426,8 +366,6 @@ static int rms_mod_run(const RadArgs* a, bool quant) {
|
||||
}
|
||||
|
||||
AVX_KERNEL(rms_mod) { return rms_mod_run(a, false); }
|
||||
AVX_KERNEL(rms_mod_quant_fp8) { return rms_mod_run(a, true); }
|
||||
|
||||
/* ------------------------------------------------------------------ timestep_embed */
|
||||
/* y[m] = [cos(t' f_0) .. cos(t' f_{h-1}) | sin(t' f_0) .. sin(t' f_{h-1})] with libref's libm
|
||||
* calls: a pass embeds one row per entry, so this is a few thousand transcendentals. With
|
||||
|
||||
Reference in new issue
Block a user