Archived
Radiance becomes a multi-model engine: one process serves several models behind one port, loads each when a request names it, parks it in host memory or restores it from its container, and shares the cards between them (docs/MULTIMODEL.md). The configuration is one YAML file; the command line flags are gone (`radiance --config FILE`, hot reload on SIGHUP). Formats. IQ8R (rotated int8) and IQR-V4 replace FP8 and MXFP4 as whole-model formats, with an int8 KV cache (`kv-cache-dtype: i8`) in place of the fp8 one. Containers whose weights are block FP8, MXFP4, M2XFP4, NVFP4 or ParoQuant are refused at startup by the name of the first such weight. Not served until they have int8 containers: GLM-5.3-Flash, Ornith-1.5, Sage-A1.5, Nemotron-3.5-Bolt-74B, Ling-3.0-flash, drama-3 and Anima's FP8 container; Nemotron-3.5-Bolt-E4B, the Gemma 4 31B DFlash containers and MiniCPM5-2B bf16 serve without their drafter. 1.17.0 serves all of them. Speed. Chained launches for Qwen3.8-27B, Gemma 4, Gemma 3 and the small bf16 models, a new Qwen3.8-Flash-Next container (IQR-V4 experts, int8 trunk) with its decode step and prefill reworked, and a reworked adaptive draft window. Deployment. deploy/compose has two fleet files, tp1.yaml and tp2.yaml, each with its configuration beside it, in place of the per-model files. `host-pool-mib` is a model's host pool in all, split among its ranks. The dashboard is rebuilt: an hour of history kept by the server, each accelerator's memory by model, model states over time. Merged since 1.17.0: Nemotron-3.5-Bolt-74B-A9B by keptn42 (#339); GLM-5.3-Flash on four cards by AnimusNull (#397); chained launches for Flash-Next's decode step (#396) and preempted requests keeping their prefix and place (#405) by mici81; --prefill-interleave auto by Code000 (#410); eight more libr3d kernels and the w4a4 reference by RikshaDriver (#403, #407, #408); libr3d large-BAR and E4M3 decode fixes by neuromanMD (#438, #439); int4/int5 decode tiles by Kezi (#426); attention for Nanbeige 4.3 33B by everplays (#417); expert_stats_report.py by baKon (#431). Fixed: #398, #402, #419, #437 (dschmitz's patch); added the metrics of #392, and multi-model serving as asked for in #367 and #109. Plugin ABI 39: out-of-tree plugins need to be rebuilt. Thanks to @keptn42, @AnimusNull, @mici81, @Code000, @RikshaDriver, @neuromanMD, @Kezi, @everplays, @baKon and @dschmitz.
80 lines
4.2 KiB
C++
80 lines
4.2 KiB
C++
/* bringup.h -- the engine side of a streamed group's bring-up (docs/KV-STREAMING.md §4.1).
|
|
*
|
|
* `--kv-resident N` is the only switch: absent or 0 nothing streams, and a ring that covers the
|
|
* group's context streams nothing either, so the group keeps the resident path at no cost. This
|
|
* module chooses the group, refuses what cannot stream, applies the ring's floors, gates the host
|
|
* mirrors against host RAM, fills the maps and reports, so core/engine_bringup.cpp makes one call
|
|
* at each seam.
|
|
*/
|
|
#pragma once
|
|
#include "mem/kv.h"
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace rad {
|
|
|
|
struct Config;
|
|
|
|
/* What --kv-resident resolved to. `group` is -1 when nothing streams; the other fields then say
|
|
* what was asked and why, for the report. */
|
|
struct KVStreamSetup {
|
|
int32_t group = -1; /* the group that streams; -1 when none does */
|
|
std::string group_name; /* the group that would have */
|
|
int64_t asked_tokens = 0; /* --kv-resident as given */
|
|
int64_t raised_tokens = 0; /* the ring a floor raised it to; 0 when not raised */
|
|
bool raised_by_union = false; /* raised to the decode-step bound, not the floor */
|
|
int64_t context_tokens = 0; /* --max-model-len x --max-num-seqs */
|
|
int64_t ring_tokens = 0; /* the carved ring, in tokens */
|
|
int64_t ring_blocks = 0; /* the carved ring, in blocks */
|
|
int64_t block_size = 0; /* the group's page, in tokens */
|
|
int64_t ctx_blocks = 0; /* the group's id space, in blocks */
|
|
int64_t stage_blocks = 0; /* the stage view's depth in blocks; 0 when none */
|
|
};
|
|
|
|
/* The host mirrors summed over the ranks; `max_rank_bytes` is the largest one rank pins (an uneven
|
|
* tensor-parallel split gives ranks different shards). */
|
|
struct KVStreamHostUse {
|
|
KVStreamCost sum;
|
|
int64_t max_rank_bytes = 0;
|
|
};
|
|
|
|
/* Whether `op` must not be declared: the streamed-only ops (kv_store_streamed, its folded form,
|
|
* kv_resolve) exist only for a carved ring, so a run that carves none must not have them in its
|
|
* graph. False when the architecture streams (RadBuildCtx::kv_stream_ok) and --kv-resident asks
|
|
* for a ring. Every architecture's rad_op_declared check then falls through to its resident path. */
|
|
bool kvstream_op_gated(const RadBuildCtx& ctx, const char* op);
|
|
|
|
/* Read --kv-resident against rank 0's declarations and fill `out`; RAD_OK with group -1 when
|
|
* nothing streams.
|
|
*
|
|
* - The group is kv_stream_group's. A ring that covers its context streams nothing.
|
|
* - An architecture with no streamed path for the group (kvstream_ops: no kv_resolve, or no
|
|
* streamed store) ignores the flag with one warning naming the missing op; `out` is then
|
|
* exactly the no-flag configuration.
|
|
* - A core dtype other than int8, bf16 or E4M3 is refused: the streamed store has rows for
|
|
* those only.
|
|
* - A ring below the decode-step bound or kStreamFloorTokens is raised, with one warning.
|
|
* --kv-resident itself is left as given; `out` holds both numbers for the report. */
|
|
int kvstream_configure(const Config& cfg, int64_t ctx, const std::vector<KVGroupInfo>& groups,
|
|
const Program& prog, KVStreamSetup* out);
|
|
|
|
/* Add one rank's stream_cost() to `use`. */
|
|
void kvstream_host_add(KVStreamHostUse* use, const KVManager& kv);
|
|
|
|
/* The host-RAM gate for the mirrors, checked once before any rank pins one. A mirror is one full
|
|
* context of the group per sequence per rank, the largest host allocation after the experts'
|
|
* pool, so it is checked against everything still to be pinned after it (`still`). A refusal
|
|
* names --max-model-len and --max-num-seqs, which size it; --host-pool-mib sizes the experts' pool
|
|
* and cannot make room here. */
|
|
int kvstream_host_gate(const KVStreamHostUse& use, int n_ranks, int64_t still, int64_t headroom);
|
|
|
|
/* After the carve: fill the maps on a bring-up stream and drain it. */
|
|
int kvstream_fill(KVManager& kv);
|
|
|
|
/* The startup lines: the raised ring, which group streams and what it took on both tiers, the
|
|
* stage, or which context a ring given by the flag covers. */
|
|
void kvstream_report(const KVStreamSetup& s, const KVStreamHostUse& host, int n_ranks);
|
|
|
|
} /* namespace rad */
|