radiance 1.12.0

New models:
- Fish Audio drama-3: speech with speaker tags and inline direction, voices cloned from reference
  clips (the `references` field of /v1/audio/speech and the streaming session), two cards
- Gemma 4 E2B/E4B (KV-shared layers, per-layer embeddings, clipped vision linears), with
  NVIDIA-Nemotron-3.5-Bolt-E4B in bf16 with DFlash and vision on one card, and E4B recipes

Speed:
- MXFP4 GEMMs for one to 64 rows and a tiled prefill GEMM at TN=4 from 1024 rows: the 27B MXFP4
  with DFlash2 decodes about 1% faster at c1, 5% at c4 and 14% at c16
- The fp8 and int8 LM heads read their weight once for 65 to 128 rows
- A prefill step of one sequence runs in two pieces on a second lane at two ranks (qwen35_fp8,
  gemma3): a 45K-token prompt on the 27B fp8 in 15.1 s instead of 16.2 s
- Gemma 3's fused all-reduce junctions also under a lossy wire
- --draft-short-from N: a block drafter runs its shorter block from N decoding sequences on
  (off by default; with 8 on the 27B MXFP4: c8 +12%, c16 +18%, c64 +32%, c1 unchanged)
- --tp-attn-split rows: GLM-5.3-Flash's MLA attention split by rows over the ranks, 18 to 21%
  faster prefill; lossy, `heads` stays the default
- --draft-coupling on: Qwen3.8-Flash-Next's MTP drafter samples its proposals from its reranked
  top-8 and the target's draw is coupled to it; pays at high temperatures (c1 at T 1.0: 155 ->
  178 tok/s), costs at low ones; off by default

Features:
- Edited prompts on windowed models (Gemma 4) reuse their prefix: periodic window snapshots, and
  snapshot-backed prefix KV kept across recomputes (an edited tail on Gemma 4 31B: 96 s -> 2.6 s)
- DELETE /sessions/<label> and DELETE /sessions?id=<id> forget one stored conversation
- --state-cache-dtype f16: the delta-net state cache at half the memory (qwen35 plugins; lossy)

Fixes:
- A browser's CORS preflight allows DELETE

Changes: Plugin ABI 27: out-of-tree plugins must be rebuilt. The environment switches the PRs
added are flags now (--tp-attn-split, --draft-coupling, --state-cache-dtype).
This commit is contained in:
137 files changed
+12959 -1126

No files matched your search

+45 -2
View File
@@ -77,6 +77,7 @@
*/
#pragma once
#include "rad_sample.h"
#include "rad_spechub.h"
#include "../rad_core.h"
#include "grammar.h"
@@ -86,6 +87,7 @@
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
namespace rad {
@@ -115,6 +117,10 @@ struct SamplerConfig {
* from this many of the most likely tokens, not the whole vocabulary. A request asking for a
* larger top-k is refused at admission, not silently narrowed. */
int64_t max_candidates = kSampleCandidates;
/* --draft-coupling: declare the coupled verify (`mtp_couple_verify`) behind the pick and the
* per-row state plane it reads. */
bool draft_coupling = false;
};
/* ================================================================== the driver */
@@ -166,13 +172,18 @@ public:
/* Whether allows_speculation's answer can no longer change. It changes only when a grammar
* whose backend cannot rewind starts to constrain (on a commit). */
bool speculation_fixed(uint64_t req_id) const;
/* --draft-coupling: bind the per-round states of the linear draft just published, `n` of
* them (0 clears). Each must name this request, the round it belongs to, and a `draw.mode` the
* row actually ran. RAD_E_NOTFOUND for a request already ended here. */
int set_mtp_couple(uint64_t req_id, const RadMtpCoupleState* states, int n);
/* ---------------------------------------------------------- step path */
/* Stage this step's parameter rows, penalty history and grammar bitmasks into pinned memory.
* Scheduler thread, before the rank threads are released at the barrier. Allocates nothing;
* every buffer was sized at declare against max_seqs (spec §3.1). */
int build_step(const std::vector<Request*>& reqs);
* every buffer was sized at declare against max_seqs (spec §3.1). `step` is the engine's step
* the build stages for, carried into the coupling snapshot. */
int build_step(const std::vector<Request*>& reqs, int64_t step = -1);
/* Stage `n` greedy rows for a drafter: no penalties, mask or history, and no RNG use, so
* only the argmax runs. Draft output is a proposal checked by a greedy verifier
@@ -206,6 +217,26 @@ public:
* meaningful only where the row carries RAD_SP_MASK. */
const uint32_t* staged_mask(int64_t row) const { return mask_stage_ + row * mask_words_; }
int64_t mask_words() const { return mask_words_; }
/* Staged row `row`'s bound coupled state, as `run` uploads it: all-zero where the row carries
* none (bonus row, greedy row, uncoupled step). Lets a build be checked without a device. */
const RadMtpCoupleState& staged_couple(int64_t row) const { return couple_stage_[row]; }
/* Whether any row of the last build carries a bound state, i.e. whether `run` issues the
* verify op at all. Cleared by build_greedy: a gate for run(), not for evidence. */
bool staged_any_couple() const { return any_couple_; }
/* The verify op the last build resolved, for naming its kernel in a log line. */
rad_op staged_couple_op() const { return op_couple_; }
/* What build_step staged for the coupled verify. build_greedy, which runs between that build
* and the step's wait, clears any_couple_ but leaves this snapshot. */
struct CoupleBuild {
int64_t step = -1; /* the engine step this build staged */
int64_t rows = 0; /* bound rows */
/* The distinct sequences among them, with their bound rows. */
std::vector<std::pair<uint64_t, int64_t>> seqs;
};
const CoupleBuild& couple_build() const { return couple_build_; }
/* The engine step whose build run() last issued the verify op for, or -1. */
int64_t staged_couple_issued_step() const { return couple_issued_step_; }
private:
/* Whether the vocabulary is split, judged by this rank's logit width rather than the rank
@@ -224,6 +255,11 @@ private:
* newly committed tokens only. Read only when the request carries a thinking budget. */
ReasoningCount think;
size_t think_seen = 0;
/* --draft-coupling: the linear draft's per-round states for the window the scheduler
* published, bound by set_mtp_couple and consumed by build_step. `couple_n` is how many of
* `couple` are live; 0 for a request whose drafts carry no coupled proposal. */
RadMtpCoupleState couple[RAD_MTP_COUPLE_MAX_ROUNDS]{};
int couple_n = 0;
};
/* Mask staged row `row` to the reasoning block's close token, once the budget is spent
@@ -253,6 +289,7 @@ private:
rad_op op_argmax_ = RAD_NULL_HANDLE;
rad_op op_allgather_ = RAD_NULL_HANDLE;
rad_op op_merge_ = RAD_NULL_HANDLE; /* the candidate merge, under tensor parallel */
rad_op op_couple_ = RAD_NULL_HANDLE; /* --draft-coupling only */
rad_op op_logprobs_ = RAD_NULL_HANDLE; /* summary of the raw distribution */
rad_op op_lp_gather_ = RAD_NULL_HANDLE; /* every rank's summary, under a split vocabulary */
@@ -272,6 +309,12 @@ private:
rad_buf buf_pairs_ = RAD_NULL_HANDLE; /* this rank's candidates as (global id, logit) */
rad_buf buf_lp_ = RAD_NULL_HANDLE; /* sample_logprobs' stats, [rows, lp_width()] */
rad_buf buf_lp_g_ = RAD_NULL_HANDLE; /* and every rank's side by side */
rad_buf buf_couple_ = RAD_NULL_HANDLE; /* [rows, RAD_MTP_COUPLE_STATE_WORDS], flag only */
RadMtpCoupleState* couple_stage_ = nullptr; /* pinned, one row per sampled position */
bool couple_ = false; /* --draft-coupling */
bool any_couple_ = false; /* does any row this step carry a bound state? */
CoupleBuild couple_build_{}; /* what the last build_step staged, for the evidence line */
int64_t couple_issued_step_ = -1; /* step whose verify op run() last issued */
/* Pinned staging, allocated once at declare. */
DeviceSampleParams* params_stage_ = nullptr;