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
@@ -19,8 +19,8 @@
|
||||
|
||||
#include "r4d.h"
|
||||
#include "r4d_args.h"
|
||||
#include "r4d_emit.h"
|
||||
#include "r4d_chain.h"
|
||||
#include "r4d_emit.h"
|
||||
#include "r4d_common.h"
|
||||
#include "r4d_gdn_wmma.h"
|
||||
|
||||
@@ -242,12 +242,13 @@ constexpr long long kMxWavesTarget = 4096;
|
||||
* heads) would otherwise dominate. */
|
||||
constexpr long long kMxMinTiles = 4;
|
||||
|
||||
#define QSA_SCORE_MX_PARAMS \
|
||||
const unsigned short* __restrict__ q, const unsigned short* __restrict__ bk, \
|
||||
const int32_t* __restrict__ bt, const int32_t* __restrict__ cu, \
|
||||
const int32_t* __restrict__ nc, float* __restrict__ out, int M, int nb, int nseq, \
|
||||
int tpw, int q_ld, int bk_ld, int bt_ld, int out_ld, int vec
|
||||
template <int HEADS>
|
||||
__device__ __forceinline__ void qsa_score_mx_kernel_body(
|
||||
const unsigned short* __restrict__ q, const unsigned short* __restrict__ bk,
|
||||
const int32_t* __restrict__ bt, const int32_t* __restrict__ cu,
|
||||
const int32_t* __restrict__ nc, float* __restrict__ out,
|
||||
int M, int nb, int nseq, int tpw, int q_ld, int bk_ld, int bt_ld, int out_ld, int vec) {
|
||||
__device__ __forceinline__ void qsa_score_mx_body(QSA_SCORE_MX_PARAMS) {
|
||||
|
||||
const int lane = threadIdx.x & (kWave - 1), wave = threadIdx.x >> 5;
|
||||
const int half = lane >> 4, col = lane & 15;
|
||||
@@ -335,25 +336,17 @@ __device__ __forceinline__ void qsa_score_mx_kernel_body(
|
||||
}
|
||||
}
|
||||
|
||||
/* The plain and chained forms (r4d_chain.h): every block leaves through the wrapper. */
|
||||
template <int HEADS>
|
||||
__global__ __launch_bounds__(kMxWaves * kWave) void qsa_score_mx_kernel(
|
||||
const unsigned short* __restrict__ q, const unsigned short* __restrict__ bk,
|
||||
const int32_t* __restrict__ bt, const int32_t* __restrict__ cu,
|
||||
const int32_t* __restrict__ nc, float* __restrict__ out,
|
||||
int M, int nb, int nseq, int tpw, int q_ld, int bk_ld, int bt_ld, int out_ld, int vec) {
|
||||
qsa_score_mx_kernel_body<HEADS>(q, bk, bt, cu, nc, out, M, nb, nseq, tpw, q_ld, bk_ld, bt_ld, out_ld, vec);
|
||||
}
|
||||
template <int HEADS>
|
||||
__global__ __launch_bounds__(kMxWaves * kWave) void r4dchain_qsa_score_mx(
|
||||
const unsigned short* __restrict__ q, const unsigned short* __restrict__ bk,
|
||||
const int32_t* __restrict__ bt, const int32_t* __restrict__ cu,
|
||||
const int32_t* __restrict__ nc, float* __restrict__ out,
|
||||
int M, int nb, int nseq, int tpw, int q_ld, int bk_ld, int bt_ld, int out_ld, int vec) {
|
||||
r4d_chain_wait();
|
||||
qsa_score_mx_kernel_body<HEADS>(q, bk, bt, cu, nc, out, M, nb, nseq, tpw, q_ld, bk_ld, bt_ld, out_ld, vec);
|
||||
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 <int HEADS, class CH>
|
||||
__global__ __launch_bounds__(kMxWaves * kWave)
|
||||
void qsa_score_mx_kernel(QSA_SCORE_MX_PARAMS) {
|
||||
if (CH::on) r4d_chain_wait();
|
||||
qsa_score_mx_body<HEADS>(q, bk, bt, cu, nc, out, M, nb, nseq, tpw, q_ld, bk_ld, bt_ld, out_ld,
|
||||
vec);
|
||||
if (CH::on) r4d_chain_done();
|
||||
}
|
||||
#undef QSA_SCORE_MX_PARAMS
|
||||
|
||||
/* Form override for tests (r4d_selftest compares the two): 0 = automatic, 1 = scalar,
|
||||
* 2 = matrix. Like r4d_gemm_fp8a8_pin_mw. */
|
||||
@@ -371,7 +364,8 @@ extern "C" void r4d_qsa_score_pin_form(int form) { g_qsa_form = form; }
|
||||
// out [M][nb] f32, `out_ld` elements a row (0 = nb)
|
||||
static int r4d_qsa_score_bf16_emit(long q, long bk, long bt, long cu, long nc, long out,
|
||||
int M, int n, int heads, int nb, int nseq,
|
||||
int q_ld, int bk_ld, int bt_ld, int out_ld, RadStream stream) {
|
||||
int q_ld, int bk_ld, int bt_ld, int out_ld, RadStream stream,
|
||||
bool chain) {
|
||||
int emit_rc = RAD_OK;
|
||||
if (!q || !bk || !bt || !cu || !nc || !out) return R4D_NO(RAD_E_INVAL);
|
||||
if (M <= 0 || n <= 0 || heads <= 0 || nb <= 0 || nseq <= 0) return R4D_NO(RAD_E_SHAPE);
|
||||
@@ -394,12 +388,14 @@ static int r4d_qsa_score_bf16_emit(long q, long bk, long bt, long cu, long nc, l
|
||||
if (tpw < kMxMinTiles) tpw = kMxMinTiles;
|
||||
const unsigned gx = (unsigned)((tiles + tpw * kMxWaves - 1) / (tpw * kMxWaves));
|
||||
const int vec = (out_ld % 4 == 0) && ((out & 15) == 0);
|
||||
#define RAD_QSA_MX(H) \
|
||||
emit_rc = R4D_EMIT(stream, (g_r4d_chain_arg ? &r4dchain_qsa_score_mx<H> : &qsa_score_mx_kernel<H>), dim3(gx, (unsigned)qt), \
|
||||
#define RAD_QSA_MX_E(H, CH_) \
|
||||
emit_rc = R4D_EMIT(stream, (qsa_score_mx_kernel<H, CH_>), dim3(gx, (unsigned)qt), \
|
||||
dim3(kMxWaves * kWave), 0, (const unsigned short*)q, \
|
||||
(const unsigned short*)bk, \
|
||||
(const int32_t*)bt, (const int32_t*)cu, (const int32_t*)nc, \
|
||||
(float*)out, M, nb, nseq, (int)tpw, q_ld, bk_ld, bt_ld, out_ld, vec)
|
||||
#define RAD_QSA_MX(H) \
|
||||
do { if (chain) RAD_QSA_MX_E(H, r4dchain); else RAD_QSA_MX_E(H, R4dUnchained); } while (0)
|
||||
switch (heads) {
|
||||
case 1: RAD_QSA_MX(1); break;
|
||||
case 2: RAD_QSA_MX(2); break;
|
||||
@@ -408,6 +404,7 @@ static int r4d_qsa_score_bf16_emit(long q, long bk, long bt, long cu, long nc, l
|
||||
default: return R4D_NO(RAD_E_SHAPE);
|
||||
}
|
||||
#undef RAD_QSA_MX
|
||||
#undef RAD_QSA_MX_E
|
||||
return emit_rc;
|
||||
}
|
||||
const unsigned nbg = (unsigned)((nb + kWaves * kBPW - 1) / (kWaves * kBPW));
|
||||
@@ -482,10 +479,10 @@ extern "C" int r4d_rad_qsa_score(const RadArgs* a, RadStream stream) {
|
||||
const long long qp = r4d_row_pitch(q), kp = r4d_row_pitch(bk);
|
||||
const long long tp = r4d_row_pitch(bt), op = r4d_row_pitch(o);
|
||||
if (qp < 0 || kp < 0 || tp < 0 || op < 0) return R4D_NO(RAD_E_STRIDE);
|
||||
const R4dChainArg chain_arg(r4d_geti_or(a, "chain", 0) != 0);
|
||||
return r4d_qsa_score_bf16_emit(r4d_addr(q), r4d_addr(bk), r4d_addr(bt), r4d_addr(cu),
|
||||
r4d_addr(nc), r4d_addr(o),
|
||||
(int)M, (int)n, (int)heads, (int)nb, (int)nseq,
|
||||
(int)qp, (int)kp, (int)tp, (int)op, stream);
|
||||
(int)qp, (int)kp, (int)tp, (int)op, stream,
|
||||
r4d_geti_or(a, "chain", 0) != 0);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user