radiance 1.11.0

New models:
- GLM-5.3-Flash reads pictures: its vision tower and processor (--image-tokens sets the budget),
  with decode kernels for a few rows and the DSA indexer split over the ranks
- Sage-A1.5 (fp8 and MXFP4) with its vision tower and a DFlash2 drafter
- Unlimited-OCR (bf16)
- Gemma 4 31B with z-lab's DFlash and RedHatAI's DFlash2 drafters; at four cards its all-reduces
  are fused with the junctions, overlapped with the compute and sent compressed
- Ornith-1.5-35B-A3B w4a8 compose files

Speed:
- Block drafters (DFlash, DFlash2) accept their drafts on the card, and the next step is issued
  ahead
- The four-rank all-reduce is faster for every --tp 4 model
- qwen35_w8a8: the norms and SiLU write the int8 linears' operands directly
- --attn-prefill-fp8 off|qk|pv|both: fp8 QK and PV legs for the h256 prefill attention (about +20%
  prefill on a 221K-token prompt for the 27B MXFP4 at TP2); lossy, off by default

Features:
- Control vectors: --control-vector off|on|disabled (disabled by default), a per-request switch,
  and the published Qwen3.8-Flash-Next refusal-direction vector (its license is in NOTICE)
- Krea 2: the `rebalance` request field, as ComfyUI's ConditioningKrea2Rebalance
- Cards with a small PCI BAR run, with kernel arguments kept in host memory
- Dashboard: live acceptance figures; statsdump rotates its file at a size cap
- KV caches every rank holds whole (GLM-5.3's latent and index caches) take one host-tier slot

Fixes:
- Long conversations taking turns no longer fall back to an early snapshot: a host-tier restore
  makes room as memory pressure does and waits a step for the previous turn's release (two
  conversations of 142K and 147K tokens sent back to back: 31.3 s per turn before, 2.8 s now)
- Kernels before Linux 6.16 (amdgpu below 3.64) no longer hang at startup: virtual memory
  management is turned off there, with a warning
- Gemma 4 dense scales its token embeddings as Hugging Face does (bf16), which changes its output
- The four-rank all-reduce fences prefill-sized messages, for a rare divergence after a fresh start
- GLM-5.3: every refusal names the setting and the reason; its template keeps string content
- Several pictures in one request no longer refuse processors that take one image at a time

Changes: Plugin ABI 26: out-of-tree plugins must be rebuilt. The environment switches the PRs
added are fixed rules or flags now (R4D_ATTN_FP8 is --attn-prefill-fp8).
This commit is contained in:
Deadcode committed 2026-10-23 11:57:52 +02:00
210 files changed
+14363 -2138

No files matched your search

+22 -16
View File
@@ -115,18 +115,15 @@ inline double embed_scale(int64_t hidden) {
/* prefetch where a library serves it: the 31B trunk reading the next GEMM's leading weight bytes
* into the on-die cache beside the all-reduce in front of that GEMM, at decode heights (on lane 0
* as a chained read, or on the second lane: rad_arch.h prefetch_lane0), and the DFlash2 drafter's
* reads likewise. It writes nothing the model reads. Each read takes a weight's first 20 MB. With
* the reads on lane 0 (two rounds on 4x R9700): 20 MB 391 / 391 code tok/s, 289 / 288 prose;
* 16 MB 386 / 384, 285 / 283; 24 MB 388 / 387; 12 MB 368 / 369. */
* reads likewise. It writes nothing the model reads. Each read takes a weight's first 20 MB: on 4x
* R9700 with the reads on lane 0, 16 and 24 MB decoded 1-2% slower and 12 MB about 6%. */
constexpr int64_t kPrefetchBytes = (int64_t)20 << 20;
/* down_proj's read, the trunk GEMM no other read covers: its first 9 MB, beside the attention. It
* took the place of o_proj's read there: the 31B at tp 4 on 4x R9700, two rounds, every reply
* identical, 380 / 281 / 203 tok/s against 367 / 271 / 196 with o_proj's 16 MB; 10, 11, 12, 14
* and 20 MB of down_proj 379, 377, 373, 373 and 362; down_proj beside o_proj's read, or beside the
* feed-forward reduction, slower than either alone. The reads beside a reduction are one queue,
* and a longer one beside the attention pushes gate_up's read past the reduction it should hide
* in. */
/* down_proj's read, the trunk GEMM no other read covers: its first 9 MB, beside the attention, in
* place of a read of o_proj there (about 3.5% faster on the 31B at tp 4 on 4x R9700; 10-20 MB of
* down_proj were slower, as were two reads beside one reduction). The reads beside a reduction
* are one queue, and a longer one beside the attention pushes gate_up's read past the reduction
* it should hide in. */
constexpr int64_t kPrefetchDownBytes = (int64_t)9 << 20;
/* Block fp8 as libr4d's fp8a8 GEMMs read it: fp8_e4m3 codes, a bf16 scale per 128x128 block, no
@@ -166,8 +163,8 @@ inline long long dflash_block(const RadModelMeta* meta) {
/* DFlash proposes its whole block in one pass, so its depth is the block it was trained at less
* the anchor, and nothing else: 15 for z-lab's Gemma 4 drafters (block_size 16). True when the
* container carries one and `out` now names its depth. Chained launches measured a gain with it
* (the 26B-A4B's speculative step, +1% on 4x R9700), so the probe asks for them
* container carries one and `out` names its depth. Chained launches pay with it (the 26B-A4B's
* speculative step is 1% faster on 4x R9700), so the probe asks for them
* (RadArchProbe::chain_pays). */
inline bool dflash_probe(const RadModelMeta* meta, RadArchProbe* out) {
if (dflash_kind(meta) != 1) return false;
@@ -181,8 +178,8 @@ inline bool dflash_probe(const RadModelMeta* meta, RadArchProbe* out) {
/* The same for a DFlash2 drafter, for a plugin that serves rad_block_dflash2.h (the 31B's): its
* anchor predicts nothing either, so the depth is the trained block less one, 7 for RedHatAI's
* gemma-4-31B-it-speculator.dflash2 (block_size 8). Chained launches measured a gain with it (the
* 31B's speculative step, +13% on 4x R9700), so the probe asks for them. */
* gemma-4-31B-it-speculator.dflash2 (block_size 8). Chained launches pay with it (the 31B's
* speculative step is 13% faster on 4x R9700), so the probe asks for them. */
inline bool dflash2_probe(const RadModelMeta* meta, RadArchProbe* out) {
if (dflash_kind(meta) != 2) return false;
const long long bs = dflash_block(meta);
@@ -519,7 +516,12 @@ inline int Dflash1::Lin::declare(RadBuilder* b, Names& nm, const char* base, int
int64_t p[RAD_MAX_ROW_PARTS] = {0};
int np = 0;
for (int64_t q : row_parts) {
if (np >= RAD_MAX_ROW_PARTS || q % 16) return RAD_E_INVAL;
if (np >= RAD_MAX_ROW_PARTS || q % 16) {
fprintf(stderr, "radiance: '%s' has a %lld-row part per rank; an int8 weight takes at "
"most %d parts, each a multiple of 16 rows.\n", base, (long long)q,
(int)RAD_MAX_ROW_PARTS);
return RAD_E_INVAL;
}
p[np++] = q;
}
w = decl_view(b, wn, nullptr, "codes", RAD_I8, { N, K }, access, shard, grp, p, np);
@@ -582,7 +584,11 @@ inline int Dflash1::declare_drafter(RadBuilder* b, const RadModelMeta* meta,
return RAD_E_UNSUPPORTED;
}
dc.block = trained;
if (dg.n_layer > MAX_LAYERS) return RAD_E_UNSUPPORTED;
if (dg.n_layer > MAX_LAYERS) {
fprintf(stderr, "radiance: gemma4: the DFlash drafter has %lld layers; this block carries "
"at most %d\n", (long long)dg.n_layer, MAX_LAYERS);
return RAD_E_UNSUPPORTED;
}
{
std::vector<int> full;
const char* lt = rad_meta_gets(meta, "draft.layer_types", nullptr);