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
+33
-89
@@ -389,29 +389,6 @@ extern "C" int r4d_shape_gemm_nt_bias(const RadParam* p, int n_p, int operand, R
|
||||
R4D_PICK(l);
|
||||
}
|
||||
|
||||
extern "C" int r4d_shape_moe_mxfp4(const RadParam* p, int n_p, int operand, RadOpdDesc* out) {
|
||||
const int64_t M = pi(p, n_p, "M"), N = pi(p, n_p, "N"), K = pi(p, n_p, "K");
|
||||
const int64_t N1 = rad_param_geti(p, n_p, "N_odd", N), K1 = rad_param_geti(p, n_p, "K_odd", K);
|
||||
const int64_t ne = pi(p, n_p, "n_expert"), top = pi(p, n_p, "top_k");
|
||||
const char* order = rad_param_gets(p, n_p, "a_order", "");
|
||||
const int64_t ar = !std::strcmp(order, "sorted") ? M * top : M;
|
||||
const int64_t nk = std::max(K, K1), nn = std::max(N, N1);
|
||||
RadOpdDesc s0 = opd((uint32_t)RAD_U8, (ne + 1) / 2, N, K / 32);
|
||||
RadOpdDesc s1 = opd((uint32_t)RAD_U8, ne / 2, N1, K1 / 32);
|
||||
s0.fill = s1.fill = RAD_FILL_INDEX;
|
||||
s0.idx_const = s1.idx_const = 127;
|
||||
const RadOpdDesc l[] = { opd((uint32_t)RAD_F8E4M3, ar, nk),
|
||||
opd((uint32_t)RAD_F32, ar, nk / 128),
|
||||
opd((uint32_t)RAD_FP4E2M1, (ne + 1) / 2, N, K),
|
||||
s0,
|
||||
opd_idx(M * top, 0, M * top),
|
||||
opd_idx(ne + 1, 0, M * top + 1),
|
||||
opd((uint32_t)RAD_FP4E2M1, ne / 2, N1, K1),
|
||||
s1,
|
||||
opd((uint32_t)RAD_BF16, M * top, nn) };
|
||||
R4D_PICK(l);
|
||||
}
|
||||
|
||||
extern "C" int r4d_shape_kda_update(const RadParam* p, int n_p, int operand, RadOpdDesc* out) {
|
||||
const char* form = rad_param_gets(p, n_p, "state_form", "");
|
||||
if (!std::strcmp(form, "anchor")) return RAD_E_UNSUPPORTED;
|
||||
@@ -1382,7 +1359,7 @@ extern "C" int r4d_shape_ar_rmsnorm_had_quant_i8g(const RadParam* p, int n_p, in
|
||||
const int64_t M = pi(p, n_p, "M");
|
||||
const int64_t n = pi(p, n_p, "n");
|
||||
const int64_t g = pi(p, n_p, "group", R4D_FP8_BLOCK);
|
||||
if (g != R4D_FP8_BLOCK) return RAD_E_UNSUPPORTED;
|
||||
if (g != R4D_FP8_BLOCK && g != R4D_I8_GROUP_WIDE) return RAD_E_UNSUPPORTED;
|
||||
const RadOpdDesc l[] = {
|
||||
opd((uint32_t)RAD_BF16, M, n), /* inout: the message and the input */
|
||||
opd((uint32_t)RAD_BF16, M, n),
|
||||
@@ -1447,55 +1424,6 @@ extern "C" int r4d_shape_gemm_nt_q(const RadParam* p, int n_p, int operand,
|
||||
R4D_PICK(l);
|
||||
}
|
||||
|
||||
/* gemm_nt_q_bias at fp8a8: gemm_nt_q's fp8 operands, a bf16 bias per output column, then y. The
|
||||
* libref description matches it (ref_gemm_nt_q_bias_shape). */
|
||||
extern "C" int r4d_shape_gemm_nt_q_bias(const RadParam* p, int n_p, int operand,
|
||||
RadOpdDesc* out) {
|
||||
const int64_t M = pi(p, n_p, "M");
|
||||
const int64_t N = pi(p, n_p, "N");
|
||||
const int64_t K = pi(p, n_p, "K");
|
||||
const int64_t g = pi(p, n_p, "group", R4D_FP8_BLOCK);
|
||||
const char* q = r4d_pgets(p, n_p, "dtype");
|
||||
if (!q || std::strcmp(q, "fp8a8") || g != R4D_FP8_BLOCK || K <= 0 || N <= 0)
|
||||
return RAD_E_UNSUPPORTED;
|
||||
const int64_t kb = (K + g - 1) / g, nb = (N + g - 1) / g;
|
||||
const RadOpdDesc l[] = {
|
||||
opd((uint32_t)RAD_F8E4M3, M, K),
|
||||
opd((uint32_t)RAD_F32, M, kb),
|
||||
opd((uint32_t)RAD_F8E4M3, N, K),
|
||||
opd((uint32_t)RAD_BF16, nb, kb),
|
||||
opd((uint32_t)RAD_BF16, N),
|
||||
opd((uint32_t)RAD_BF16, M, N),
|
||||
};
|
||||
R4D_PICK(l);
|
||||
}
|
||||
|
||||
/* The same GEMM with the SwiGLU and the quantiser in its epilogue. `N` is the weight's rows, gate
|
||||
* then up, so the quantiser's outputs are N/2 wide (hence a schema of its own). */
|
||||
extern "C" int r4d_shape_gemm_nt_q_gated(const RadParam* p, int n_p, int operand,
|
||||
RadOpdDesc* out) {
|
||||
|
||||
const int64_t M = pi(p, n_p, "M");
|
||||
const int64_t N = pi(p, n_p, "N");
|
||||
const int64_t K = pi(p, n_p, "K");
|
||||
const int64_t g = pi(p, n_p, "group", R4D_FP8_BLOCK);
|
||||
const char* q = r4d_pgets(p, n_p, "dtype");
|
||||
if (!q || std::strcmp(q, "fp8a8") || g != R4D_FP8_BLOCK) return RAD_E_UNSUPPORTED;
|
||||
if (N <= 0 || N % 2 || K <= 0) return RAD_E_UNSUPPORTED;
|
||||
const int64_t nout = N / 2;
|
||||
const int64_t kb = (K + g - 1) / g;
|
||||
const RadOpdDesc l[] = {
|
||||
opd((uint32_t)RAD_F8E4M3, M, K),
|
||||
opd((uint32_t)RAD_F32, M, kb),
|
||||
opd((uint32_t)RAD_F8E4M3, N, K),
|
||||
opd((uint32_t)RAD_BF16, (N + g - 1) / g, kb),
|
||||
opd((uint32_t)RAD_F8E4M3, M, nout),
|
||||
opd((uint32_t)RAD_F32, M, (nout + g - 1) / g),
|
||||
opd((uint32_t)RAD_BF16, M, nout),
|
||||
};
|
||||
R4D_PICK(l);
|
||||
}
|
||||
|
||||
/* dequant_w4 -- the packed 4-bit weight back to row-major bf16 (shim in r4d_dequant_w4_bf16.hip).
|
||||
*
|
||||
* The one packed weight a public dtype sizes exactly: RAD_I4 is four bits per element, so [N, K]
|
||||
@@ -1644,7 +1572,9 @@ extern "C" int r4d_shape_moe_scatter_inv(const RadParam* p, int n_p, int operand
|
||||
R4D_PICK(l);
|
||||
}
|
||||
|
||||
extern "C" int r4d_shape_moe_gemm_q(const RadParam* p, int n_p, int operand, RadOpdDesc* out) {
|
||||
/* `i8`: moe_gemm_i8a8's operands, int8 codes on both sides and the weight's scale per (row, group
|
||||
* of K). */
|
||||
static int moe_gemm_q_shape(const RadParam* p, int n_p, int operand, RadOpdDesc* out, bool i8) {
|
||||
const int64_t M = pi(p, n_p, "M");
|
||||
const int64_t N0 = pi(p, n_p, "N"), K0 = pi(p, n_p, "K");
|
||||
const int64_t N1 = pi(p, n_p, "N_odd", N0), K1 = pi(p, n_p, "K_odd", K0);
|
||||
@@ -1661,27 +1591,34 @@ extern "C" int r4d_shape_moe_gemm_q(const RadParam* p, int n_p, int operand, Rad
|
||||
* in scatter order ("sorted"). */
|
||||
const char* ord = rad_param_gets(p, n_p, "a_order", nullptr);
|
||||
const int64_t AR = (ord && !std::strcmp(ord, "sorted")) ? M * k : M;
|
||||
const uint32_t C = i8 ? (uint32_t)RAD_I8 : (uint32_t)RAD_F8E4M3;
|
||||
auto srows = [&](int64_t n) { return i8 ? n : (n + g - 1) / g; };
|
||||
const int64_t ag = pi(p, n_p, "a_group", g) > 0 ? pi(p, n_p, "a_group", g) : g;
|
||||
const RadOpdDesc l[] = {
|
||||
opd((uint32_t)RAD_F8E4M3, AR, K), /* a -- see `a_order` */
|
||||
opd((uint32_t)RAD_F32, AR, (K + g - 1) / g), /* a_scale */
|
||||
opd(C, AR, K), /* a -- see `a_order` */
|
||||
opd((uint32_t)RAD_F32, AR, (K + ag - 1) / ag), /* a_scale */
|
||||
/* The weight operands are tables when issued, described here as one stacked plane; a
|
||||
* fixture cannot hold a pointer array, and the kernel reads both forms (r4d_moe.hip,
|
||||
* wtab_at). */
|
||||
opd((uint32_t)RAD_F8E4M3, ne0, N0, K0), /* w -- the even experts */
|
||||
opd((uint32_t)RAD_BF16, ne0, (N0 + g - 1) / g, (K0 + g - 1) / g), /* w_scale */
|
||||
opd(C, ne0, N0, K0), /* w -- the even experts */
|
||||
opd((uint32_t)RAD_BF16, ne0, srows(N0), (K0 + g - 1) / g), /* w_scale */
|
||||
opd_idx(M * k, 0, M * k, -1), /* sorted_tok */
|
||||
opd_idx(ne + 1, 0, M * k + 1, -1), /* expert_offset -- see the note above */
|
||||
opd((uint32_t)RAD_F8E4M3, ne1, N1, K1), /* w_odd -- the odd experts */
|
||||
opd((uint32_t)RAD_BF16, ne1, (N1 + g - 1) / g, (K1 + g - 1) / g), /* w_odd_scale */
|
||||
opd(C, ne1, N1, K1), /* w_odd -- the odd experts */
|
||||
opd((uint32_t)RAD_BF16, ne1, srows(N1), (K1 + g - 1) / g), /* w_odd_scale */
|
||||
opd(D, M * k, N), /* y, in sorted order */
|
||||
};
|
||||
R4D_PICK(l);
|
||||
}
|
||||
|
||||
extern "C" int r4d_shape_moe_gemm_i8(const RadParam* p, int n_p, int operand, RadOpdDesc* out) {
|
||||
return moe_gemm_q_shape(p, n_p, operand, out, true);
|
||||
}
|
||||
|
||||
/* The four-class form: class q holds the experts e with e % 4 == q at [N_q, K_q], defaulting to
|
||||
* class 0's, ceil((n - q) / 4) of them; `y` follows the last class. */
|
||||
extern "C" int r4d_shape_moe_gemm_q_mod4(const RadParam* p, int n_p, int operand,
|
||||
RadOpdDesc* out) {
|
||||
static int moe_gemm_q_mod4_shape(const RadParam* p, int n_p, int operand, RadOpdDesc* out,
|
||||
bool i8) {
|
||||
const int64_t M = pi(p, n_p, "M");
|
||||
int64_t Nc[4], Kc[4];
|
||||
Nc[0] = pi(p, n_p, "N");
|
||||
@@ -1705,13 +1642,16 @@ extern "C" int r4d_shape_moe_gemm_q_mod4(const RadParam* p, int n_p, int operand
|
||||
const uint32_t D = dt_act(p, n_p, "dtype");
|
||||
const char* ord = rad_param_gets(p, n_p, "a_order", nullptr);
|
||||
const int64_t AR = (ord && !std::strcmp(ord, "sorted")) ? M * k : M;
|
||||
auto wq = [&](int q) { return opd((uint32_t)RAD_F8E4M3, nq[q], Nc[q], Kc[q]); };
|
||||
const uint32_t C = i8 ? (uint32_t)RAD_I8 : (uint32_t)RAD_F8E4M3;
|
||||
auto wq = [&](int q) { return opd(C, nq[q], Nc[q], Kc[q]); };
|
||||
const int64_t ag = pi(p, n_p, "a_group", g) > 0 ? pi(p, n_p, "a_group", g) : g;
|
||||
auto sq = [&](int q) {
|
||||
return opd((uint32_t)RAD_BF16, nq[q], (Nc[q] + g - 1) / g, (Kc[q] + g - 1) / g);
|
||||
return opd((uint32_t)RAD_BF16, nq[q], i8 ? Nc[q] : (Nc[q] + g - 1) / g,
|
||||
(Kc[q] + g - 1) / g);
|
||||
};
|
||||
const RadOpdDesc l[] = {
|
||||
opd((uint32_t)RAD_F8E4M3, AR, K), /* a -- see `a_order` */
|
||||
opd((uint32_t)RAD_F32, AR, (K + g - 1) / g), /* a_scale */
|
||||
opd(C, AR, K), /* a -- see `a_order` */
|
||||
opd((uint32_t)RAD_F32, AR, (K + ag - 1) / ag), /* a_scale */
|
||||
wq(0), sq(0), /* w, w_scale -- class 0 */
|
||||
opd_idx(M * k, 0, M * k, -1), /* sorted_tok */
|
||||
opd_idx(ne + 1, 0, M * k + 1, -1), /* expert_offset */
|
||||
@@ -1720,6 +1660,10 @@ extern "C" int r4d_shape_moe_gemm_q_mod4(const RadParam* p, int n_p, int operand
|
||||
};
|
||||
R4D_PICK(l);
|
||||
}
|
||||
extern "C" int r4d_shape_moe_gemm_i8_mod4(const RadParam* p, int n_p, int operand,
|
||||
RadOpdDesc* out) {
|
||||
return moe_gemm_q_mod4_shape(p, n_p, operand, out, true);
|
||||
}
|
||||
|
||||
extern "C" int r4d_shape_moe_gather(const RadParam* p, int n_p, int operand, RadOpdDesc* out) {
|
||||
const int64_t M = pi(p, n_p, "M"), n = pi(p, n_p, "n");
|
||||
@@ -2183,7 +2127,7 @@ extern "C" int r4d_shape_rmsnorm_had_quant_i8g(const RadParam* p, int n_p, int o
|
||||
const int64_t n = pi(p, n_p, "n");
|
||||
const int64_t g = pi(p, n_p, "group", R4D_FP8_BLOCK);
|
||||
const uint32_t D = dt_act(p, n_p, "dtype");
|
||||
if (g != R4D_FP8_BLOCK) return RAD_E_UNSUPPORTED;
|
||||
if (g != R4D_FP8_BLOCK && g != R4D_I8_GROUP_WIDE) return RAD_E_UNSUPPORTED;
|
||||
const RadOpdDesc l[] = {
|
||||
opd(D, M, n),
|
||||
opd(D, M, n),
|
||||
@@ -2202,7 +2146,7 @@ extern "C" int r4d_shape_gated_had_quant_i8g(const RadParam* p, int n_p, int ope
|
||||
const int64_t n = pi(p, n_p, "n");
|
||||
const int64_t g = pi(p, n_p, "group", R4D_FP8_BLOCK);
|
||||
const uint32_t D = dt_act(p, n_p, "dtype");
|
||||
if (g != R4D_FP8_BLOCK) return RAD_E_UNSUPPORTED;
|
||||
if (g != R4D_FP8_BLOCK && g != R4D_I8_GROUP_WIDE) return RAD_E_UNSUPPORTED;
|
||||
const RadOpdDesc l[] = {
|
||||
opd(D, M, 2 * n), /* gate then up in one buffer */
|
||||
opd((uint32_t)RAD_I8, M, n),
|
||||
@@ -2219,7 +2163,7 @@ extern "C" int r4d_shape_gate_quant_fp8(const RadParam* p, int n_p, int operand,
|
||||
const int64_t n = pi(p, n_p, "n");
|
||||
const int64_t g = pi(p, n_p, "group", R4D_FP8_BLOCK);
|
||||
const uint32_t D = dt_act(p, n_p, "dtype");
|
||||
if (g != R4D_FP8_BLOCK) return RAD_E_UNSUPPORTED;
|
||||
if (g != R4D_FP8_BLOCK && g != R4D_I8_GROUP_WIDE) return RAD_E_UNSUPPORTED;
|
||||
/* A row is a (token, head) pair: `M` is tokens * n_head and `n` is head_dim, so the gate is a
|
||||
* fixed stride inside the [q|gate] projection and the scale plane lands where the out
|
||||
* projection reads it. In the engine the gate is a column slice; described flat. */
|
||||
|
||||
Reference in new issue
Block a user