Archived
radiance 1.7.0
- every model serves without a GPU: libavx covers every op, so `--kernels libavx` alone serves every shipped container - Qwen3-ASR (zivius): speech to text on /v1/audio/transcriptions and live over /v1/realtime - /v1/messages works with Claude Code as it ships (gearwave00001) - a long agent conversation keeps its cached history when the client rewrites its last turn (manueloverride) - a stream's first event goes out with the first token, so llama-benchy measures prefill right - opt-in --prefill-interleave (Smellyyyy, baKon) and --prefill-span (keptn42) - four-rank TP releases the link early; four-rank selftests and docs/TP4.md (goodman-b) - NVFP4 and FP8 compressed-tensors imports (devmilan); tools/rad-export for finetunes and LoRA adapters (baKon) - many fixes, among them lost tokens on stop strings under concurrency, keep-alive, MiniCPM5 tool arguments and the CPU's vision and audio encoders - plugin ABI 17 and changed op schemas: out-of-tree plugins must be rebuilt
This commit is contained in:
1 parent
b068190326
commit
1e968f6e1d
739 files changed
+128447
-84632
No files matched your search
+51
-63
@@ -1,16 +1,14 @@
|
||||
/* core/server/liveview.h -- the live view (spec §16).
|
||||
*
|
||||
* Per-card utilisation and VRAM, throughput, draft acceptance, and the expert plane coloured by
|
||||
* tier. It is a terminal view and nothing else: no web page, no port, no JSON.
|
||||
* tier. A terminal view only: no web page, no port, no JSON.
|
||||
*
|
||||
* The rule that shapes the implementation is the last sentence of §16 -- piped or redirected it
|
||||
* prints ordinary lines instead. So there are two renderers, chosen once by isatty(), and the
|
||||
* non-interactive one emits no escape sequence at all. A log file full of cursor-home sequences
|
||||
* is a log file you cannot grep, and the failure is silent: it looks fine on the terminal where
|
||||
* it was written.
|
||||
* Piped or redirected, it prints ordinary lines instead (spec §16). There are two renderers,
|
||||
* chosen once by isatty(), and the non-interactive one emits no escape sequences, so a log file
|
||||
* stays greppable.
|
||||
*
|
||||
* The view owns no data. A snapshot function supplied by the engine fills a LiveSnapshot; this
|
||||
* component only draws it, which keeps the server free of any device dependency.
|
||||
* The view owns no data: an engine-supplied snapshot function fills a LiveSnapshot and this only
|
||||
* draws it, which keeps the server free of any device dependency.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@@ -37,55 +35,50 @@ struct CardStat {
|
||||
double temp_c = 0.0; /* 0 = not sampled */
|
||||
};
|
||||
|
||||
/* rad::kTierCount, restated. This header deliberately does not include the program description --
|
||||
* a tier arrives here as a byte -- so the size is written out and liveview.cpp static_asserts the
|
||||
* two against each other. A fifth tier that fits in four slots is an out-of-bounds write that
|
||||
* costs nothing until it costs everything. */
|
||||
/* rad::kTierCount, restated so this header need not include the program description (a tier
|
||||
* arrives here as a byte). liveview.cpp static_asserts that the two agree, since the per-tier
|
||||
* arrays below are indexed by tier. */
|
||||
enum { kLiveTiers = 5 };
|
||||
|
||||
/* THE EXPERT PLANE, and what the placement engine has been doing to it.
|
||||
/* The expert plane and the placement engine's activity on it.
|
||||
*
|
||||
* The plane itself -- one cell per (layer, expert), valued by rad::Tier -- is the picture. The
|
||||
* counters beside it are the things the picture cannot say. Residency per tier says how much of
|
||||
* the model is actually in VRAM; the per-layer counts say whether that residency is SPREAD, since
|
||||
* a fill that walks the model in order can starve the last layers and the draft head while the
|
||||
* global count still looks healthy; and the move counters say whether the traffic on the link is
|
||||
* the engine discovering a working set or re-admitting what it just evicted.
|
||||
* The plane is one cell per (layer, expert), valued by rad::Tier. The counters say what the
|
||||
* picture cannot: residency per tier (how much of the model is in VRAM), per-layer counts
|
||||
* (whether residency is spread, since an in-order fill can starve the last layers and the draft
|
||||
* head while the global count looks healthy), and moves (whether link traffic is the engine
|
||||
* finding a working set or re-admitting what it just evicted).
|
||||
*
|
||||
* Counted ONCE, here, rather than by each renderer: the terminal view and the web page are two
|
||||
* drawings of the same snapshot and two independent tallies are two chances to disagree.
|
||||
* Counted once, here, so the terminal view and the web page draw the same tallies.
|
||||
*/
|
||||
struct ExpertPlane {
|
||||
int n_layers = 0;
|
||||
int n_experts = 0;
|
||||
std::vector<uint8_t> tier; /* row-major, size n_layers * n_experts */
|
||||
|
||||
/* Residency, by rad::Tier. Sized by kTierCount and not by 4: folding an unknown tier into the
|
||||
* SSD bucket would report a weight as on disk when it is not. `bytes` is this rank's shard,
|
||||
* which is the number that has to add up against the VRAM bar beside it. */
|
||||
/* Residency by rad::Tier, sized by the tier count so an unknown tier is never folded into the
|
||||
* SSD bucket. `bytes` is this rank's shard, which is what must add up against the VRAM bar. */
|
||||
int64_t units[kLiveTiers] = {0};
|
||||
int64_t bytes[kLiveTiers] = {0};
|
||||
int64_t n_units = 0; /* expert units in the plan; NOT n_layers * n_experts, which
|
||||
int64_t n_units = 0; /* expert units in the plan; not n_layers * n_experts, which
|
||||
* counts cells a ragged model never had */
|
||||
int64_t total_bytes = 0;
|
||||
int64_t movable = 0; /* how many of them the heat engine is allowed to relocate */
|
||||
|
||||
/* Per layer, so a starved layer is visible as a number and not only as a dark band. */
|
||||
/* Per layer, so a starved layer shows as a number, not only as a dark band. */
|
||||
std::vector<int32_t> layer_units;
|
||||
std::vector<int32_t> layer_resident;
|
||||
|
||||
/* What the mover did. Cumulative since start: a rate over a poll interval is the reader's
|
||||
* subtraction, and a counter is the only form that survives being read twice. */
|
||||
/* Mover activity, cumulative since start; readers take rates by subtracting two polls. */
|
||||
int64_t promotions = 0, demotions = 0;
|
||||
/* Is the churn PROGRESS or THRASH? Same move count, opposite meanings -- see HeatStats. */
|
||||
/* Separate progress from thrash at the same move count; see HeatStats. */
|
||||
int64_t distinct_promoted = 0, readmits = 0;
|
||||
/* Why a dispatch moved nothing. `refused` is the guard declining, which is the healthy steady
|
||||
* state; the starved counts are the mover having nowhere to put the bytes. */
|
||||
/* Why a dispatch moved nothing. `refused` is the guard declining (the healthy steady state);
|
||||
* the starved counts mean the mover had nowhere to put the bytes. */
|
||||
int64_t dispatches = 0, refused = 0, no_candidate = 0;
|
||||
/* DID THE ROUTER FIND THE EXPERT IN VRAM. `routed` is expert selections seen by the heat
|
||||
* engine and `routed_resident` the subset that was already there; the difference is what the
|
||||
* MoE GEMM had to stream across the link, which LinkStat::stream_bytes prices. A residency
|
||||
* percentage says how much of the model is close; this says how much of the WORK is. */
|
||||
/* Whether the router found the expert in VRAM. `routed` counts expert selections seen by the
|
||||
* heat engine, `routed_resident` the subset already resident; the difference was streamed
|
||||
* across the link (priced by LinkStat::stream_bytes). This measures how much of the work, not
|
||||
* of the model, is resident. */
|
||||
int64_t routed = 0, routed_resident = 0;
|
||||
int64_t no_record = 0, starved_slab = 0, starved_pool = 0, quarantined = 0;
|
||||
/* The prefill stager's copies (Mover::stage_units), rank 0: layers staged, units and bytes
|
||||
@@ -93,26 +86,23 @@ struct ExpertPlane {
|
||||
* the units. */
|
||||
int64_t stage_layers = 0, staged_units = 0, staged_bytes = 0, stage_overflow = 0;
|
||||
int64_t stage_copies = 0;
|
||||
/* HOW MUCH OF THE SLAB IS BORROWED. `flex_bytes` is what the slab holds in VRAM the KV cache
|
||||
* lent it; `flex_capacity` is how much the cache is lending right now. The pair is what says
|
||||
* whether the boundary between the two pools is moving, and whether what was lent is being
|
||||
* used -- a gap between them is lent VRAM holding nothing. */
|
||||
/* Slab VRAM borrowed from the KV cache: `flex_bytes` is what the slab holds in lent VRAM,
|
||||
* `flex_capacity` what the cache lends right now. A gap between them is lent VRAM holding
|
||||
* nothing. */
|
||||
int64_t flex_bytes = 0, flex_capacity = 0;
|
||||
bool heat_enabled = false; /* false = the plan is static and none of the above will move */
|
||||
};
|
||||
|
||||
/* WHAT IS ON THE INTERCONNECT, and in what proportion.
|
||||
/* Interconnect traffic by consumer.
|
||||
*
|
||||
* Three things share it and they are never discussed together: the tensor-parallel all-reduce,
|
||||
* which is a property of the model's width and the batch; the expert mover's promotions and
|
||||
* demotions, which are a property of the placement policy; and the MoE GEMM streaming an expert
|
||||
* the router asked for and placement had not put in VRAM, which is what the policy is spending
|
||||
* the moves to avoid. All three are cumulative byte counts from the same wall clock, so a reader
|
||||
* who subtracts two polls gets rates that can be compared -- which is the whole question "is the
|
||||
* link busy because the model is wide, or because placement is thrashing".
|
||||
* Three things share the link: the tensor-parallel all-reduce (set by model width and batch), the
|
||||
* expert mover's promotions and demotions (set by placement policy), and the MoE GEMM streaming a
|
||||
* routed expert that is not in VRAM (what the moves try to avoid). All are cumulative byte counts
|
||||
* on one clock, so rates from two polls compare directly: is the link busy because the model is
|
||||
* wide or because placement is thrashing?
|
||||
*
|
||||
* `ar_bytes` is the message payload summed over issues; Ctx::ar_bytes documents exactly what that
|
||||
* is and is not. `h2d`/`d2h` are the mover's own measured copy sizes.
|
||||
* `ar_bytes` is the message payload summed over issues (see Ctx::ar_bytes). `h2d`/`d2h` are the
|
||||
* mover's measured copy sizes.
|
||||
*/
|
||||
struct LinkStat {
|
||||
bool present = false; /* false when nothing measured any of it */
|
||||
@@ -120,19 +110,18 @@ struct LinkStat {
|
||||
int64_t ar_calls = 0, ar_bytes = 0;
|
||||
int64_t h2d_bytes = 0, d2h_bytes = 0;
|
||||
int64_t ssd_reads = 0, ssd_bytes = 0;
|
||||
/* The MoE GEMM reading a routed expert that was not resident. Not a move and not a
|
||||
* collective: the third consumer of the link, and the one a promotion is spent to remove. */
|
||||
/* The MoE GEMM reading a routed expert that was not resident: the traffic promotions aim to
|
||||
* remove. */
|
||||
int64_t stream_bytes = 0;
|
||||
int64_t prefetched = 0, prefetch_bytes = 0;
|
||||
/* The prefill stager's copies of the next layer's pooled experts (core/place/stager.h). Part
|
||||
* of `h2d_bytes`, like `prefetch_bytes`: the mover counts every copy it makes there, and a
|
||||
* reader that wants the promotions alone takes both out. */
|
||||
/* The prefill stager's copies of the next layer's pooled experts (core/place/stager.h).
|
||||
* Included in `h2d_bytes`, like `prefetch_bytes`; subtract both for promotions alone. */
|
||||
int64_t staged_bytes = 0;
|
||||
};
|
||||
|
||||
/* HOW THE RANKS RAN THEIR PASSES, summed over ranks: Ctx::PassCounts says what each is. A played
|
||||
* pass costs the host a packet copy; every other kind walks the architecture's issue path, so the
|
||||
* share that is not `played` is where a step's host time goes. */
|
||||
/* How the ranks ran their passes, summed over ranks (see Ctx::PassCounts). A played pass costs
|
||||
* the host a packet copy; every other kind walks the architecture's issue path, so the non-played
|
||||
* share is where a step's host time goes. */
|
||||
struct PassStat {
|
||||
bool present = false;
|
||||
int64_t played = 0, recorded = 0, audited = 0;
|
||||
@@ -143,8 +132,8 @@ struct PassStat {
|
||||
struct LiveSnapshot {
|
||||
int64_t step = 0;
|
||||
std::string model;
|
||||
/* Duplicated rather than referenced so that a snapshot is a value the drawing thread can hold
|
||||
* without racing the scheduler that produced it. */
|
||||
/* Copied, not referenced, so the drawing thread can hold a snapshot without racing the
|
||||
* scheduler. */
|
||||
int64_t waiting = 0, running = 0, preempted = 0;
|
||||
double kv_util = 0.0, prefix_hit_rate = 0.0;
|
||||
int64_t prefix_evictions = 0;
|
||||
@@ -163,8 +152,8 @@ class LiveView {
|
||||
public:
|
||||
using Source = std::function<void(LiveSnapshot&)>;
|
||||
|
||||
/* `out` defaults to stdout. `interval_ms` is the redraw period; 250 ms is fast enough to see
|
||||
* a stall and slow enough that the view costs nothing measurable. */
|
||||
/* `out` defaults to stdout. `interval_ms` is the redraw period; 250 ms shows a stall and
|
||||
* costs nothing measurable. */
|
||||
LiveView(Source src, int interval_ms = 250, FILE* out = nullptr);
|
||||
~LiveView();
|
||||
|
||||
@@ -172,8 +161,7 @@ public:
|
||||
void stop();
|
||||
|
||||
|
||||
/* Both renderers are public because they are the testable part: a snapshot in, a string out,
|
||||
* no terminal involved. */
|
||||
/* Public for tests: a snapshot in, a string out, no terminal involved. */
|
||||
std::string render_screen(const LiveSnapshot& s) const;
|
||||
std::string render_line(const LiveSnapshot& s) const;
|
||||
|
||||
|
||||
Reference in new issue
Block a user