Archived
radiance 1.9.0
New models: - LTX-2.5 (base and distilled): video with a stereo soundtrack from text or from text and a first frame, on one card, with its duration head, tiled VAE decoding, the diffusion decoder and the x2 latent upsampler - Krea 2 Raw and Turbo, and FLUX.3 [klein] and its base: text to image, and for FLUX.3 edits from up to ten reference pictures, on one card - GLM-5.3-Flash from AMD's Quark MXFP4 export, on eight cards (John McDonough, Nunze) - Gemma 3 / TranslateGemma 27B with an optional DFlash2 drafter (mici81) Engine: - --kv-cache-dtype fp8_v4 and k6_v4 for Gemma 3 and Qwen3.8-Flash-Next (mici81) - the rotated int8 trunk (i8a8h) for Qwen3.8-27B (eddie168168) - eight-rank all-reduce bands, weighted shards and pieces (Nunze); --host-headroom-mib (sfjes) - the dashboard shows the single-stream decode floor and its most recent window (Memoria) Fixes: prefix-cache reservations kept until their save lands (baKon), tool calls in Responses namespaces (#119), system messages merged when a template refuses several (#137), a prefill continued with no open step (#127), calibration of a Gram accumulation (#122), JSON Schema patterns read unanchored (davetha), GLM-style tool calls, the KV floor counting every sequence's state. Plugin ABI 24.
This commit is contained in:
1 parent
778cbf315e
commit
685ec5bd85
136 files changed
+18917
-3821
No files matched your search
+34
-72
@@ -51,19 +51,10 @@ struct SchedMetrics {
|
||||
int64_t step_ns = 0;
|
||||
int64_t step_ns_decode = 0;
|
||||
|
||||
/* The single-sequence decode floor, nanoseconds; 0 until a window of eligible steps fills.
|
||||
* A min over WINDOW MEANS of single-sequence decode steps (see DecodeFloor), not over raw
|
||||
* brackets -- a raw min latches a degenerate bracket forever. Single-sequence on purpose: a
|
||||
* decode step at eight sequences is a different measurement, so keying the floor to one row
|
||||
* keeps a batch arriving from being misread as drift. Scheduler::step_finished feeds DecodeFloor. */
|
||||
/* The single-sequence decode floor and the most recent window, nanoseconds: both window means
|
||||
* of single-sequence decode steps (DecodeFloor), 0 until a gated window completes. A decode
|
||||
* step at more sequences is a different measurement and does not count. */
|
||||
int64_t step_ns_decode_best = 0;
|
||||
|
||||
/* The most recent completed window mean of single-sequence decode steps, nanoseconds; 0 until
|
||||
* the first gated window completes. The advisory's OTHER side: best() is how fast the engine
|
||||
* has ever been, recent() is how fast it is now, and both are window means of the same stream
|
||||
* at the same size -- so they cannot disagree by order statistics the way the engine's floor
|
||||
* disagreed with the browser's per-poll min (7.7% phantom drift on a flat lane, 2026-10-18).
|
||||
* Scheduler::step_finished records it. */
|
||||
int64_t step_ns_decode_recent = 0;
|
||||
|
||||
/* Per KV group. `name` points into the Program, which outlives any scrape. */
|
||||
@@ -147,84 +138,55 @@ struct SchedMetrics {
|
||||
};
|
||||
|
||||
|
||||
/* Estimator for the single-sequence decode floor (SchedMetrics::step_ns_decode_best).
|
||||
*
|
||||
* A min over RAW step brackets is unbounded below: a decode step issued ahead behind a step with
|
||||
* long host work (a prefill chunk, or a decode step that saves a KV checkpoint) has its forward
|
||||
* pass finished before its own bracket opens, so the bracket holds only readback and commit --
|
||||
* about a millisecond, no GPU work. A min latches that degenerate on the first occurrence and
|
||||
* never recovers. Measured live 2026-10-18: floor 1.34 ms against a 15.70 ms mean, after which
|
||||
* the dashboard's restart advice read "heavily drifted, pays back fast" on a healthy engine --
|
||||
* a systematically wrong advisory, worse than none, because it recommends a restart that cannot
|
||||
* help.
|
||||
*
|
||||
* The fix mirrors the construction the dashboard already proves clean on this lane: a min over
|
||||
* WINDOW MEANS, not over raw samples. Each full window of single-sequence decode steps
|
||||
* contributes one mean; a degenerate is diluted by the honest steps sharing its window, so the
|
||||
* floor tracks the real floor. Two biases on that floor partially cancel: a window MEAN sits
|
||||
* above the true floor (it averages, so it cannot reach a lone fast step), while min-over-windows
|
||||
* picks the window with the most degenerates and pulls back down. A simulation of the live lane
|
||||
* (real ~15.9 ms, true floor ~14.4 ms, degenerate ~1.34 ms) puts the estimate at 14.3 ms median
|
||||
* at the observed ~1.4% degenerate rate, worst case ~13.6 ms -- within a few percent of the true
|
||||
* floor, and never the 12x latch of the raw min. The residual can sit slightly BELOW the true
|
||||
* floor (a degenerate-heavy window), which mildly OVER-reports drift; it is bounded and small,
|
||||
* not the unbounded latch. kWindow is a structural count of samples to average, not a magic
|
||||
* threshold a real step could fall below. Scheduler::step_finished feeds it one update per
|
||||
* single-sequence decode step. */
|
||||
/* Estimator for the single-sequence decode floor (SchedMetrics::step_ns_decode_best): a min over
|
||||
* window means, not over raw step brackets. A decode step issued ahead behind a step with long
|
||||
* host work (a prefill chunk, a KV checkpoint save) has its forward pass finished before its own
|
||||
* bracket opens, so the bracket holds only readback and commit, about a tenth of a real step; a
|
||||
* raw min would latch that forever. Such brackets are rejected before they enter a window, and the
|
||||
* window mean dilutes what remains. */
|
||||
struct DecodeFloor {
|
||||
/* Single-sequence decode steps averaged into one floor candidate. 32 approximates the number
|
||||
* of decode steps the dashboard's 500 ms poll spans at this lane's step time, so the engine
|
||||
* floor and the page's own c1 floor are computed over comparable windows. */
|
||||
/* Steps averaged into one floor candidate: about what the dashboard's 500 ms poll spans at a
|
||||
* single-sequence step, so the engine's floor and the page's are over comparable windows. */
|
||||
static constexpr int kWindow = 32;
|
||||
static constexpr int64_t kHorizon = 8 * kWindow;
|
||||
|
||||
void update(int64_t ns) {
|
||||
/* Reject degenerate brackets BEFORE they enter a window. A decode step issued ahead behind
|
||||
* a long host commit (a prefill chunk, or a KV checkpoint every 256 tokens) brackets at
|
||||
* ~9% of a real step; real single-sequence steps bracket at ~96%. The populations are ~10x
|
||||
* apart, so any threshold between them separates them -- 0.5 is the midpoint of that gap,
|
||||
* not a value tuned to one distribution. Filtering at the STEP level is essential: at the
|
||||
* observed ~1.4% rate a degenerate dilutes inside a 32-step window to a mean of ~0.91x,
|
||||
* which no window-level threshold would catch, and a min over hundreds of windows then
|
||||
* reliably lands on a degenerate-heavy window ~10% below the true floor.
|
||||
* No rejection until a window's worth of samples has been accepted, so the running mean is
|
||||
* never bootstrapped from a degenerate. */
|
||||
if (accepted_ >= kWindow && ns * 2 < mean_) return;
|
||||
++accepted_;
|
||||
mean_ += (ns - mean_) / (double)accepted_;
|
||||
/* A degenerate bracket is ~0.09 of a real step and a real one ~0.96 of the mean, so half
|
||||
* the reference separates them. The reference is a running mean over every step, the
|
||||
* rejected ones included, with a horizon of kHorizon steps: degenerates are rare enough to
|
||||
* barely move it, and when the real step gets faster (a slow warm-up, a shorter context)
|
||||
* it follows instead of rejecting every later step. No rejection until a window's worth
|
||||
* of samples has been seen. */
|
||||
++seen_;
|
||||
mean_ += (ns - mean_) / (double)(seen_ < kHorizon ? seen_ : kHorizon);
|
||||
if (seen_ > kWindow && ns * 2 < mean_) return;
|
||||
sum_ += ns;
|
||||
if (++count_ < kWindow) return;
|
||||
const int64_t mean = sum_ / count_;
|
||||
/* The FIRST window is recorded by neither side. The rejection gate needs a window's worth
|
||||
* of accepted samples before it can judge one, so the first window is by construction
|
||||
* un-gated and can carry degenerates; recording it would let the floor latch a value the
|
||||
* engine can no longer reach -- the same artifact the gate exists to remove, smuggled in
|
||||
* through bootstrap. Measured: at a 5% degenerate rate the un-gated first window put the
|
||||
* floor ~2% below the true floor and it stuck there forever. */
|
||||
/* The first window ran before the gate could judge and may carry degenerates, so it is
|
||||
* recorded by neither side. */
|
||||
if (warmed_) {
|
||||
if (best_ == 0 || mean < best_) best_ = mean;
|
||||
recent_ = mean; /* most recent completed window, same size as best_ */
|
||||
recent_ = mean;
|
||||
}
|
||||
warmed_ = true;
|
||||
sum_ = 0;
|
||||
count_ = 0;
|
||||
}
|
||||
/* The floor: the fastest window mean ever seen. A restart is priced against this. */
|
||||
/* The fastest window mean seen. */
|
||||
int64_t best() const { return best_; }
|
||||
/* The CURRENT speed: the most recent completed window mean, from the SAME stream and window
|
||||
* size as best(). The advisory compares best() against recent() -- both window means of one
|
||||
* population -- so the two sides cannot disagree by order statistics the way the engine's
|
||||
* floor disagreed with the browser's per-poll min (a 7.7% phantom gap on a flat lane,
|
||||
* 2026-10-18). 0 until the first window completes; the page must not divide by it. */
|
||||
/* The most recent completed window mean, from the same stream and window size as best();
|
||||
* 0 until the first gated window completes. */
|
||||
int64_t recent() const { return recent_; }
|
||||
|
||||
private:
|
||||
int64_t sum_ = 0;
|
||||
int count_ = 0; /* samples in the window being accumulated */
|
||||
int64_t best_ = 0;
|
||||
int64_t recent_ = 0;
|
||||
bool warmed_ = 0; /* false until one window has completed (the un-gated bootstrap) */
|
||||
int64_t accepted_ = 0; /* samples accepted across all windows (rejection gate's support) */
|
||||
double mean_ = 0.0; /* running mean of ACCEPTED steps -- the rejection reference */
|
||||
int64_t sum_ = 0;
|
||||
int count_ = 0; /* samples in the window being accumulated */
|
||||
int64_t best_ = 0;
|
||||
int64_t recent_ = 0;
|
||||
bool warmed_ = false; /* one window has completed */
|
||||
int64_t seen_ = 0; /* samples seen, rejected ones included */
|
||||
double mean_ = 0.0; /* the rejection reference */
|
||||
};
|
||||
|
||||
} /* namespace rad */
|
||||
@@ -1599,7 +1599,10 @@ const RadBatch* Scheduler::step() {
|
||||
/* ------------------------------------------------------------------ media */
|
||||
bool Scheduler::prefill_continues() const {
|
||||
std::lock_guard<std::mutex> lk(mu_);
|
||||
if (stage_rows_ <= 0) return false;
|
||||
/* Only the step being released has a plan to read. Between a commit and the next step (an
|
||||
* encoder pass is prepared there) `plan_` is the committed step's, whose requests in_step() no
|
||||
* longer holds: a cancel and reap may have released one (#127). */
|
||||
if (stage_rows_ <= 0 || !step_open_) return false;
|
||||
/* The next step is held to decode rows (--prefill-interleave): experts staged for a chunk now
|
||||
* would be dropped by that step. */
|
||||
if (interleave_left_ > 0) return false;
|
||||
@@ -2010,13 +2013,8 @@ void Scheduler::step_finished() {
|
||||
m_.step_ns += ns;
|
||||
if (plan_.phase == RAD_PHASE_DECODE) {
|
||||
m_.step_ns_decode += ns;
|
||||
/* The single-sequence floor, keyed to the concurrency of THIS step (plan_.n_seq_decode is
|
||||
* the row count that was just timed, not a later snapshot). A mixed step is excluded by the
|
||||
* phase gate even when it carries one decode row: its lone row shares the step with a
|
||||
* prefill chunk and is not the mechanical floor. The estimator is a min over WINDOW MEANS,
|
||||
* not raw brackets: a decode step issued ahead behind a long host commit has no GPU work
|
||||
* in its bracket, and a raw min latches that degenerate forever; averaging a window of
|
||||
* single-row steps first dilutes it. See rad::DecodeFloor. */
|
||||
/* The single-sequence floor over the step just timed (rad::DecodeFloor). A mixed step
|
||||
* never counts: its decode row shares the step with a prefill chunk. */
|
||||
if (plan_.n_seq_decode == 1) {
|
||||
decode_floor_.update(ns);
|
||||
m_.step_ns_decode_best = decode_floor_.best();
|
||||
|
||||
@@ -604,9 +604,7 @@ private:
|
||||
* covered, both decayed with the same time constant, so their ratio is tokens over time. */
|
||||
double tps_win_prefill_ = 0.0, tps_win_decode_ = 0.0, tps_win_time_ = 0.0;
|
||||
bool step_open_ = false;
|
||||
/* Estimator for the single-sequence decode floor (see rad::DecodeFloor). Replaces a raw min
|
||||
* over step brackets, which latched a degenerate bracket forever (live defect 2026-10-18:
|
||||
* 1.16 ms against a 15.55 ms mean). step_finished feeds it each single-sequence decode step. */
|
||||
/* The single-sequence decode floor (rad::DecodeFloor), fed by step_finished. */
|
||||
DecodeFloor decode_floor_;
|
||||
|
||||
/* arrival; mu_ held */
|
||||
|
||||
Reference in new issue
Block a user