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

+34 -43
View File
@@ -20,8 +20,8 @@
#include "r4d.h"
#include "r4d_args.h"
#include "r4d_emit.h"
#include "r4d_chain.h"
#include "r4d_emit.h"
#include <hip/hip_runtime.h>
#include <cstdint>
@@ -33,15 +33,15 @@ constexpr int kThreads = 128;
* row constraint on the declared seqs (rad-convert declares 256, which must still resolve). */
constexpr int kMaxSeq = 256;
__device__ __forceinline__ void qsa_work_kernel_body(
const uint16_t* __restrict__ k, const int32_t* __restrict__ pos,
const int32_t* __restrict__ cu, const uint16_t* __restrict__ state,
const int32_t* __restrict__ sidx, const int32_t* __restrict__ bt,
uint16_t* __restrict__ stage, int32_t* __restrict__ page, int32_t* __restrict__ bpos,
int32_t* __restrict__ nc,
int n, int ratio, int ring, int seqs, int max_work, int k_ld, int s_slot, int s_row,
int sidx_ld, int bt_ld, int g_ld, const int32_t* __restrict__ rope, int rplane,
int bstep) {
#define QSA_WORK_PARAMS \
const uint16_t* __restrict__ k, const int32_t* __restrict__ pos, \
const int32_t* __restrict__ cu, const uint16_t* __restrict__ state, \
const int32_t* __restrict__ sidx, const int32_t* __restrict__ bt, \
uint16_t* __restrict__ stage, int32_t* __restrict__ page, int32_t* __restrict__ bpos, \
int32_t* __restrict__ nc, int n, int ratio, int ring, int seqs, int max_work, int k_ld, \
int s_slot, int s_row, int sidx_ld, int bt_ld, int g_ld, \
const int32_t* __restrict__ rope, int rplane, int bstep
__device__ __forceinline__ void qsa_work_body(QSA_WORK_PARAMS) {
const int w = (int)blockIdx.x;
/* Complete blocks per sequence (needed by the scorer and the selection), written by the first
@@ -114,31 +114,17 @@ __device__ __forceinline__ void qsa_work_kernel_body(
}
}
/* The plain and chained forms (r4d_chain.h): every block leaves through the wrapper. */
__global__ __launch_bounds__(kThreads) void qsa_work_kernel(
const uint16_t* __restrict__ k, const int32_t* __restrict__ pos,
const int32_t* __restrict__ cu, const uint16_t* __restrict__ state,
const int32_t* __restrict__ sidx, const int32_t* __restrict__ bt,
uint16_t* __restrict__ stage, int32_t* __restrict__ page, int32_t* __restrict__ bpos,
int32_t* __restrict__ nc,
int n, int ratio, int ring, int seqs, int max_work, int k_ld, int s_slot, int s_row,
int sidx_ld, int bt_ld, int g_ld, const int32_t* __restrict__ rope, int rplane,
int bstep) {
qsa_work_kernel_body(k, pos, cu, state, sidx, bt, stage, page, bpos, nc, n, ratio, ring, seqs, max_work, k_ld, s_slot, s_row, sidx_ld, bt_ld, g_ld, rope, rplane, bstep);
}
__global__ __launch_bounds__(kThreads) void r4dchain_qsa_work(
const uint16_t* __restrict__ k, const int32_t* __restrict__ pos,
const int32_t* __restrict__ cu, const uint16_t* __restrict__ state,
const int32_t* __restrict__ sidx, const int32_t* __restrict__ bt,
uint16_t* __restrict__ stage, int32_t* __restrict__ page, int32_t* __restrict__ bpos,
int32_t* __restrict__ nc,
int n, int ratio, int ring, int seqs, int max_work, int k_ld, int s_slot, int s_row,
int sidx_ld, int bt_ld, int g_ld, const int32_t* __restrict__ rope, int rplane,
int bstep) {
r4d_chain_wait();
qsa_work_kernel_body(k, pos, cu, state, sidx, bt, stage, page, bpos, nc, n, ratio, ring, seqs, max_work, k_ld, s_slot, s_row, sidx_ld, bt_ld, g_ld, rope, rplane, bstep);
r4d_chain_done();
/* The kernel around the body, whose blocks and threads return where their work ends: CH `r4dchain`
* is the chained form (r4d_chain.h). */
template <class CH>
__global__ __launch_bounds__(kThreads)
void qsa_work_kernel(QSA_WORK_PARAMS) {
if (CH::on) r4d_chain_wait();
qsa_work_body(k, pos, cu, state, sidx, bt, stage, page, bpos, nc, n, ratio, ring, seqs,
max_work, k_ld, s_slot, s_row, sidx_ld, bt_ld, g_ld, rope, rplane, bstep);
if (CH::on) r4d_chain_done();
}
#undef QSA_WORK_PARAMS
} // namespace
@@ -158,7 +144,7 @@ static int r4d_qsa_work_bf16_emit(long k, long pos, long cu, long state, long si
long stage, long page, long bpos, long nc, int n, int ratio,
int ring, int seqs, int max_work, int k_ld, int s_slot,
int s_row, int sidx_ld, int bt_ld, int g_ld, long rope,
int rplane, int bstep, RadStream stream) {
int rplane, int bstep, RadStream stream, bool chain) {
if (!k || !pos || !cu || !state || !sidx || !bt || !stage || !page || !bpos || !nc)
return R4D_NO(RAD_E_INVAL);
if (n <= 0 || ratio <= 0 || ring < ratio || seqs <= 0 || max_work <= 0 || seqs > kMaxSeq)
@@ -167,12 +153,17 @@ static int r4d_qsa_work_bf16_emit(long k, long pos, long cu, long state, long si
if (!s_row) s_row = n;
if (!g_ld) g_ld = n;
if (!sidx_ld) sidx_ld = 1;
return R4D_EMIT(stream, g_r4d_chain_arg ? &r4dchain_qsa_work : &qsa_work_kernel, dim3((unsigned)max_work), dim3(kThreads), 0,
(const uint16_t*)k, (const int32_t*)pos, (const int32_t*)cu,
(const uint16_t*)state, (const int32_t*)sidx, (const int32_t*)bt,
(uint16_t*)stage, (int32_t*)page, (int32_t*)bpos, (int32_t*)nc, n, ratio,
ring, seqs, max_work, k_ld, s_slot, s_row, sidx_ld, bt_ld, g_ld,
(const int32_t*)rope, rplane, bstep);
/* Each form named at its own launch: a test reads the kernel a launch site names. */
#define R4D_QWORK(CH_) \
R4D_EMIT(stream, qsa_work_kernel<CH_>, dim3((unsigned)max_work), dim3(kThreads), 0, \
(const uint16_t*)k, (const int32_t*)pos, (const int32_t*)cu, \
(const uint16_t*)state, (const int32_t*)sidx, (const int32_t*)bt, \
(uint16_t*)stage, (int32_t*)page, (int32_t*)bpos, (int32_t*)nc, n, ratio, ring, \
seqs, max_work, k_ld, s_slot, s_row, sidx_ld, bt_ld, g_ld, (const int32_t*)rope, \
rplane, bstep)
const int rc = chain ? R4D_QWORK(r4dchain) : R4D_QWORK(R4dUnchained);
#undef R4D_QWORK
return rc;
}
// ============================================================== the plugin ABI entry point
@@ -238,12 +229,12 @@ extern "C" int r4d_rad_qsa_work(const RadArgs* a, RadStream stream) {
const long long bp2 = r4d_row_pitch(bt), sp = r4d_row_pitch(st);
if (kp < 0 || bp2 < 0 || sp < 0) return R4D_NO(RAD_E_STRIDE);
if (k->dtype != RAD_BF16 || tl->dtype != RAD_BF16) return R4D_NO(RAD_E_DTYPE);
const R4dChainArg chain_arg(r4d_geti_or(a, "chain", 0) != 0);
return r4d_qsa_work_bf16_emit(r4d_addr(k), r4d_addr(po), r4d_addr(cu), r4d_addr(tl),
r4d_addr(sx), r4d_addr(bt), r4d_addr(st), r4d_addr(pg),
r4d_addr(bp), r4d_addr(nc), (int)n, (int)ratio, (int)ring,
(int)seqs, (int)mw, (int)kp, (int)tl->stride[0],
(int)tl->stride[2], (int)sxp, (int)bp2, (int)sp,
r4d_addr(rp), rp ? (int)rp->shape[1] : 0, (int)bstep, stream);
r4d_addr(rp), rp ? (int)rp->shape[1] : 0, (int)bstep, stream,
r4d_geti_or(a, "chain", 0) != 0);
}