radiance 1.13.0

New models:
- Tencent Hy-Memory (HYV3) from its BF16, FP8 and GGUF checkpoints, with its native tool calls
- M2XFP4: metadata-augmented MXFP4 weights for Qwen3.8-27B and its DFlash2 drafter (top-1 89.1% ->
  92.4% against plain MXFP4), its quantiser and recipe, and ParoQuant's M2XFP4 checkpoints
- Gemma 4 E2B/E4B audio input; NVIDIA-Nemotron-3.5-Bolt-E4B in int8 and 4-bit, on two cards by
  default; Ornith-1.5-122B compose files

Speed:
- Weight reads beside the decode all-reduces (qwen35_fp8, gemma3; --weight-prefetch, on by default):
  the 27B MXFP4 with DFlash2 61.2 -> 67.9 tok/s at c1, TranslateGemma 27B +13%
- Head-256 split-KV decode attention at 256 workgroups and without bank conflicts (27B: +3-5% a
  step at 25-41K context), and the prefill KV split for small launches (a short turn over a long
  context decodes the other sequences 27% faster in that step)
- MXFP4 decode gate_up, activation and fp8 quantiser in one launch (27B, Gemma 3 up to 64 rows:
  TranslateGemma +2-5% at 2-8 streams)
- ParoQuant int4/int5 tiled GEMMs 6-9% faster
- Speculation: a step's tokens are sent before the drafter's passes end, no step waits behind one
  that ends its requests, and the MTP head's first draft no longer collapses after short chats in
  the prefix cache

Features:
- --kv-resident N: KV streaming for a context bigger than VRAM (qwen4exp_fp8, GLM-5.3)
- MiniMax-H3: reference media and keyframe conditioning with the VAE encoders
- Krea 2 rebalance presets balanced, detail and subtle
- The dashboard's request history; a stall watch that reports a frozen step's thread and stack
- rad-tune at the served configuration, collectives measured as the exchange; Gemma 4 E2B/E4B's
  per-layer embeddings read ahead off the step path
- A GPTQ calibration tap and recipe for Gemma 4 31B's w4a8 container

Fixes:
- The two-rank all-reduce checks that a peer's push has landed before reducing it
- z-lab's DFlash drafter on Gemma 4 31B keeps drafting after a prefix-cache hit
- MiniMax-H3's modulation rows

Changes: Plugin ABI 31: out-of-tree plugins must be rebuilt. RADIANCE_PREFETCH_BESIDE is
--weight-prefetch now; RADIANCE_NO_HUGE_PAGES, RADIANCE_IDS_EARLY, RADIANCE_ATTN_BAND_SPLIT,
R4D_PREFILL_SPLITS, RAD_PLE_TIMING and RAD_PLE_CACHE_ROWS are gone.
This commit is contained in:
Deadcode committed 2026-10-27 16:47:35 +01:00
198 files changed
+20904 -3240

No files matched your search

+33 -14
View File
@@ -24,7 +24,7 @@
// groups. Without the barrier PF has no effect.
// DOT2 v_dot2_f32_f16 row sum from the packed f16 P: 4 instructions instead of 8, and the
// denominator uses the p values the PV matmul used.
// BTS/KWIDE/GPREV tile staging; see each define.
// BTS/KWIDE/GPREV/KLATE tile staging; see each define.
// QK8 Lossy. Q rounded to e4m3 once at load, after the folded scale; K as e4m3 bytes in LDS
// (half the tile) and Q.K^T runs as fp8 WMMA at twice the f16 rate.
// PV8 Lossy. P rounded to e4m3 and V as e4m3 bytes in LDS, P.V as fp8 WMMA. GROW is 8
@@ -66,6 +66,14 @@
// LDSB: an LDS-scoped barrier instead of __syncthreads() (lds_barrier() in r4d_common.h). The
// default fence invalidates the vector cache twice per tile, though only LDS needs ordering.
#define O_LDSB 2097152
// KLATE: on the fp8 and k6_v4 caches (the wide K fetch), tile ti+1's K is fetched once tile ti's
// last m-tile has its scores (its K fragments are dead there, so kreg adds no live range across the
// WMMAs), and the staging between the barriers only widens and stores. Otherwise every wave of the
// workgroup (the only one on its WGP) waits out a global round trip each tile. With the branch-free
// K fetch and the V scales packed at the store, k6_v4 over 100k keys runs 25.96 -> 21.48 ms (2048
// queries, r4d_selftest --perfpaged) and fp8 24.6 -> 22.7; the gain is largest once the KV no
// longer fits the 64 MB Infinity Cache.
#define O_KLATE 4194304
// O_V4: the fp8_v4 cache, O_V4 | O_K6 the k6_v4 cache (see r4d_attn_decode_h256_gqa6.hip).
#define O_V4 33554432
#define O_K6 67108864
@@ -147,6 +155,10 @@ void r4d_attn_prefill_kernel(const R4DArgs a)
constexpr int GPREV = ((OPT & O_GPREV) && !V4) ? 1 : 0;
constexpr int LDSB = (OPT & O_LDSB) ? 1 : 0;
constexpr int KWIDE = (OPT & O_KWIDE) ? 1 : 0;
// fp8_v4 takes none of the three (KLATE, the assume, the scale pack): they gain at 100k but lose
// 3-7 % at 25k and 50k.
constexpr int OLDV4 = V4 && !K6;
constexpr int KLATE = ((OPT & O_KLATE) && KWIDE && !KVP && !OLDV4) ? 1 : 0;
constexpr int QK8 = ((OPT & O_QK8) && !KVP) ? 1 : 0;
constexpr int PV8 = ((OPT & O_PV8) && !KVP) ? 1 : 0;
static_assert(!(OPT & (O_QK8 | O_PV8)) || !KVP,
@@ -184,6 +196,10 @@ void r4d_attn_prefill_kernel(const R4DArgs a)
uint8_t* const sV8 = (uint8_t*)sV16;
const int tid = threadIdx.x, lane = tid & 31, warp = tid >> 5;
// The launch is NTHR threads. Stated, so the wide K fetch's `key >= TILE` test (never true:
// KITEMS == NTHR) folds: as a branch its join made the compiler wait on every load in flight right
// after the K fetch, the V stores' cover included.
if constexpr (!OLDV4) __builtin_assume(tid < NTHR);
const int c = lane & 15, h = lane >> 4;
// SPLIT: blockIdx.x = qtile * splits + segment; wave-uniform, so the divide is scalar.
@@ -208,14 +224,12 @@ void r4d_attn_prefill_kernel(const R4DArgs a)
const int* __restrict__ bt = a.block_table + (size_t)seq * a.max_blocks;
// SPLIT: tps tiles a segment, as r4d_attn_tps (decode unit, included after this one) cuts
// tiles(ctx). A segment at or past the merge's segment count u = ceil(tiles / tps) is never
// read: exit. One the merge reads but that lies wholly past this workgroup's causal end (an
// early query tile of a multi-tile chunk) must still be written: the merge reads all u segments
// of every row. It is, by the ordinary path: its walk below is empty, so the epilogue stores
// the empty partial (O = 0, m_ref = -3e38, l = 0); the prologue's prefetch of tile tstart reads
// inside the sequence (tstart < tiles) and is dropped. A separate early store measured worse:
// its extra live range spilled k6_v4's next-tile fetch addresses inside the tile loop.
// SPLIT: tps tiles a segment, as r4d_attn_tps cuts tiles(ctx). A segment at or past the merge's
// segment count u = ceil(tiles / tps) is never read: exit. One wholly past this workgroup's
// causal end must still be written, since the merge reads all u segments of every row: its walk
// is empty, so the epilogue stores the empty partial (O = 0, m_ref = -3e38, l = 0), and the
// prologue's prefetch of tile tstart stays inside the sequence. (A separate early store spills
// k6_v4's next-tile fetch addresses inside the tile loop.)
const int sp_tps = SPLIT ? ((ctx + TILE - 1) / TILE + a.splits - 1) / a.splits : 0;
if constexpr (SPLIT) {
if (sp * sp_tps >= (ctx + TILE - 1) / TILE) return;
@@ -291,7 +305,9 @@ void r4d_attn_prefill_kernel(const R4DArgs a)
static_assert(!V4 || F16, "fp8_v4 widens V to f16");
constexpr int NP4 = (TILE / 2) * (HEAD_DIM / 8);
constexpr int U4 = V4 ? (NP4 + NTHR - 1) / NTHR : 1;
uint32_t v4c[U4][2], v4s[U4];
// The pair's two scales stay apart until storeV4 packs them: packed here, the prefetch a tile
// ahead would be waited on right after it is issued (fp8_v4 packs here, see KLATE).
uint32_t v4c[U4][2], v4s[U4][2];
auto fetchV4 = [&](int k0, const int* blks) {
#pragma unroll
for (int r = 0; r < U4; ++r) {
@@ -308,7 +324,8 @@ void r4d_attn_prefill_kernel(const R4DArgs a)
v4c[r][j] = *(const uint32_t*)(base + VOFF + o * 4);
sc[j] = *(const uint16_t*)(base + VSOFF + (o >> 2) * 2);
}
v4s[r] = sc[0] | (sc[1] << 16);
if constexpr (OLDV4) { v4s[r][0] = sc[0] | (sc[1] << 16); v4s[r][1] = 0; }
else { v4s[r][0] = sc[0]; v4s[r][1] = sc[1]; }
}
}
};
@@ -324,7 +341,7 @@ void r4d_attn_prefill_kernel(const R4DArgs a)
const uint32_t m0 = ((v4c[r][0] >> 4) & 0x0F0F0F0Fu) ^ 0x08080808u;
const uint32_t n1 = (v4c[r][1] & 0x0F0F0F0Fu) ^ 0x08080808u;
const uint32_t m1 = ((v4c[r][1] >> 4) & 0x0F0F0F0Fu) ^ 0x08080808u;
const h2 s2 = __builtin_bit_cast(h2, v4s[r]);
const h2 s2 = __builtin_bit_cast(h2, OLDV4 ? v4s[r][0] : (v4s[r][0] | (v4s[r][1] << 16)));
const h2 bias = { (_Float16)1032.0f, (_Float16)1032.0f };
uint16_t* dst = &sV16[(o * 8) * VSTR + 2 * kp];
uint8_t* dst8 = &sV8[(o * 8) * VSTR8 + 2 * kp];
@@ -502,6 +519,7 @@ void r4d_attn_prefill_kernel(const R4DArgs a)
if (BTS) load_bt(tstart * NB, blk);
if (GPREV) fetchV(tstart * TILE, blk);
if (V4) fetchV4(tstart * TILE, blk);
if (KLATE) fetchK(tstart * TILE, blk);
for (int ti = tstart; ti < ntiles; ++ti) {
const int k0 = ti * TILE;
@@ -510,8 +528,8 @@ void r4d_attn_prefill_kernel(const R4DArgs a)
load_bt((ti + 1) * NB, blkn);
}
if (LDSB) lds_barrier(); else __syncthreads();
fetchK(k0, blk);
// V first: already in registers, so it covers K's load latency.
if (!KLATE) fetchK(k0, blk);
// V first: already in registers.
if constexpr (V4) { storeV4(); } else { if (!GPREV) fetchV(k0, blk); storeV(); }
storeK();
if (LDSB) lds_barrier(); else __syncthreads();
@@ -559,6 +577,7 @@ void r4d_attn_prefill_kernel(const R4DArgs a)
for (int j = 0; j < PF; ++j) s = D::wmma(kb[j], qf[g + j], s);
}
}
if (KLATE && mt == MT - 1 && ti + 1 < ntiles) fetchK(k0 + TILE, blkn);
float sc[8];
#pragma unroll
for (int e = 0; e < 8; ++e) sc[e] = FOLDQ ? s[e] : s[e] * mul;