radiance 1.14.0

New models and formats:
- libr3d: a kernel library for RDNA3 (gfx11) cards
- nomic-embed-text-v2-moe (the nomicbert plugin)
- Gemma 4 E2B with its per-layer MLP width, and Google's unmodified E2B/E4B directories in bf16
- DeepSeek-V4.1-Flash converted straight from its release: the Engram tables, the fused imatrix and
  rad-convert --chat-template for a release that ships no template
- GGUF Q8_0, Q4_K and Q6_K tensors import as their planes; rad-convert writes them without a recipe
- Qwen3.8-Flash-Next-FP8 converts and serves through qwen4exp_fp8

Speed:
- hc_read's decode kernels as one grid (34.7 -> 25.2 us at 4 rows) and its tiled up-mix pipelined
- gemm_fp8a8: the narrow form's scales staged through LDS (Flash-Next int8 at 32 rows 83.6 -> 68.3
  us), the gated three-tile form at 8 waves (gate_up at 48 rows 272.9 -> 180.6 us)
- Qwen3.8-27B: the delta net's out-projection read beside its decode recurrent update (x1 19.40 ->
  19.10 ms a step), and the verify's split-KV attention sized by context depth (x3 at 180K 42.4 ->
  40.3 ms a step)
- Hy-Memory (HYV3) decode: fused QK norm, RoPE and KV store, residual adds folded into the norms,
  coalesced one-token expert GEMMs
- spechub: the coupled verify walks the live candidates only (151 -> 31 us a launch)

Speculation:
- DFlash2: lossless coupled acceptance at T > 0 (--draft-coupling on)
- A block drafter's proposals verified as a tree, on by default for the Gemma 4 31B's DFlash2, with
  a block-16 tree that runs its short block under load

Features:
- Decode-hot residency: --draft-expert-placement host, --expert-profile, --expert-pin-top, and
  --expert-stats FILE for the routed experts each layer selects
- --ngram-placement ram=DIR: one n-gram table shared by engines on separate cards
- Prefix cache: --prefix-resume exact (default) resumes a hit on the cold run's own chunk grid, so it
  answers bit-identically; snapshots at a head other prompts share, from 528-token prompts, and for
  tip-only one drafter window below the tip; hits on models whose KV groups have different block
  sizes; the snapshot store keeps a floor of 8 ahead of --host-headroom-mib
- Typed tool-call argument tags; rad-chatparse --request renders and reads back one request as the
  server does
- MiniMax-H3: keyframes ride a latent upscale
- Gemma 3's fused all-reduce junction on the lossy wire

Fixes:
- A speculative step shorter than its band (an MTP step of 4 rows at gqa 8) no longer stops the
  engine with a scratch refusal at issue (#293)
- --p2p off: prefill back to 1.12.0's rate; 1.13.0's push check read a host-memory slot over the link
  twice (#323)
- A chat template that cannot render a conversation is refused at load, not mid-request
- imatrix entries found under llama.cpp's spelling; the W4A8 prefill's tail scale read; the GDN conv
  kernels on an f32 weight; dense integer rows at the group they compute (a Q8_0 weight at group 32)
- --expert-profile refuses a profile recorded on another model
- hc_read's one-grid wait traps past its deadline instead of reading a stale value

Changes: Plugin ABI 31, unchanged. RADIANCE_DRAFT_TREE, DFLASH2_TREE_NODES, DFLASH2_TREE_TEMP and
DFLASH_Q_TEMP are gone (trees run where the probe says they pay; temperatures 1.25 / 0.6).
This commit is contained in:
Deadcode committed 2026-10-29 12:04:24 +01:00
1 parent 481fcd5df0
commit 4a61d7296b
160 files changed
+8790 -6819

No files matched your search

+39 -12
View File
@@ -237,8 +237,8 @@ int meta_from_config_json(const std::string& dir, MetaOwn* out) {
RadModelMeta& m = out->m;
/* Nomic BERT states its geometry with n_layer, n_embd, n_head, n_inner, n_positions and
* moe_top_k. They are fallbacks in the same chain, so a config carrying both spellings keeps
* the HuggingFace one and every existing checkpoint reads byte for byte as before. */
* moe_top_k. They are the last fallbacks in each chain, so a config carrying both spellings
* reads the HuggingFace one. */
m.n_layers = gi("num_hidden_layers", gi("n_layer", 0));
m.n_embd = gi("hidden_size", gi("n_embd", 0));
m.n_head = gi("num_attention_heads", gi("n_head", 0));
@@ -274,18 +274,21 @@ int meta_from_config_json(const std::string& dir, MetaOwn* out) {
/* The quantisation descriptor, which with the architecture selects the plugin (spec §2.4): the
* quant_method plus its fmt ("fp8_e4m3"), so the checkpoint, not a flag, distinguishes fp8 from
* bf16 releases.
* bf16 releases. transformers' fine-grained FP8 states no fmt (Qwen3.8-Flash-Next-FP8's config)
* and is always E4M3, so a bare "fp8" is "fp8_e4m3", as a release that states it is.
*
* A Gemma 4 E2B/E4B checkpoint states no quantization_config: it is the bf16 release that
* arch/gemma4_bf16 serves as compressed-tensors, which is what rad-convert's
* `--set quantization_config.quant_method=compressed-tensors` said by hand. Its per-layer
* embeddings or shared KV layers name the E form; arch/gemma4 serves only the 26B-A4B/31B shape
* and refuses those two keys, so the bare (gemma4, "") descriptor must not win. */
* A Gemma 4 E2B/E4B checkpoint states no quantization_config: it is a bf16 release that
* arch/gemma4_bf16 serves under "compressed-tensors", so it needs no
* `--set quantization_config.quant_method=compressed-tensors`. Its per-layer embeddings or shared
* KV layers name the E form; arch/gemma4 serves only the 26B-A4B/31B shape and refuses those two
* keys, so the bare (gemma4, "") descriptor must not win. */
std::string quant_descriptor(const MetaOwn& m) {
std::string q;
if (const char* qm = m.get("quantization_config.quant_method")) {
q = qm;
if (const char* fm = m.get("quantization_config.fmt")) { q += "_"; q += fm; }
const char* fm = m.get("quantization_config.fmt");
if (!fm && q == "fp8") fm = "e4m3";
if (fm) { q += "_"; q += fm; }
return q;
}
if (m.arch == "gemma4") {
@@ -2401,6 +2404,8 @@ int ckpt_resolve(Checkpoint& ck, const Program& prog, const std::string& name, b
* RAD_MAP_COPY alternatives, first present wins (a tied lm_head is output.weight when
* shipped, else the embedding). */
const bool alternatives = maps.front()->mode == RAD_MAP_COPY && srcs.size() > 1;
/* Pieces whose scale is one `X.weight_scale` their shards share (below). */
bool shard_scaled = false;
for (const Src1& s1 : srcs) {
const SrcTensor* st = ck.find(s1.name);
/* An FP8 weight's scale plane: `X.weight_scale_inv` (block-scaled releases) or
@@ -2410,6 +2415,17 @@ int ckpt_resolve(Checkpoint& ck, const Program& prog, const std::string& name, b
const SrcTensor* sc = st ? ck.find(std::string(s1.name) + "_scale_inv") : nullptr;
if (!sc && st && (st->rad_dtype == RAD_F8E4M3 || st->rad_dtype == RAD_F8E5M2))
sc = ck.find(std::string(s1.name) + "_scale");
/* A table split into shards, `X.shard_<i>.weight`, under one scale for all of them,
* `X.weight_scale` (Qwen3.8-Flash-Next-FP8's n-gram table). */
if (!sc && st && (st->rad_dtype == RAD_F8E4M3 || st->rad_dtype == RAD_F8E5M2)) {
const std::string n = s1.name;
const size_t at = n.rfind(".shard_");
const size_t end = n.size() >= 7 ? n.size() - 7 : 0;
if (at != std::string::npos && end > at + 7 && n.compare(end, 7, ".weight") == 0 &&
std::all_of(n.begin() + (long)at + 7, n.begin() + (long)end,
[](char c) { return c >= '0' && c <= '9'; }))
if ((sc = ck.find(n.substr(0, at) + ".weight_scale"))) shard_scaled = true;
}
/* A weight shipped in an imported form is read through that form's views. */
{
const SrcTensor *ic = nullptr, *is = nullptr;
@@ -2501,8 +2517,8 @@ int ckpt_resolve(Checkpoint& ck, const Program& prog, const std::string& name, b
out->why = std::string("'") + p0.name + "' is a GGUF " +
(gguf_dtype(p0.ggml) ? gguf_dtype(p0.ggml)->name : "block") + " tensor";
/* Q8_0, Q4_K and Q6_K become their planes when every piece is of that type and they join
* along rows, so each row of the weight is one source row of blocks; the loader still
* refuses them, since the blocks interleave what the planes hold apart. */
* along rows, so each row of the weight is one source row of blocks. rad-convert imports
* them; the loader refuses them, since the blocks interleave what the planes hold apart. */
bool one_type = true;
for (const SrcTensor* pk : out->pieces) one_type = one_type && pk->ggml == p0.ggml;
RadEncoding enc;
@@ -2693,7 +2709,18 @@ int ckpt_resolve(Checkpoint& ck, const Program& prog, const std::string& name, b
bad = true;
out->why = "its FP8 pieces are joined along a column, across their scale planes";
}
if (!bad) {
/* Shards under the one scale they share are one tensor with one scale, byte for byte:
* `fp8_e4m3*<s>[*x*]`. */
bool one_scale = !bad && shard_scaled && n_one == (int)out->pieces.size();
for (size_t k = 1; one_scale && k < out->scales.size(); ++k)
one_scale = out->scales[k] == out->scales[0];
if (one_scale) {
out->trivial = out->why.empty();
rad_enc_clear(&out->enc);
rad_enc_copy_str(out->enc.scheme, "affine");
rad_enc_add_plane(&out->enc, "codes", dt, 1, 1);
rad_enc_add_plane(&out->enc, "scale", sdt, 0, 0);
} else if (!bad) {
out->trivial = out->why.empty() && n_one == 0;
/* A per-tensor scale is written once a row (ckpt_plane_rows). */
if (n_one) {