Archived
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:
commit
6645337f69
198 files changed
+20904
-3240
No files matched your search
+84
-53
@@ -23,52 +23,34 @@ typedef struct RadCtx RadCtx;
|
||||
enum { RAD_PHASE_PREFILL = 0, RAD_PHASE_DECODE = 1, RAD_PHASE_MIXED = 2 };
|
||||
|
||||
/* ================================================================== KV streaming */
|
||||
/* A streamed KV group keeps its whole context in pinned host memory and only a ring of blocks on
|
||||
* the card (docs/KV-STREAMING.md §3.2, §3.6, §4.2). The step batch carries this view of that
|
||||
* group; a group whose KV is fully resident has none.
|
||||
/* A streamed KV group keeps its whole context in pinned host memory and a ring of blocks on the
|
||||
* card (docs/KV-STREAMING.md). The step batch points every group that streams at this view, which
|
||||
* is fixed from bring-up (so a recorded pass replays a resolve); a resident group's is null.
|
||||
*
|
||||
* Why one pointer to a struct rather than fields inside RadKVGroupBatch: the data is per group
|
||||
* and fixed at bring-up, while the batch is rebuilt per step for every rank, so copying its
|
||||
* pointers and geometry per group into every step's batch would be work that never changes. One
|
||||
* trailing pointer also keeps a group's own layout as it was for every plugin that does not
|
||||
* stream: the field is zero-defaulted, and a null `stream` means the group is fully resident and
|
||||
* has no ring, no map and no host copy.
|
||||
*
|
||||
* The layout mirrors the pool, layer by layer: a layer's mirror is a dense run of `blocks` rows
|
||||
* of `block_bytes`, and `host_layer_stride` is `blocks * block_bytes`. So layer l's row for block
|
||||
* b is at `host + l * host_layer_stride + b * block_bytes`, and `block_bytes` is both the row
|
||||
* pitch `kv_resolve` reads the mirror at and the length of every copy into the ring.
|
||||
*
|
||||
* `res`, `slot_block`, `slot_state` and `ctl` are device memory: a resolve launch reads and
|
||||
* rewrites them every step, so a host round trip per lookup would cost the link latency the ring
|
||||
* exists to avoid. Nothing here changes address for the engine's life, which is what lets a
|
||||
* recorded pass replay a resolve. */
|
||||
* The mirror is laid out like the pool, layer by layer: layer l's row for block b is at
|
||||
* `host + l * host_layer_stride + b * block_bytes`. `res`, `slot_block`, `slot_state` and `ctl`
|
||||
* are device memory, read and rewritten by every resolve launch. */
|
||||
typedef struct RadKVStream {
|
||||
/* The group's mirror, pinned host memory, RAD_MEM_HOST_MAPPED so a device kernel reads it over
|
||||
* the link in place. `blocks * bytes_per_block` bytes, all layers, zeroed at bring-up: a block
|
||||
* no store has written yet reads as zeros rather than as whatever the page held. */
|
||||
/* The mirror: pinned host memory a kernel reads over the link in place, every layer, zeroed at
|
||||
* bring-up. */
|
||||
uint8_t* host;
|
||||
/* Residency, both directions, ONE SLICE A LAYER: `res` is block -> ring slot or -1 (device,
|
||||
* `n_layers * blocks` entries, layer l at `res + l * blocks`), `slot_block` is slot -> block or
|
||||
* -1 (`n_layers * slots`), `slot_state` is `n_layers * slots * 2`: the epoch of a slot's last
|
||||
* use and its CLOCK reference bit. A block is resident per layer because the resolve copies one
|
||||
* layer's bytes; a group-wide map would call a block resident for a layer that was never
|
||||
* copied. `ctl` is shared: its counters and overflow latch are the group's. */
|
||||
/* Residency, one slice a layer: `res` is block -> ring slot or -1 (layer l at `res + l *
|
||||
* blocks`), `slot_block` is slot -> block or -1, `slot_state` is [slots, 2]: the epoch of a
|
||||
* slot's last use and its CLOCK reference bit. Per layer, because the resolve copies one
|
||||
* layer's bytes. */
|
||||
int32_t* res;
|
||||
int32_t* slot_block;
|
||||
int32_t* slot_state;
|
||||
/* The control block: epoch, clock hand, the last launch's miss count, the overflow latch, and
|
||||
* the cumulative misses/lookups/calls counters (docs/OPS.md "kv_resolve"). */
|
||||
/* The group's control block: epoch, clock hand, the last launch's miss count, the overflow
|
||||
* latch and cumulative counters (docs/OPS.md "kv_resolve"). */
|
||||
int32_t* ctl;
|
||||
/* Bytes one block of ONE layer occupies: the mirror's row pitch and the ring's slot pitch. */
|
||||
/* Bytes one block of one layer occupies: the mirror's row pitch and the ring's slot pitch. */
|
||||
int64_t block_bytes;
|
||||
/* Bytes one layer of the mirror occupies, i.e. the distance between layer l and layer l+1. */
|
||||
/* Bytes between one layer's mirror and the next. */
|
||||
int64_t host_layer_stride;
|
||||
/* Ring depth in blocks: the group's device pool is `slots` blocks deep while a selection names
|
||||
* block ids over the group's whole context. */
|
||||
/* The ring's depth in blocks; a selection names block ids over the whole context. */
|
||||
int64_t slots;
|
||||
/* Bytes the host mirror occupies, all layers (`blocks * block_bytes * n_layers`), so a caller
|
||||
* that only has this view can report or check the off-card tier. */
|
||||
/* The whole mirror's bytes, every layer. */
|
||||
int64_t host_bytes;
|
||||
} RadKVStream;
|
||||
|
||||
@@ -86,9 +68,7 @@ typedef struct RadKVGroupBatch {
|
||||
int64_t state_index_pitch;
|
||||
int64_t block_size;
|
||||
int64_t max_blocks;
|
||||
/* Null unless this group's KV streams: the mirror, the residency map and the ring's geometry
|
||||
* (RadKVStream above). Trailing and zero-defaulted, so a plugin built against ABI 25 reads
|
||||
* every field it knows at the same offset and simply never sees the ring. */
|
||||
/* Null unless this group streams (RadKVStream). Trailing and zero-defaulted. */
|
||||
const RadKVStream* stream;
|
||||
} RadKVGroupBatch;
|
||||
|
||||
@@ -593,8 +573,11 @@ enum {
|
||||
* ADECODE no rows of the pass's own.
|
||||
* VDECODE `dec_rows` rows of the decoder's own (rad_arch_video_positions, RAD_VPOS_DECODE).
|
||||
* VUPSCALE no rows of the pass's own: the lane's video latent from `geom_from` to `geom`.
|
||||
* VENCODE no rows of the pass's own: a picture's or a video's frames in `enc_pixels`.
|
||||
* AENCODE no rows of the pass's own: a soundtrack's samples in `enc_samples`.
|
||||
*
|
||||
* Every pointer is device memory unless the name ends in _h. */
|
||||
|
||||
typedef struct RadVideoGenBatch {
|
||||
int32_t lane;
|
||||
RadVideoGeom geom; /* the request's geometry */
|
||||
@@ -603,9 +586,10 @@ typedef struct RadVideoGenBatch {
|
||||
/* The same lane, i32 [1], and 1 on a request's first step (0 otherwise), i32 [1]. */
|
||||
const int32_t* lane_d;
|
||||
const int32_t* first_d;
|
||||
/* i32 [4]: the packed sequence's segments, {0, n_text, n_text + audio rows, n_tok} -- text,
|
||||
* soundtrack, video -- and i32 [4] {0, video rows, 0, audio rows}, the bounds of the lane's two
|
||||
* latents counted from each one's first row. */
|
||||
/* i32: the packed sequence's segment boundaries, {0, n_text, n_text + audio rows, n_tok} --
|
||||
* text, soundtrack, video -- or rad_arch_video_pack's for a request with references; and i32
|
||||
* [4] {0, video rows, 0, audio rows}, the bounds of the lane's two latents counted from each
|
||||
* one's first row. */
|
||||
const int32_t* seg_cu;
|
||||
const int32_t* lat_cu;
|
||||
|
||||
@@ -616,7 +600,8 @@ typedef struct RadVideoGenBatch {
|
||||
|
||||
/* ---- VSTEP */
|
||||
int32_t step; /* from 0; the first draws the lane's noise */
|
||||
/* f32 [6]: the video's timestep, sigma and next sigma, then the soundtrack's. */
|
||||
/* f32 [16]: the video's timestep, sigma and next sigma, then the soundtrack's; from [6] the
|
||||
* res_multistep scalars of the video, then of the soundtrack (`sampler`, below). */
|
||||
const float* sched;
|
||||
const float* pos; /* f32 [3, n_tok]: RAD_VPOS_STEP */
|
||||
/* u32 [2, 2]: the video's noise seed and the soundtrack's, low word first (VSTEP, VUPSCALE and
|
||||
@@ -656,8 +641,55 @@ typedef struct RadVideoGenBatch {
|
||||
/* VDECODE: the decoder the request named (RadVideoGenDecl::decoders), its index; 0 the
|
||||
* default. */
|
||||
int32_t decoder;
|
||||
|
||||
/* ---- appended in ABI 31 (rad_builder.h, "Reference conditioning") */
|
||||
/* The sampler a VSTEP advances the latents with: RAD_SAMPLER_EULER, the first-order step on
|
||||
* sched[0..5], or RAD_SAMPLER_RES_MULTISTEP, the second-order one on the clean estimate
|
||||
* (k-diffusion's res_multistep at eta 0), which keeps the previous step's estimate. Its scalars
|
||||
* are sched[6..10] for the video and sched[11..15] for the soundtrack: sigma, r = next sigma /
|
||||
* sigma, the weights hb1 and hb2 of this step's estimate and the previous one, and the order,
|
||||
* 1 where there is no previous estimate on the same grid. */
|
||||
int32_t sampler;
|
||||
/* VENCODE: f32 [enc_frames, enc_height, enc_width, 3] RGB in 0..255, the frames padded to
|
||||
* whole clips by repeating the last (rad_arch_encode_geom's entry 23). AENCODE: f32
|
||||
* [enc_channels, enc_n_samples], each channel padded with zeros to the hop (entry 0). Both:
|
||||
* the pass's geometry as rad_arch_encode_geom gave it, i32 on the device, and the media's
|
||||
* kind (RAD_ENC_*, below) and its number within the kind from 1. */
|
||||
const float* enc_pixels;
|
||||
int32_t enc_frames, enc_height, enc_width;
|
||||
const float* enc_samples;
|
||||
int64_t enc_n_samples;
|
||||
int32_t enc_channels;
|
||||
const int32_t* enc_geom_d;
|
||||
int32_t enc_kind, enc_slot;
|
||||
/* VCOND and VSTEP of a request with reference media or keyframes: their table, host i32, null
|
||||
* without. [0] the references, [1] the keyframes, then 6 words a reference {kind, slot, latent
|
||||
* height, latent width, latent frames, soundtrack latents} in presentation order and 3 a
|
||||
* keyframe {frame, latent frames, soundtrack latents}, then the prompt's vision pads: a count
|
||||
* and {first token, tokens} of each picture's run. A reference's kind is RAD_VREF_PICTURE,
|
||||
* _AUDIO or _VIDEO; its slot is its encode pass's. */
|
||||
const int32_t* ref_tab;
|
||||
/* VSTEP: i32, rad_arch_video_pack's `mod`: the boundaries of the modulation groups, then the
|
||||
* cell each reads; `seg_cu` then holds the segment boundaries. A request without references
|
||||
* stages `seg_cu`'s four and no cells. */
|
||||
const int32_t* mod_cu;
|
||||
} RadVideoGenBatch;
|
||||
|
||||
enum { RAD_SAMPLER_EULER = 0, RAD_SAMPLER_RES_MULTISTEP = 1 };
|
||||
|
||||
/* RadVideoGenBatch::enc_kind: the media an encode pass carries, numbered from 1 within a kind. A
|
||||
* keyframe is 1 for the first frame and 2 for the last. */
|
||||
enum {
|
||||
RAD_ENC_IMAGE = 1, /* a reference picture; Vencode */
|
||||
RAD_ENC_VIDEO = 2, /* a reference video; Vencode */
|
||||
RAD_ENC_VAUDIO = 3, /* the soundtrack of reference video `enc_slot`; Aencode */
|
||||
RAD_ENC_AUDIO = 4, /* a standalone soundtrack; Aencode */
|
||||
RAD_ENC_KEYFRAME = 5 /* a first or last frame; Vencode */
|
||||
};
|
||||
|
||||
/* RadVideoGenBatch::ref_tab: a reference's kind. */
|
||||
enum { RAD_VREF_PICTURE = 0, RAD_VREF_AUDIO = 1, RAD_VREF_VIDEO = 2 };
|
||||
|
||||
/* RadVideoGenBatch::geom_d. The request's latent geometry, then a VDECODE pass's chunk: the latent
|
||||
* frames it reads (from latent frame `chunk_lat0`), its latent grid again so that (frames, h, w,
|
||||
* first, last) is one run, and the same chunk in patches. */
|
||||
@@ -780,19 +812,18 @@ int rad_step_fail(RadCtx* c, const char* what);
|
||||
|
||||
/* ================================================================== run-phase queries */
|
||||
const RadBatch* rad_batch(RadCtx* c);
|
||||
/* The position of absolute model layer `layer` in the cache `group` holds, or -1 when this rank
|
||||
* has no pool for it or the group does not hold that layer. It is the same lookup a RAD_KV operand
|
||||
* makes (KVPoolBinding::layer_slot), and the index a streamed group's host mirror is laid out by:
|
||||
* layer `i` of the group is at `stream->host + i * stream->host_layer_stride`. A group's bound
|
||||
* layers need not be contiguous, so this is never `layer` itself. */
|
||||
/* The position of model layer `layer` among `group`'s bound layers, or -1 when this rank has no
|
||||
* pool for it or the group does not hold the layer: the lookup a RAD_KV operand makes, and the
|
||||
* index of the layer's host mirror row. Bound layers need not be contiguous. */
|
||||
int rad_kv_layer_index(RadCtx* c, rad_kvgroup group, int layer);
|
||||
/* Prefill staging (docs/KV-STREAMING.md §4.1). When the group's pass selected the one-layer stage
|
||||
* view, copy this layer's whole host-mirror row into it, on the compute stream, after the layer's
|
||||
* store and before its attention; returns 1 and the caller must not resolve. Returns 0 when the
|
||||
* group has no stage view (a resident group, or the parity configuration's context-sized ring) and
|
||||
* the caller proceeds normally. The ordering rule is in core/kvstream/stage.h. */
|
||||
/* Prefill staging of a streamed group (the ordering rule is in core/kvstream/stage.h).
|
||||
* rad_kv_stage_layer, before the layer's store: when the pass uses the one-layer stage view, make
|
||||
* the layer's mirror row whole in it (once a pass) and return 1, after which the caller reads
|
||||
* block ids directly and must not resolve; 0 when the group has no stage view.
|
||||
* rad_kv_stage_next, after every attention launch of the layer: start the next layer's copy. */
|
||||
int rad_kv_stage_layer(RadCtx* c, rad_kvgroup group, const RadKVGroupBatch* kvb,
|
||||
int layer);
|
||||
int rad_kv_stage_next(RadCtx* c, rad_kvgroup group, int layer);
|
||||
int rad_rank(RadCtx* c);
|
||||
int rad_world_size(RadCtx* c);
|
||||
RadStream rad_stream(RadCtx* c);
|
||||
|
||||
Reference in new issue
Block a user