Archived
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).
80 lines
3.9 KiB
C++
80 lines
3.9 KiB
C++
/* geometry.h -- the prefill chunk geometry, computed from the resolved kernels.
|
|
*
|
|
* The attention block size comes from the resolved attention kernel (§7.2) and the linear-state
|
|
* chunk length from every resolved kernel that marks a parameter RAD_PROLE_SEQ_CHUNK, so the
|
|
* operator never has to supply a minimum --max-num-batched-tokens by hand (as vLLM requires for
|
|
* hybrid models). If the budget is below what the geometry needs, startup prints the number and
|
|
* refuses: a smaller budget means chunks never land on a checkpoint boundary and the linear
|
|
* prefix hit rate is zero.
|
|
*/
|
|
#pragma once
|
|
#include "rad_core.h"
|
|
|
|
namespace rad {
|
|
|
|
struct ChunkGeometry {
|
|
/* Attention block size, the lcm across every paged KV group. libr4d's paged attention is
|
|
* compiled for 16 only. */
|
|
int64_t attn_block = 1;
|
|
|
|
/* Tile length of a linear-state scan (64 for libr4d's gated delta net). Taken from the
|
|
* declared geometry and kernel constraints of every op whose schema marks a parameter
|
|
* RAD_PROLE_SEQ_CHUNK. */
|
|
int64_t state_chunk = 1;
|
|
|
|
/* lcm(attn_block, state_chunk); every non-final prefill chunk is a multiple of it, so no
|
|
* kernel is handed a partial tile. */
|
|
int64_t quantum = 1;
|
|
|
|
/* Linear-state checkpoint interval (§7.3): the operator's request rounded up to a multiple
|
|
* of `quantum`, so a split at the interval is a legal chunk split. Zero without linear state
|
|
* (see window_ckpt for the exception). */
|
|
int64_t checkpoint_interval = 0;
|
|
|
|
/* How many intervals one prefill chunk may carry from an interval boundary past the first
|
|
* (Config::prefill_span); 1 without an interval grid. plan_chunk is where it acts. */
|
|
int64_t span = 1;
|
|
|
|
/* The budget of every step a span does not take (prefill_shared_tok). A span is for a prefill
|
|
* alone in its step (Scheduler::step); a step carrying anything else is planned at this
|
|
* budget as a deployment without a span plans it, so the span's extra rows never lengthen a
|
|
* step other requests wait on. */
|
|
int64_t shared_tok = 0;
|
|
|
|
/* The smallest --max-num-batched-tokens this geometry can be served with. */
|
|
int64_t min_max_tok = 1;
|
|
|
|
/* Smallest upper bound a kernel places on the chunk length, or 0. Used only to report a
|
|
* contradiction with `quantum`, never to clamp. */
|
|
int64_t max_chunk = 0;
|
|
|
|
/* Every contributor by name, for the startup line and the refusal. */
|
|
std::string why;
|
|
|
|
/* No linear state but a sliding window: checkpoints snapshot the window behind an
|
|
* interval boundary or the prompt's tail (KVManager::has_window_snapshot). Intermediate
|
|
* snapshots let an edited prompt resume below its divergence instead of from zero.
|
|
* tip-only skips interval snapshots and keeps the original tail-only chunking. */
|
|
bool window_ckpt = false;
|
|
/* Window checkpoints at interval boundaries too, not only at the tail: every policy but
|
|
* tip-only, which keeps the tail alone and so splits no chunk at the interval. */
|
|
bool window_periodic = false;
|
|
|
|
bool checkpoints() const { return checkpoint_interval > 0; }
|
|
};
|
|
|
|
/* The budget of a step a span does not take (ChunkGeometry::shared_tok), from the configuration
|
|
* alone: --max-num-batched-tokens less the span's extra intervals, at least one interval, and the
|
|
* whole budget without a span. The engine states it to the plugin before declare
|
|
* (RadBuildCtx::max_mixed_tok) and the scheduler plans by it, so the two agree. */
|
|
int64_t prefill_shared_tok(const Config& cfg);
|
|
|
|
/* Resolve the geometry from the declared program and the operator's budgets.
|
|
*
|
|
* Returns RAD_E_INVAL when cfg.max_tok is too small (the required number is in
|
|
* out->min_max_tok, the reason in out->why; the caller stops), and RAD_E_SHAPE when two kernels'
|
|
* constraints contradict each other, which is a kernel-set bug. */
|
|
int chunk_geometry_resolve(const Program& prog, const Config& cfg, ChunkGeometry* out);
|
|
|
|
} /* namespace rad */
|