Archived
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.
51 lines
2.7 KiB
Plaintext
51 lines
2.7 KiB
Plaintext
// R4D attention dispatch for the DFlash2 drafter: head_dim 128, 4 queries per KV head, paged
|
|
// block 16, sliding window. Instantiations of the h256/gqa6 kernel templates with WIN = 1.
|
|
//
|
|
// Decode only. Queries long enough for the query-tiled prefill kernel occur on a drafter only in
|
|
// prefill steps; the rows declare the decode band (q_len * gqa <= 64), so those resolve elsewhere.
|
|
//
|
|
// Rationale: a general unified-attention kernel (vLLM's) launches (q_blocks, kv_heads, segments)
|
|
// with q_blocks padded for capture, so most workgroups return immediately; on this shape it is
|
|
// 8-9x slower than the window-capped DRAM bound. R4D keeps the query inside the workgroup (up to 64 rows of
|
|
// q_len * gqa), so its grid is (splits, kv_heads, num_seqs) with no dead workgroups.
|
|
#include "r4d.h"
|
|
#include "r4d_common.h"
|
|
#include <cmath>
|
|
#include <algorithm>
|
|
using std::max;
|
|
// The decode kernel uses helpers from the prefill unit, so prefill is included first.
|
|
// Nothing here instantiates r4d_attn_prefill_kernel.
|
|
#include "r4d_attn_prefill_h256_gqa6.hip"
|
|
#include "r4d_attn_decode_h256_gqa6.hip"
|
|
|
|
// Tile, block size, row cap and merge: r4d_decode_launch_win (r4d_attn_decode_h256_gqa6.hip).
|
|
#define B_HEAD_DIM 128
|
|
#define B_GQA 4
|
|
#define B_TILE 16
|
|
// The h256 decode option set, including K prefetch 2 (head_dim 128 would not spill at 4, but 2 is
|
|
// 0.3-1.3% faster here with identical output), plus O_KRAW: one-round K loads
|
|
// (r4d_attn_decode_h256_gqa6.hip), 16 VGPRs at head_dim 128 with no occupancy loss.
|
|
#define B_OPT 20207163
|
|
|
|
extern "C" long r4d_attn_decode_h128_gqa4_scratch_bytes(const R4DArgs* a) {
|
|
return r4d_decode_scratch(a, r4d_decode_splits_win(a, B_TILE), B_OPT);
|
|
}
|
|
|
|
extern "C" int r4d_attn_decode_h128_gqa4_bf16kv(const R4DArgs* a, hipStream_t s) {
|
|
return r4d_decode_launch_win<B_HEAD_DIM, B_GQA, B_OPT, 1>(a, s);
|
|
}
|
|
// The int8 cache (int8 K and V, an f16 scale each per token and head): K is widened from the paged
|
|
// cache a fragment at a time, so without the one-round raw K loads.
|
|
extern "C" int r4d_attn_decode_h128_gqa4_i8kv(const R4DArgs* a, hipStream_t s) {
|
|
return r4d_decode_launch_win<B_HEAD_DIM, B_GQA, (B_OPT & ~O_KRAW) | O_KVI8, 0>(a, s);
|
|
}
|
|
// The same over a cache holding each kv head once for kv_rep query groups (O_KVREP), q at
|
|
// R4DArgs::q_ld (O_QLD): gqa 8 on this gqa-4 kernel, under attn_paged_qrow.
|
|
extern "C" int r4d_attn_decode_h128_gqa4_rep_i8kv(const R4DArgs* a, hipStream_t s) {
|
|
return r4d_decode_launch_win<B_HEAD_DIM, B_GQA, (B_OPT & ~O_KRAW) | O_KVI8 | O_QLD | O_KVREP,
|
|
0>(a, s);
|
|
}
|
|
extern "C" int r4d_attn_decode_h128_gqa4_rep_bf16kv(const R4DArgs* a, hipStream_t s) {
|
|
return r4d_decode_launch_win<B_HEAD_DIM, B_GQA, B_OPT | O_QLD | O_KVREP, 1>(a, s);
|
|
}
|