Archived
4e35a004933abe555b137678b8f91c398776bfa8
783
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4e35a00493 |
sched_test: assert the slot reuse the recycled-slot case depends on
The case that guards the admitted_us reset read two timing inequalities and never checked that the second request landed in the first request's slot. It rests on that: if the reap defers, or the free list is pre-populated, the second request gets a fresh struct, the stale stamp is absent by construction, and the invariant holds with the bug unpatched. A test whose precondition is a property of the fixture rather than an assertion goes quiet without saying so, which is worse than not having it. Read the slot from the published row before the reap and assert it afterwards. This also settles the one thing the review could not: whether the reap releases immediately or defers. It releases, because the assertion holds -- proven by running it rather than by reading the ahead-step planning that decides it. Verified: the case passes, and removing the reset line still fails it, so the added assertion did not blunt it. sched_test 62646 checks over 184 cases, no failures. Found by an independent review pass on the fix itself. Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI |
||
|
|
e53286cdbe |
dashboard: the history figures mean what their labels say
Five changes to one leg, committed together because they are one claim: a number on the dashboard should be readable as the thing it is named for. They were deployed as 1.15.1-histfix without being committed, so the running engine carried code no commit described, and a review of the working tree could not see its own context. History labels. "avg" becomes "mean", the window figures appear only once enough rows exist to be the window they name, ttft says median, and every history column carries a title= spelling out what it averages and over what. A legend that has to be inferred from a column header gets inferred wrong. The prefill instrument. The history computed prefill speed as prompt tokens over time-to-first-token, which charges queue wait to prefill; GUIDE:2808 warns against exactly that formula. The scheduler now stamps admission and reports prefill_s, so the column measures admission to first token. The page falls back to ttft when an engine reports no admission time, so it still works against a stock build. Windows in seconds. Every displayed window was a sample count, so "60s" meant 60 samples and its span drifted with the poll rate: 60s at 500 ms, 6s at 100 ms. The rings now prune by accumulated time and the sparkline's x axis is time-proportional rather than sample index, so a busy stretch gets the room its seconds deserve and a gap in the samples shows as a gap in the line. This is the precondition for the interval control below; at a fixed rate the two agree, so a full ring draws exactly as before. The interval control. An Advanced view with two editable fields, idle and busy, held in localStorage: the cadence belongs to whoever is reading, not to what is serving, and the server has no writable config that would survive an image swap. Both are plain numbers rather than a mode switch, because the point is that the reader sets the rate; equal values are one fixed rate and the summary says so. Wind-down. The tile detail lines now sample on every poll, so "recent" follows the engine's own idle decay instead of holding the last figure it saw, and a window older than its own span is cleared rather than drawn as if continuous. Fixes from an independent review on qwen, which found the first two: admitted_us was never reset when a slot was recycled. add_locked only allocates when the slot's pointer is null, so the struct survives release_locked with every field it does not list intact, and the first-admission guard then kept the previous request's stamp. The interval spans two requests, the stale stamp is always older, so prefill tok/s reads low rather than missing. It reaches every row once the slot pool turns over. It feeds only this one dashboard column: the engine-wide prefill tile uses an independent windowed counter, and no admission, eviction, preemption or KV path reads the field. Two tooltips still said prefill includes queue wait after the instrument stopped charging it. Both now say what the code does and disclose the fallback, since one window can mix rows measured from admission with rows fallen back to ttft. Verified: both targets build clean. dashboard_test 241 checks over 8 cases, sched_test 62644 over 184, no failures. The new sched_test case drives submit, finish, reap and a second submit onto the recycled slot and asserts prefill_s never exceeds ttft_s, since admission cannot precede arrival; it fails against the bug and passes after the fix, so it can fail. The embedded page parses under node --check, and 30 checks now execute the shipped spark(), the clamp and the cadence trigger sliced out of the page rather than restated: time-proportional spacing, the right-edge fill at startup, a sample gap drawn as a line gap, the 100 ms floor, and the old storage key migrating to a flat rate. Not tested: the controls' behavior in a real browser, and how the session extreme should read when it outlives a cleared window. Found in review by an independent qwen workstream; the slot-reuse finding was confirmed by a second adversarial pass and against the source independently. Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI |
||
|
|
bf7e473224 |
dashboard: a card-count change replaces the device rows, it does not stack them
The memory panel rebuilds its per-card rows when the card count changes, but the rebuild only appended: the previous set stayed in #mem. Every card-count change -- a TP flip, a card swap, a lane re-pin -- therefore grew the panel by the old count, permanently, until the page was reloaded. On a box that flips TP2 and TP4 by hand the section becomes unusable within a day: eighteen rows of identical cards after three flips, and the panel's own header (KV cache, prefix hits) scrolls away. Remove the old rows before rebuilding, the same shape the request rows already use above. Per-row removal rather than the sibling guards' container-clear because #mem is shared with the KV and prefix meters, which are built once and must survive. Verified: the embedded page parses (node --check on the extracted script), the translation unit compiles, dashboard_test passes. The behavior itself -- rows gone after a count change -- needs a live card-count change to prove; not tested here. Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI |
||
|
|
8bbf402d9e |
grafana: show token totals and the key status on the first screen
Add totals over the selected time range: prompt tokens in, prompt tokens read from cache (attention cache and linear checkpoint), prompt tokens computed, generated tokens out and finished requests. They use counters that /metrics already has. Move Refused / failed to the first row. The status row is now second. The ratio panels move below the throughput section. No panel is removed and no panel id changes. |
||
|
|
769b4c64a6 |
radiance 1.16.0
New models:
- Hunyuan3D-2 (hunyuan3d2): an untextured 3-D mesh from one picture of an object. DINOv2-giant
over the picture, a FLUX-shaped flow-matching DiT (16 double-stream and 32 single-stream blocks
of 1024) over 3072 latents with both guidance branches in one step, and the shape VAE's
geometry decoder. Converted from tencent/Hunyuan3D-2's hunyuan3d-dit-v2-0 folder with
data/recipes/hunyuan3d-2-bf16.recipe (fp16 cast to bf16, 4.4 GiB, one card). The licence
(Tencent Hunyuan 3D 2.0 Community License) does not cover the EU, the UK or South Korea
- Served on Hunyuan3D-2's own API server routes, so its Blender add-on and scripts work
unchanged: POST /generate answers with the mesh, POST /send runs it in the background and
GET /status/{uid} reports steps_done and then the file. GLB, OBJ, PLY or STL; the field is
sampled coarse to fine as FlashVDM's hierarchical decoding does, or densely with
"volume_decoding": "dense"; seed, steps, guidance and octree_resolution as the reference.
Texturing (Hunyuan3D-Paint) is refused for now (docs/GUIDE.md §5.17)
Merged:
- libr3d rewritten for RDNA3's wave matrix (@RikshaDriver): bf16, f16, int8-activation and vocab
GEMMs retiled to 16x128 blocks with a double-buffered k-walk; fp8, mxfp4a8, w2a8, w4a16, w5a16
and w8a8 quantised GEMMs and the gated form; grouped MoE GEMMs (bf16, fp8a8f32, mxfp4a8); the
norms and quantisers, the QSA state ops and the MoE router, scatter and gather. Brought onto the
op contract before release (13 schemas, the MoE GEMMs on weight tables with a_order and bf16
output, moe_gather's gate pitch, moe_scatter above 1024 slots, the mxfp4 m16 dispatch) and its
gated-delta-net kernels replaced by libhalo's; every op it serves now passes rad-kbench against
libref on a gfx1151, and r3d_selftest checks its MoE GEMMs by value
- Gemma 4 31B: asymmetric int5 linears (w5a8i8 above 64 rows, w5a16 up to 64, a scale per 128),
the norm, GELU and two-rank all-reduce junctions at quant_act_i8g's grid (rmsnorm_quant_i8g,
gelu_mul_quant_i8g, ar_rmsnorm_quant_i8g) so the prefill overlap runs on the i8a8, a4 and w5
trunks, and compose files for the 31B i8g, heretic-ara-i8g and w5 on two cards (@keptn42)
- The norms' lane sum reads eight at a time: TranslateGemma 27B decode is back from 225 to 239
tok/s a stream at four streams, bit for bit the same output (@mici81)
- The head-256 prefill softmax rescales each row by its own maximum, not by a vote of the wave, so
a row's rounding no longer depends on which rows share its launch (@gostar)
Anthropic Messages API:
- /v1/messages takes min_p, presence_penalty, frequency_penalty, repetition_penalty and
repeat_last_n as top-level fields with the chat path's names, ranges and meaning, so clients that
speak only the Anthropic format (Claude Code) can set a model card's sampling, such as Qwen's
presence_penalty 1.5. The penalties count the last repeat_last_n tokens of prompt and reply (64
by default, --repeat-last-n), as llama.cpp does
Plugin ABI 33:
- Shape generators: rad_declare_shape_generator, RadShapeGenBatch (RadBatch::sgen_b) and
RadArchProbe::gen_shape, with the SCOND, SSTEP, SLATENT and SQUERY passes. The layout
fingerprint table is regenerated; out-of-tree plugins rebuild against 33
- New op point_fourier ([x | sin(x 2^j) | cos(x 2^j)], times pi on request) in libref, libavx,
libr4d and libhalo
- A checkpoint for a model that reads no text gets a one-token vocabulary
More cards from the one image:
- stilldeadcode/radiance now carries libr3d (RDNA3: gfx11-generic, every gfx11 chip) and libhalo
(Strix Halo: gfx1151, preferred there over libr3d) beside libr4d (gfx1201). docker/build.sh and
the Dockerfile default to gfx1201;gfx11-generic;gfx1151
- libr3d loads only where the KFD topology lists a gfx11 card and libhalo only where it lists a
gfx1151; a process without /dev/kfd sees neither. On an RDNA4 card, or with no card at all,
the image therefore behaves exactly as before, and rad-convert lays weights out as before
- libhalo and libr3d now declare gemm_nt_q's w_rb, and libhalo gram_accum's upper, as libr4d
does. Before, any build carrying them refused both at load ("9 parameters vs 8"), so a build
for Strix Halo or RDNA3 had no device kernel library
- libhalo does not yet have every op libr4d added after it was ported (the IQR rows, Pixtral and
Ministral rope, the tree-attention and DFlash-tree rows, among others); halo_parity lists them
and is left out of the image's test stage until they are ported
Fixed -- container and checkpoint parsing:
- A .rad expert-1 entry inside or before expert 0 is refused; a vocab section whose count names
an array at offset 0 is refused rather than read from the file header; offset checks no longer
wrap; header tables must sit on their element alignment
- An imatrix array of arrays (unbounded recursion) and a safetensors header naming a tensor twice
are refused; a failed RadWriter undo says the container is damaged; a tune cache measured on
another machine is refused, as its format contract says
Fixed -- plugins:
- Two plugins declaring one op with different parameter roles are refused; before, the core
applied the first one's chunk/capacity roles to the other's rows
- Null tables behind nonzero counts, unknown roles, keyless parameters or constraints and more
operands than an issue carries are refused by name at load; on the host backend device rows are
dropped even when no fat binary was registered; rad-schemas checks the ABI layout fingerprint as
the engine does
Fixed -- device:
- Stream slots are recycled under a new generation: before, 1024 stream create/destroy cycles
(LoRA loads, lanes, uplinks) made every later rad_stream_create fail
- A stream whose drain fails keeps its queue and kernarg ring instead of freeing them under the
card; the kernarg ring no longer leaks when its access grant fails; a block over 1024 work-items
is refused
- rad_dev_free takes the allocation off the ledger the pin-cap check reads; the host backend
charges pages to the card the range was reserved for
Fixed -- engine and server:
- Two NDEBUG-only asserts (runtime-window totals, ring blocks per group) are refusals; a
plugin-declared lcm past int64 saturates so the quantum check refuses it; every share view rect
and part span is bounded by its entry
- Video: the timestep regions hold the refine rungs a schedule appends, a zero-frame encode is
refused, /v1/videos bounds each side before the area product, and a realtime session needs a
clip length to cut a turn at
Fixed -- kernels and quantisation:
- A trellis run shorter than a state's codes (tcq_rows=1, or N % tcq_rows == 1) read its seam
out of bounds; the encoder now refuses it as the decoder does, and tcq_rows below one state is
refused at parse
- qsa_tail_store bounds its slot index by the state plane (libr4d and libhalo); paged attention
refuses kv_heads <= 0; libavx row_amax skips a NaN as libref does
Fixed -- tools:
- pad_tp.py no longer runs cp through a shell with shard names from the checkpoint's index
(quote injection, path traversal): names must be bare file names
- ops_doc_check.sh runs under mawk (Ubuntu's awk); rad-kbench --max-cases/--max-bytes are checked
integers; oot_plugins fails unless the installed replay passed a case and failed none
Thanks to @RikshaDriver, @keptn42, @mici81 and @gostar.
|
||
|
|
cfa6a668f6 | deploy/compose, README: Gemma 4 31B w5 on two cards | ||
|
|
7892524801 |
gemma4_bf16: fused junctions and the prefill overlap on the i8a8, a4 and w5 grids
The residual junctions take the `_i8g` twins where the linear after them reads quant_act_i8g's pair, so the prefill overlap runs on these trunks too. An a4 or w5 linear reads an f16 copy of its input up to 64 rows: in such a step its junction also writes the bf16 norm output into the linear's input row, where the unfused norm would, and the cast and w4a16_asym / w5a16 run as before; the feed-forward keeps gelu_mul there. At four ranks the all-reduce is issued apart. arch_test: the 31B on the three grids at one, two and four ranks -- the junctions, the decode band's bf16 row, the same GEMMs and casts as the unfused step, the slices against the whole step, codes and scales of every int8 pair on the same rows -- and the E4B form. |
||
|
|
b55791b398 |
libr4d: rmsnorm_quant_i8g, gelu_mul_quant_i8g and ar_rmsnorm_quant_i8g -- the junctions at quant_act_i8g's grid
The norm junction (post-norm, residual add, scalar, norm), the gelu product and the two-rank all-reduce junction with quant_act_i8g's quantiser in place of quant_act_i8's: row-major int8 codes and an f32 scale per (row, 128 columns), what gemm_nt_q reads at i8a8, w4a8i8_asym and w5a8i8. The kernels are rmsnorm_quant_i8's and gelu_mul_quant_i8's; only the epilogue over the staged bf16 row differs (r4d_q8.h, q8_row_i8g: quant_act_i8g's mapping and rule), so each is byte-identical to its chain ending in quant_act_i8g. out_bf16 may be x's own buffer. No four-rank form: a four-rank caller finds no row and issues the all-reduce apart. r4d_selftest: rmsnorm_quant_i8g, gelu_mul_quant_i8g and ar_rmsnorm_quant_i8g (two cards) against their chains, the junction also with out_bf16 over x. |
||
|
|
141212dd88 |
gemma4_bf16: asymmetric int5 linears (w5a8i8 and w5a16 over a scale per 128)
a4 at five bits: u5 codes, a u8 zero point (0..31) and an f16 scale per [1 x 128] (libquant `codes=u5 zero=u8 group=128 scale=f16`), ParoQuant int5's grid with no rotation. Read by w5a8i8 over quant_act_i8g's per-(row, 128) int8 activation above 64 rows and by w5a16 over the input cast to f16 up to 64, as a4 reads w4a8i8_asym and w4a16_asym; q|k|v stay one GEMM. The views, row parts and column cuts are a4's. arch_test: the 31B form on both asymmetric grids at one and two ranks. |
||
|
|
b264e9bd0c |
Scale the prefill softmax by row, not by wave
The h256 prefill online-softmax branch must remain wave-uniform, but the previous branch let one row's growth vote make every row update its reference maximum. A row's rounding could therefore depend on which other rows shared the launch. Keep the branch uniform and make each row update only when its own cross-half maximum exceeds its own `m_ref + PGROW`. Rows below threshold retain `m_ref`. This fixes row-coupled rescaling; it does not claim full-model bitwise invariance across chunk sizes, since other shape-dependent paths remain. The dedicated regression selector is `--case attn_prefill_rows` (exact match; `--case rows` is not recognized). The older kernel-name selector runs the regression only for that named GQA row; rerunning it for GQA4 also passes the row checks. Three launch pairs run on six BF16 head-256 rows: GQA 2/4/6/8/12 and GQA6 with 4-token pages (18 assertions). Against v1.15.1, 17/18 assertions failed; with this change 18/18 pass bit-identically. For Spark GQA4, the baseline 58/128 pair differs in 588/118,784 elements (max abs 0.00195). Although this implementation file is named `gqa6`, the parameterized body is included by the other head-256 GQA wrappers too. Controlled 917-token Spark BF16 rerun (same prompt, binary, model, TP1, BF16 KV, no prefix cache; only libr4d changed): chunk 128 vs 1024 kept top token 198 and all 20 candidates in common before and after. Maximum shared top-20 log-probability delta was 0.23717 on v1.15.1 and 0.28474 with this patch. This example does not improve; it is included to avoid claiming general chunk invariance. The earlier raw full-vocabulary pre-fix result (131,070/131,072 logits changed, max abs 0.46925) has no matching post-fix capture; the paired API top-20 comparison is the comparable result. On a separate 32-document, 31,391-position BF16 evaluation, chunk-1024 vs chunk-128 reference achieved 99.49% top-1 agreement (31,231/31,391): 160 positions still choose a different top token between chunk shapes, not against external ground truth. Mean KL was 0.000879, median 1.29e-5, p99 0.00462, p99.9 0.10119, max 3.2961. The pre-fix result on this exact set was not measured. At the separately investigated scored row 461 (document 20, token position 477), prefix replay's recorded top token 62594 was replaced by 2561 before the fix; after it, token 62594 was restored with a 0.184-nat top-token log-probability gap. That 0.184 is not a full-set KL, and the 3.296 maximum comes from the separate 31,391-position evaluation. Fast CTest: 141/141. Full card selftest still has one unrelated `hc_read_e4m3` prefill-tile failure, reproducible on untouched v1.15.1. No throughput improvement is claimed or measured. |
||
|
|
55da38afbd |
libr4d: the norms' lane sum issues its reads eight at a time
1.15's kR4dSumLanes partition folds a row's sum of squares over 256 lanes whatever the block width, so a 1024-thread decode block reads it back with a quarter of its threads, one read at a time: a Gemma 3 sandwich norm re-reads the 5376-wide row it has just written twice, 21 dependent loads a lane each. TranslateGemma 27B lost 5 % of its decode (four streams 225.0 / 227.2 tok/s a stream against 238.2 / 239.7 on 1.14; ar_rmsnorm_post_quant_fp8 3.1 -> 5.1 ms a step under --profile-ops). r4d_lanes_sumsq (r4d_common.h) keeps the partition and the order of the adds and only batches the reads, eight before their adds; libr4d is built -ffp-contract=off, so every bit stays the same (greedy Qwen 300/300 x2 and TranslateGemma 6/6 identical to the merge without it). Used by both lanes_sumsq copies and rmsnorm_body's two loops. TranslateGemma back to 238.9 / 239.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b34b1ac844 | deploy/compose, README: Gemma 4 31B i8g and heretic-ara-i8g | ||
|
|
34c52ebe96 |
libr3d: the RDNA3 (gfx11) wave-matrix kernel plugin
A self-contained HIP kernel plugin for gfx11 (RDNA3) that exposes the
libref-declared ops as device rows the engine can tune and dispatch:
* GEMMs (bf16, f16, int8-activation, vocab) retiled to 16x128 on the
wave-matrix (WMMA) builtins. The retile removes the 8x wave
redundancy of the naive tile and stages the activation once per
16x128 block; the 16-row and 64-row forms share the stage. The k-walk
double-buffers the 128-deep tile (the next tile stages while the
current one multiplies), on the m64 and tiled forms.
* Quantised GEMMs: fp8-e4m3 x e4m3 (tiled and ALU), mxfp4 x a8, w2a8,
w4a16, w5a16, w8a8 (the prefill heights 17..127 on the wave matrix),
and the gated (swiglu) form. E4M3 decodes exactly to f16 through a
256-entry LDS table; the WMMA fragments bit-cast the staged halfs
(a uint16-to-_Float16 assignment is a value conversion, not a
reinterpret).
* Half-precision-accumulate arms (acc = 1) on the m64 wave matrix:
the f16/bf16 16x16x16 builtins with the compile-time opsel half
select.
* Grouped MoE GEMMs (bf16, e4m3 with F32 block scales, mxfp4a8, w4a8),
retiled the same way, over the run-walk / gather structure.
* Normalisation (layernorm / rmsnorm) and the quantisation ops.
* GDN linear-attention, the QSA/KV state ops, and the MoE
router/scatter/gather family (router_topk_scatter, router_sigmoid_topk
with the correction bias, moe_gather, moe_gather_inv; the top-k
router runs to n_expert 512).
Every row implements an op libref declares; the selector (tune) picks
the implementation and the NOTUNE rows carry the untuned default.
Selftest-clean (121 rows, schema + finiteness); values verified against
CPU references per op.
|
||
|
|
203064b487 |
radiance 1.15.1
Fixed: - A preempted prefill no longer parks the engine: once its wait is overdue the scheduler reclaims prefix-cache blocks over several rounds, returns leaked state slots when nothing is running, preempts only decoding requests it is ahead of (never one still building its prompt), and fails a recompute an empty pool cannot hold instead of waiting forever. Before, concurrent long requests that filled the KV pool could preempt every runner and leave all of them waiting with nothing running while /health answered 200 (#360) - A scored request's candidate list is capped at 4096 ids, and a step whose pinned scored rows cannot be allocated cancels those requests instead of stopping the engine - qwen4exp: the pinned copy of the window bounds is freed when a rank's model is re-declared Server hardening: - Keyless loopback-only routes need a loopback socket, a matching Origin and a Host naming the loopback or --allow-host; a TLS proxy on loopback no longer makes every client local - --trusted-proxy CIDR (repeatable): X-Forwarded-For from a vouched network names the caller in the logs; authority still reads the socket - A 401 closes the connection; drains of unread bodies are bounded; multipart form fields and buffered Anthropic tool-call arguments are parsed under the same size and depth gates as JSON - 500s carry a generic message on the wire (the reason stays in the log), client text in log lines is sanitised, and a security-relevant header sent twice is refused - An empty --api-key value stays a startup error (now pinned by a test) - hfget.sh vets a repo listing's file names before fetching and hashes each LFS download against its oid - cpp-httplib v0.64.0; vendor/SHA256SUMS pins every vendored file (ctest vendor_sums), and .woodpecker.yml runs the host suite on every push Thanks to @baKon (#360) and @fl0l0u. |
||
|
|
b6acbd69e4 |
server: name the caller a vouched proxy carried, without arming the guard
An operator running radiance behind a reverse proxy sees one address in every log line: the proxy's. --trusted-proxy CIDR (repeatable) vouches for the networks whose sockets may say who they carried. An X-Forwarded-For from inside a vouched network is walked from the right: vouched hops are skipped, the first address no vouched CIDR covers is the caller, a chain of only vouched hops ends at its leftmost, and anything else falls back to the socket. From an unvouched socket the header names no one, because it has not been vouched for. Attribution is not authority, and the split that keeps them apart is mechanical. HttpRequest carries `peer`, the attributed caller, sanitized where it is built because a named address arrives in a header and the log keeps no client text otherwise -- and `raw_peer`, the socket as the kernel saw it, which is now the only address peer_is_loopback() reads. A proxy on loopback therefore hands the keyless loopback-only routes to none of its clients; it only names them where the proxy used to stand. transport_test pins both halves: the walk at the unit level, and over a real socket that a vouched proxy plus X-Forwarded-For leaves the loopback guard answering 200 and the cross-origin 403 untouched. httplib's own set_trusted_proxies -- new this side of the vendor bump -- is deliberately unarmed. It rewrites req.remote_addr, the very field the guards would read as the socket peer, so one over-broad vouched network would move the guard rather than the log line. Radiance reads the header itself, and ip_in_cidr refuses across families: a vouched ::ffff:0:0/96 vouches for no IPv4 socket. Config rejects anything but a numeric network with a prefix at startup, because a typo there would silently unvouch a proxy; the refusals the transport answers before the router log the attributed caller too, so the audit trail stays one line per request whoever the socket belongs to. |
||
|
|
40e1b3073b |
vendor: cpp-httplib v0.46.1 -> v0.64.0 -- the drain patch retires to one line
Eighteen upstream releases, taken the way the lift was taken: the split pair llama.cpp now carries (1ab23c33b), against the cpp-httplib v0.64.0 tag. The vendored pair before this commit was byte-identical to the old base plus patch 0022 -- re-checked against the pinned lift commit, not taken on faith. 0022 was written because upstream's keep-alive drain could be paced one byte per socket timeout forever, and because a refused request's unread body had no reason to be drained at all. v0.64.0 does both of those itself: every 4xx/5xx response now carries Connection: close, a scope_exit in write_response closes the socket when it sees that option, the drain is skipped for any response committed to close, and a drain that does run is bounded by a 256 KB cap, the connection's read timeout as a total, and an immediate close for a part-read body. The old patch applied nowhere, and mostly needed to be nothing. What one line is still owed: the library bounds the drain's time only by the connection's read timeout -- the same knob that bounds a whole request's reads, uploads included, so lowering it would cap uploads too. The reworked patch gives the drain a five-second budget of its own. transport_test's cases for the refusal and the stalled drain are unchanged: they pin the behavior, whoever in the tree implements it. Also new in this window and watched with interest: set_trusted_proxies arrives with real IP matching -- the seam a coming commit wires. Manifest regenerated; vendor_sums green. |
||
|
|
3decb3ca13 |
qwen4exp: the pinned window copy survives its model's reset
declare() resets the rank's Model with Model{} on every re-declare --
every rebuild, every sizing probe, every test case -- and the reset
drops pipe_cu_h, the once-made pinned copy of the window bounds, on the
floor: the pointer is overwritten and the pin leaks. arch_test flags it
under the asan tier (qsa_a_widened_step...: 8 bytes, calloc,
pipe_bounds), and the leak grows one pin per re-declare of a rank.
Free the copy where it is dropped. The copy is read only by a widened
step's memcpys, and no step runs across a declare.
|
||
|
|
8e65e1a302 |
ci+vendor: pin the lifted tree by hash, and run the suite on every push
Two standing gaps in how this tree is guarded. vendor/ records what every lifted file is and what we changed, in prose -- prose nothing enforces. vendor/SHA256SUMS is the mechanical half: all 73 files under vendor/, the lifts, the patch series and the record itself, hashed; tests/vendor_sums.sh recomputes both directions -- a file whose content drifted from its record, and a file that arrived without being recorded -- and fails the suite (ctest: vendor_sums, in the fast tier). An unrecorded change to a lifted dependency now has to survive being a committed manifest update to ship, instead of slipping through a rebase the way 33108e4's silent reverts did through this branch's history. And no CI ran the suite at all. .woodpecker.yml (Codeberg CI) builds CPU-only with the media codecs present and runs the host preset -- everything but the gpu and oot tiers. The runner is the current Ubuntu LTS deliberately: the mp4 writer binds FFmpeg's >= 7 AVIO callbacks and 24.04's 6.1 does not compile it. Rehearsed on a native Ubuntu 26.04 box -- the same gcc 15.2 the image carries -- the host preset fails eight cases on this branch, and the same eight on plain upstream/main: arch, chatparse, engine_e2e, two gbnf shards, place, quant_ggml and avx_check. Pre-existing under gcc 15, partly machine-dependent (avx_check compares kernels op by op on the CPU it finds, and the gbnf shards flip under load); this branch adds none of them. CI's first red is upstream's to see. |
||
|
|
1577854d00 |
hfget+deploy: fetch a repo on verified claims, and run with a key argv cannot show
The --model repo-id path trusts the hub with the machine's filesystem and the container runs with the kernel's door off. Both stop here. hfget.sh trusted a listing's file names to be names: an absolute path or a .. segment wrote wherever the destination's owner could write, and a name shadowing .hfget-manifest taught the next run whatever it liked. A listing is now vetted whole before anything is fetched -- absolute paths, .. segments, control characters (a tab splices one entry into two fields), names of hfget's own manifest -- and a child refuses a path that would escape anyway. Silent skipping was the alternative, and it leaves a directory that reads as complete and is not. And the content key was the hub's claim, never checked: an LFS file was kept for its size and its claimed oid recorded without ever hashing the download, so a swapped file of equal length -- or a spliced resume at any length -- passed forever after. The download is hashed on arrival and kept only when it matches the claimed sha256; a mismatch deletes the file, and the manifest now certifies verified content. --model-revision REV fetches at a branch, tag, sha or refs/pr/N instead of the moving main: without it a restart can serve weights nobody reviewed, and the guide now says to name one. --api-key-env NAME reads the key from the environment, where only the process and root can reach it, not the command line where every process on the host reads it in ps; an unset or empty variable refuses startup exactly like an empty --api-key. The compose files carry the key through environment: now -- the fail-closed :? guard moves with it -- across all 52 model files. And the containers' seccomp=unconfined has a way out: Docker's default profile, plus exactly the calls that forced the escape -- io_uring for the n-gram table, mbind/set_mempolicy/get_mempolicy for ROCm's NUMA binding -- is shipped as seccomp-radiance.json and selected through RADIANCE_SECCOMP; the default stays unconfined until each operator audits their own card stack. Verified: under the profile io_uring_setup and set_mempolicy behave as under unconfined and a non-listed syscall earns EPERM. hf_model_test: the escape-listing refusal, the oid verify (bad rejected and deleted, good certified), the pinned revision fetched -- against a fake curl for a hub. config_test: --api-key-env fails closed unset, reads the key set. ASan+UBSan: config/diag/hf_model/server/transport/ wire/lifecycle, 8/8. |
||
|
|
ad3f03dbc6 |
server: no internals on the wire, no client text in the log, no paths for strangers
Four ways the server told more about itself than the caller earned. The exception handler logged e.what() sanitized and then put the raw string on the wire: a 500 whose message echoes request text is a reflection point, and one that quotes how a handler broke names the server's internals to whoever prodded it. The wire gets the generic sentence now; the reason stays in the log. The realtime and speech sockets caught their session's exception the same way -- raw what() to the log and onto the client's error event -- and follow. Their WebSocket wrapper logged e.what() and the request path unsanitized: the path is fully client text, and a client that can put CRLF and an escape sequence into a log line can forge the next one. A security-relevant header sent twice is a request built to be read two ways: this server reads the first copy, a proxy in front may read the last or join them, and whichever copy the disagreement lands on, the attacker picked it. Host, Authorization, X-Api-Key and Origin are refused whole at 400 before either reader -- the key gate included -- even when every copy carries a valid key. The lookup is case-insensitive, so an Authorization beside an authorization counts. And the model card's `root` is a path on this machine, served to anyone /v1/models admits. Keyless, it now belongs to the local operator, the rule /diagnostics and the LoRA admin already follow; with a key it travels with the key. server_test: the_models_root_path_follows_the_key. transport_test: a_duplicated_security_header_is_refused. ASan+UBSan: server/transport/ wire/stream/speech/speech_stream/dashboard, 7/7. |
||
|
|
1c967b2f14 |
sched+engine: keep a scored request's size from reaching the pinned pool
A scored request asks the engine for the logits of chosen candidate ids at its prompt's last position (Request::token_scores). Three places where that readout's memory was someone else's decision: The candidate list was bounded by value, never by count, and the count is what a scored step pays for: the step stages the union of every staged request's candidates as hidden and table rows in one pinned host buffer, before anything is admitted or accounted. One request naming a million ids -- any caller of the raw request seam -- is a multi-gigabyte pinned allocation the box either loses or dies on. add_locked caps the list at 4096, orders above what a decision request names (its prompt's written answers, a few dozen), and says so in the refusal. And when the pinned allocation is lost anyway -- the cap bounds one request's rows, not the batch's union, and the pool can be low for reasons of its own -- stage_scored_rows returned E_NOMEM into the step loop's fail path: the whole engine stopped, every connection with it. It cancels the scored requests instead, on the step loop's existing deferred-cancel vector the sampler's grammar failures already use: a request whose scores the box cannot hold is that request's failure. No alloc-failure seam exists to test the branch directly; its cancel path is the sampler stage's, applied at the same join. And declare_scores now refuses a head table shorter than the vocabulary: the scored readout indexes it by token id, the scheduler bounds candidate ids by meta.n_vocab, and a table a few thousand rows short turns the last block of the vocabulary into a read off the end of a weight -- a device fault, not a refusal. Padding past the vocabulary reads fine and stays fine. sched_test: a_scored_request_names_at_most_the_candidate_cap. build_test: declare_scores_wants_a_table_that_covers_the_vocabulary. ASan+UBSan: sched/build/server/systemone/config/diag, 6/6. |
||
|
|
5f7244da4d |
server: bound what an unauthenticated socket can make the transport hold
Three ways a client spent the server's patience or memory without ever being admitted: The gate's 401 answers before any handler sees the request, so its body sits unread on a keep-alive socket, and httplib's anti-smuggling drain will wait for it: one byte per read timeout paces a whole worker, at the pacing client's chosen rate. The refusal now closes the connection instead, says so on the response, and buries the body with the socket -- which is also what makes draining a refusal pointless. A drain that does have a purpose -- a framed body on a request the router answered without reading it -- inherits the stream's 30 s read wait per packet gap and no total bound at all. It keeps both waits now: five seconds per gap (the stream's own set_read_timeout, the same knob the WebSocket upgrade uses) and five in total (a deadline the discard provider checks), then the connection dies and the timeout is restored for whatever the connection still has coming. And bodies. The per-request cap bounds one body and no sum, every byte of a body is buffered before parse, admission or any accounting sees it, and a few hundred concurrent large POSTs is an OOM that reaches the engine before any refusal does. read_and_bridge now holds every buffered byte against a transport-wide budget and answers 429 with Retry-After to the newcomer the budget has no room for; the reservation releases on every exit, including the peer vanishing mid-body. The budget defaults to eight bodies at the per-request cap and moves through ServerOptions::max_inflight_body_bytes. Vendor: the two httplib hunks are recorded as patches/0022, and UPSTREAM's "no file content differs" for the pair is replaced with what the split actually is and what is now edited in it. transport_test: a_refusal_closes_the_connection, a_stalled_drain_dies_on_its_deadline, the_inflight_body_budget. ASan+UBSan: transport/wire/lifecycle/server/config/diag/dashboard, 7/7. |
||
|
|
ec53bce5dc |
server: stop treating the loopback socket as identity
Three guards read a loopback peer plus a matching Origin as "this is the machine's operator". Two real topologies forge exactly that: DNS rebinding hands a hostile page its victim's own browser, so the peer IS loopback, and the page is same-origin with the server, so the Origin/Host compare stays silent. Only the Host still says which name the client asked for, and the attacker's domain cannot be made to read as the loopback. The documented TLS-proxy topology puts every remote client behind a loopback socket, and a non-browser client sends no Origin at all; the proxy passes the public Host, which the new check refuses. Server::local_operator now guards the keyless routes: the socket, the Origin, and a Host naming the loopback, --allow-host, or a concrete bind address. GET /admin/control-vector takes the guard POST already had, placed before the 404-that-means-no-vector so a remote page can probe neither; keyless DELETE /sessions and /reset_prefix_cache -- which destroy other clients' cached conversations -- answer the machine only. --allow-host (repeatable) admits names an operator reaches the box by from the box itself. A local user at the console stays admitted; nothing about a key-set server changes. GUIDE 6.6 states the new posture. |
||
|
|
d54f3b9e6e |
server: bound the last unbounded parses of untrusted text
Three ways in, each ending in a parse that bounds neither what it builds nor how deep it nests: videos.cpp read its multipart form fields with the raw parser, so a 512 MiB field of brackets died at the tree's teardown; the same file's JSON path was bounded, so the form path now shares its gate, and a field over budget or over depth reads as a bad parse (a form test pins both refusals and a well-formed field). Anthropic's buffered body parsed the model's tool-call arguments directly; the streaming path already scans them with json_complete, whose depth cap keeps a cooperating model from stack-killing the worker, and the buffered body now passes the same gate, reading too deep as an empty input. The image decoders checked the container header's dimensions against the pixel cap but converted whatever the bitstream actually decoded; a container whose SPS disagrees with its header slipped through. Both now re-check the decoded frame, as the video path already does. The re-check is inside RAD_HAVE_FFMPEG and compiles with every FFmpeg build; the media-less container proves the two server changes. |
||
|
|
546f0c2047 |
config: pin the empty --api-key refusal with a test
|
||
|
|
9560780bfa |
sched: a preempted prefill reclaims cache and leaked state slots before it waits
The whole-recompute gate refused a preempted request forever when the pool held only cache entries, and an empty running set left a leaked state slot unreclaimed. Reclaim the cache over several rounds, release idle state slots when nothing is running, and admit the overdue waiter if it can ever fit. A prefill is never a victim while a decoder is running; tests cover the deadlock, the leaked slot, and the lost KV sequence. |
||
|
|
9ed3ef7a7b |
radiance 1.15.0
New models and formats: - IQR for Qwen3.8-27B: weights on the int8 grid under GPTQ, a trellis down each GPTQ column (IQR-V2), and IQR-V3, a computed trellis code under one scale a row, kept at its codes' width in VRAM and decoded in the GEMM; 15 IQR-V3 recipes from ~2 to ~7 bits a weight (data/recipes/q38-27b-*-v3.recipe, docs/IQR.md) - libhalo: a kernel library for Strix Halo (gfx1151), preferred there over libr3d - Nemotron 3.5 Embed 1B and 8B (nemotron35_embed): text and image embeddings through a Pixtral tower, on the card and on the CPU - Nemotron 3.5 Rerank 8B - /v1/systemone: Cloudflare's clef and clef-flash, Convai Innovations' Laya and Mica beside LiquidAI d1; scored steps read the candidates' logits from the head table with no lm_head pass - LFM2's 8-bit trunk: block-fp8 or int8 linears with the fused producers, and the d1-3B recipe - DeepSeek-V4.1's reply format with DSML tool calls and typed argument tags Weights on the drive: - The file tier reads only the experts the pass routes rows to; the draft head's weights stay in the host pool - A hot VRAM cache for routed experts read off the drive, reads deposited straight into free host pool slots, and copyless evictions; the file tier's counters are now ssd_* - GLM-5 Next shards its routed experts by expert, not by width, so they can live on the drive - The stall watch counts drive reads as progress, and the DMA lane's room check reads the lane's own completion fence Quantisation tooling: - --calib-corpus, --calib-dir and --calib-layers record each linear's input Hessian; beside --kld-record the reference's own run records them - --kld-top N records a sparse KL reference (the N most likely tokens and the tail's mass) - GPTQ in a third of the time with the same codes, trellis GPTQ on the card, vector codebooks with coordinate descent, and rad-convert --reuse repeated, each container supplying what the earlier ones lack Speculation: - Prompt lookup alone (--spec-ngram K, --spec-ngram-min/-max): each sequence keeps an index of its n-grams, and a proposal is verified only when its measured step cost says it pays; --draft-window adaptive follows it Speed: - IQR decode: the narrow tile splits K for four times the int8 tile's waves and folds each 128-K block once; at 8 tokens down and the output projections run in 0.61-0.82x and 0.70-0.92x FP8's time (2-6 bits); IQ6R-S-V3 with its DFlash2 drafter steps in 26.3 ms at TP2, against 29.4 ms before and FP8's 27.3 - Qwen MXFP4 feed-forward: the gated fold up to 16 rows, not 8 - libr4d: the gated prefill fold, the short-prompt split row, and the rows forms of rmsnorm and rope; KLATE again for the head-256 gqa6 paged prefill; gram_accum on the matrix cores Features: - /health, /v1/health and /ping answer 503 with "status": "stuck" once the device has advanced nothing for a minute or a queue has faulted, so a supervisor can restart a wedged server (#356) - --image-gen-max-pixels and --image-gen-max-refs size an image generator's buffers (#344) - The startup report lists only the options not at their default, with a count; -v lists all (#250) - --preempt-wait-ms bounds how long a preempted prefill waits for its whole-recompute room - --placement layer_offload spills dense layers so one --max-model-len sequence fits - Startup refuses amdgpu with CWSR off and says how to fix it; --proceed-with-incompatible-configuration starts anyway under an UNSUPPORTED banner Fixes: - The n-gram read-ahead hands each row to the reader once and reads only as far ahead as the row cache holds, and pauses while decode reads: about one drive read a row instead of two (#355) - A file-tier window reads each of its runs once, not once a run per run - The decode split law's verify floor is bounded by the batch's workgroups: max_seqs 256 no longer declares 64x the scratch (#342) - A prefetch DMA list's mark stays out of the signal pool until the engine has read it, and a prefill stage copies only the blocks its own tables name (#343) - The split-KV row sum is read with fetch-inactive (#328) - LFM2 on the host backend: libref and libavx serve the row-form ops it declares (#348) - The preempted-prefill gate skips a KV group that holds no blocks (#352) - Every request entry point bounded, gated and sanitised (JSON depth, invalid UTF-8, control bytes in the log, the dashboard's CSP, cross-origin browsers on the loopback-only routes); a prompt id outside the vocabulary refused at admission; --api-key "" refused at startup - The telemetry the HTTP thread reads is atomic - An RMS norm row no longer depends on how many rows its launch carries; prefill attention's rescale is decided by live rows only - A --kld-record prefill chunk that finishes no sequence gets its logits on a tied-head model - A kernel's lazily made counter block is zeroed outside the lock other ranks take (a TP2 first-step hang) Changes: Plugin ABI 32. Every plugin exports a layout fingerprint of the ABI structs and the loader refuses a plugin without it or with another (#302), so out-of-tree plugins must be rebuilt. Appended: RadBuildCtx calib_* and gen_max_*, RadArchProbe gen_max_*, RadBatch score_only and plugin_words, RadDeviceProps::unified, RadChatFormat arg_json_value_prefix. |
||
|
|
8da043c246 |
place: the caching layer -- hot VRAM cache, deposits, copyless relabels
Routing-aware reads leave a routed expert's bytes on the drive when the pass routes nothing to it, but the reads that DO happen still have two wasteful fates: they land in a per-pass buffer thrown away at the next layer, and they cross the link even when the same bytes already sit in a host pool slot that just went cold. This commit gives both bytes somewhere to stay. The hot VRAM cache: a routed expert whose read heat ranks past the admission bar lands in a shadow slab slot and stays there. The slot is its address from then on, until heat evicts it -- eviction is a copyless relabel (back to Tier::SSD, publish null); the container is ground truth. The planner budgets the shadow slots for it (per-class on_disk count); the mover admits (Kind::Admit), evicts, and retires the admissions. Deposits: a free pool slot takes the O_DIRECT read directly -- the read's destination IS the slot -- and the unit becomes a pool unit the GEMM reads zero-copy, with heat promoting it at PCIe speed later. Its demotion is a copyless drop (the slot still holds the bytes). A full pool evicts its coldest unrouted unit by relabel, copyless, and the freed slot feeds the next deposit. The counters follow the traffic: the file stager's family is renamed file_* -> ssd_* (ssd_layers, ssd_units, ssd_read_bytes, ssd_preads, ssd_read_ns, ssd_wait_ns) beside the existing ssd_reads/ssd_bytes, and the new legs are counted (ssd_staging_bytes, ssd_promotions and ssd_promoted_bytes, ssd_deposits and ssd_deposit_bytes, pool_evictions). The dashboard's expert plane gains the matching staging, promotions and deposits rows, and --weights-disk-tier's help text names the tier. Measured on GLM-5.3-Flash TP2 (2x Radeon R9700), 250-token essay at temp 0: 5.49 tok/s at ~104 GiB of SSD reads per run, against main's 2.05 tok/s at ~378 GiB. Assisted-by: GLM-5.3-Flash |
||
|
|
9efdd00c4c |
place: routing-aware file-tier reads
The file tier read every file-tier unit of a routed layer whether or not the router sent rows to it. A deep layer keeps whole experts on the drive (288 per world), but a pass routes rows to a handful of them: the read volume was ~18x what the router justified, and the engine streamed ~378 GiB from the SSD per run at 2.05 tok/s (GLM-5.3-Flash, TP2). The layer's router has run by the time the stager triggers -- the trigger is the layer's first expert op -- so the pass's route counts are already on the device. Ctx::route_counts_device exposes them; the file stager hands them to Mover::stage_file_units, and an expert counted zero, which has no sorted rows and no GEMM run naming it, is left on the drive: its weights are not read at all. Its table entries are published at a valid dummy address (the calm region) for the pass and nulled again with the staged units, because the kernels still issue the layer's table and a null entry fails the step. Published even when EVERY unit of the layer is skipped -- a decode step can route nothing to a layer. The drafter's own weights (the "mtp." namespace) run on every draft pass of every decode step, more often than anything a profile could rank, so the planner pins them in the host pool ahead of everything ranked (MoveUnit::draft_head) instead of letting the expert fill push them to the file tier every step. Read extents are also clamped to the container file's size, so a truncated container fails a read loudly instead of reading past EOF. Measured on GLM-5.3-Flash TP2 (2x Radeon R9700), 250-token essay at temp 0: 3.4-3.6 tok/s where main gives 1.42 on the same prompt. Assisted-by: GLM-5.3-Flash |
||
|
|
9647b84ee0 |
glm5next: expert parallelism -- experts become file-direct
Main's glm5next width-shards the routed experts unconditionally (GlmTp::expert_width, ff_lo/ff_hi): an expert's stored form is a shard across ranks, so --weights-disk-tier refuses it and a 151 GiB expert set cannot leave VRAM at any pool size. The helper's expert-parallel declaration (expert_base windows, RAD_SHARD_NONE, no ff spans) already exists upstream -- qwen4exp uses it -- so this retargets glm5next onto it: each rank owns 288/world whole experts, the routed arm's buffers full-width (FE), the shared expert still width-sharded, world 1 unchanged, and a shape probe's rank >= world clamps to rank 0's window. Fixes the 24.78 GiB "no eligible tier" startup OOM on 2-card hosts; the world-8 graph pin is re-recorded from the test's own pin: printout. Assisted-by: GLM-5.3-Flash |
||
|
|
6f6b5c3f78 |
aql: the stall watchdog is progress-aware; the DMA lane's ring completion is fenced
Main's stall watchdog samples only the queues' read indices, and the DMA lane trusts the SDMA queue's written-back read pointer for its room check. Both stall wrongly: a drive-paced prefill parks every queue for seconds (one rank spins at the all-reduce while the other reads its layer off the drive -- spurious dumps), and the SDMA engine's written-back read pointer can stop moving while the engine runs on -- a full ring then waits forever, wedging the startup pool fill above ~32 GiB/rank. pread_exact counts the bytes it returns (rad::dio_progress); every O_DIRECT read funnels through it, and read_progress adds that to the queues' read indices: a wait that moves nothing anywhere is a hang however slow the drives are, so the threshold is a flat 5 s and every stall report is genuine. The main DMA lane names its lists the way the xp queue already does -- each list ends by writing its number to a word the engine keeps advancing (fin/ends) -- and dma_read takes the further of that fence and the read pointer, so the room check can no longer mistake a stalled writeback for a stalled engine. dump_dma_lanes reports the finished-list count. Verified on the wedge reproducer: GLM startup with a 36000 MiB pool fill, decode with promotions, and a 13300-word drive-paced prefill -- zero spurious dumps, the ring live throughout. Assisted-by: GLM-5.3-Flash |
||
|
|
74e7fddd79 | nemotron 3.5 rerank 8b implementation | ||
|
|
d773992abc |
[FIX] restore the prompt vocabulary check, the empty --api-key refusal and scored steps' issue-ahead rule
|
||
|
|
8df9240d65 |
sched: the preempted-prefill gate skips a KV group that holds no blocks
Every program carries a sentinel KV group at index 0. KVGeom reads its decl.kind 0 as RAD_KV_FULL with block size 1, while the manager's plan for it pages nothing and owns no block. The gate ( |
||
|
|
167595a9b4 |
libr4d: the split-KV row sum read with fetch-inactive (#328)
The prefill KV split (
|
||
|
|
9cf8d3dad8 |
arch/common: DeepSeek-V4.1's reply format, DSML tool calls with typed argument tags
The checkpoint's own encoder writes an assistant turn as reasoning followed by a sectioned DSML call block, with each argument tag naming string or JSON. The template analysis cannot state those typed tags, so the format is declared as data and chatparse_test reads it back. Split from #266; no model plugin or kernels. |
||
|
|
94c90b17ad | nemotron 3.5 implementation | ||
|
|
33108e488b | sched: a bound on the preempted-prefill gate's wait | ||
|
|
0792d86375 |
libr4d: the paged prefill attention h256 gqa6 asks for KLATE again
|
||
|
|
f8e69c4825 |
libr4d decode split law: bound the three-wave verify floor by workgroups (#342)
|
||
|
|
ec243c2a7d | Merge main into laya-arch-plugin | ||
|
|
8df39472b6 |
lfm2: the 8-bit trunk -- block-fp8 linears, the fused producers, and the d1-3B recipe
Every linear of the trunk is a LinearFP8, so the container's encoding decides the GEMM: bf16 stays `gemm_nt` exactly as before, a recipe's block E4M3 is gemm_nt_q at fp8a8 over an activation quantised once per producer, and int8 is gemm_nt_q at i8a8. The format is read off layer 0's first linear; a trunk mixing formats is refused by name. The convolution, the norms and attention stay bf16. On a block-fp8 trunk the fused producers run: rmsnorm_quant_fp8 with a fold for each mixer's norm (the previous block's residual add included) and MlpFP8 for the feed-forward, whose gate|up GEMM applies SiLU(gate) * up and quantises in its epilogue. The convolution's C * conv(B * x) and the codes its out projection reads become one gate_quant_fp8 at act none. `gemm_nt_q_gated_wide` puts whole prompts through the fold instead of falling back to the pair past 64 rows; k and v ask for `gemm_nt_q_short`; the head norms and rope ask for `rmsnorm_rows` and `rope_rows`. Each of those is the model's own declaration, so no other architecture's path moves. The lm_head is read at its stored codes (bf16, or E4M3/int8 where a recipe made it so, logits_gemm_fp8/_i8). A tied head also declares the final-normed rows and the embedding table to the core (rad_declare_scores), so a scored step needs no head read at all. data/recipes/d1-3b-fp8.recipe: all 30 layers' linears to E4M3 with a bf16 scale a 128x128 block; the tied head to int8 per row per 128 columns. Co-Authored-By: Pi <pi@localhost> |
||
|
|
b8cd1c950a |
libr4d: the gated prefill fold, the short-prompt split row, and the rows forms of rmsnorm and rope
Four rows of our own, each declared only by a model that asks for it, so every
other caller keeps the row and the bits it had:
gemm_nt_q_gated_wide gemm_nt_q_gated at every M: the narrow tile to 64 rows
and, past them, the gated prefill tile (128 gate and
128 up rows against 64 activation rows a block), whose
accumulators are the unfused prefill GEMM's. The
narrow row keeps its M <= 64 ceiling and kernel.
gemm_nt_q_short the narrow fp8 row with the short-prompt split rule:
N <= 512, K <= 5120 and 41..64 rows run unsplit, where
the split's per-slice floors dominate. Its scratch hook
makes the same choice, so the arena matches the launch.
rmsnorm_rows the same norm; at n <= 256 and 1024 or more rows a wave
a row, its sums in rmsnorm_kernel's wave order.
rope_rows the same rotation; at 64 or more rows and 4 or more
heads one angle a (token, pair), every head turned with
it, byte-identical to rope.
gate_quant_fp8 gains act none: the plain product (`mul` then the quantiser) in
one pass, rounded once as mul_bf16 rounds it. Its `mode` stays 1 by default, so
the sigmoid producer every other model issues is unchanged.
r4d_selftest: the act-none chain against mul + quant_act_fp8 at M 1, 8 and 65 with
strided sources and without out_bf16; gemm_nt_q_gated_wide against the tiled
GEMM + gated_quant_fp8 at 65 and 129 rows; and the RDNA4 device phase accepts
gfx1200 beside gfx1201, where the card this was measured on lives.
docs/OPS.md carries the four rows ops_doc checks.
Co-Authored-By: Pi <pi@localhost>
|
||
|
|
ed1e5caf9d |
core, abi: scored steps -- rad_declare_scores, RadBatch::score_only, and /v1/systemone's model
A scored request (Request::token_scores, what /v1/systemone asks: the raw logits at a few candidate ids) does not need the half-gigabyte lm_head read the sampler would consume. A plugin whose head is the bf16 embedding table declares the final-normed hidden rows and that table (rad_declare_scores); on a step whose sampled rows are all scored rows and whose program declared both, the core sets RadBatch::score_only, the plugin issues everything but the head, and the core reads the hidden rows and the candidates' table rows back and takes the dot products in f64 on the host. RadBatch gains one trailing int32 (score_only, 360), which the pass key mixes; an older plugin never sees it set. The scheduler issues no step ahead of one that brings a scored row to max_tokens: that forward pass reads nothing and a max_tokens=1 question would pay a decode step after its prefill. Scored rows only -- every other decode keeps the step of overlap it had. /v1/systemone reports which model answered. Co-Authored-By: Pi <pi@localhost> |
||
|
|
9093bf618e |
place+runtime: make the telemetry the HTTP thread reads atomic
/stats and LiveView read the mover's and heat engine's counters, the live tier of every unit, and OpInfo::issued while the rank and step threads write them between passes. Plain fields under a concurrent reader are a data race: no torn number matters on a dashboard, but the compiler may tear, and the sanitizer is right to stop the process for it. MoverCounters and HeatCounters mirror each struct's fields as relaxed atomics, written exactly as the plain counters were and read whole through snapshot(); tier_ gains a per-unit atomic byte mirror (TierMirror, copyable because HeatEngine is), and the step path and the graph dump meet on OpInfo::issued through std::atomic_ref, which keeps the struct layout and its copies intact. Engine-internal decisions keep reading the plain counters -- they never race -- and only the HTTP-thread readers go through the mirrors. |
||
|
|
b9c685a9c3 |
server: bound, gate and sanitize every request entry point
Prepared for exposing the dashboard and the API beyond the local machine. Each piece answers a finding from the review; none changes what a legitimate client sees. Parsing. Six entry points still called json::parse with no bound on the tree: the two WebSocket sessions, the image form's loras field, the two re-parses of template kwargs, the control-vector POST and the lora-admin body. A legal frame or body of brackets alone built a tree whose teardown recurses once per level -- one worker stack, one process. They all go through parse_json_bounded now, the body cap's own value and depth limits. The same reasoning already refused deep bodies on the generation routes; frames and form fields were the ones that never passed a gate. Errors. ApiError::dump threw on invalid UTF-8, and URL-decoded params reach messages without passing a JSON parser: a 404 becomes a 500, or worse a closed connection. The dumps replace bad bytes instead of dying. Logs. Session labels and echoed request text reach the log; an embedded newline forged a line and an escape sequence drove the terminal reading it. log_sanitize filters control bytes at the entry points -- labels, refusal logs, the exception handler -- while the three loggers that print multi-line reports deliberately keep their newlines. The browser. The dashboard page ships a CSP (its script talks only to its own origin) and X-Frame-Options DENY; every response carries X-Content-Type-Options: nosniff. And the loopback-only guards -- control-vector default, runtime LoRA, diagnostics -- now treat a cross-origin browser as the remote client it is: a hostile page reaches them through the victim's own browser, which is exactly loopback. Origin not matching Host refuses; same-origin and non-browser traffic are untouched. The gate. The API key's path exemptions are method-scoped (reads, plus the POST /ping of the health-check convention), so an exemption can never ride a method no route answers. An empty --api-key value is now a startup error rather than a server that looks guarded. SSE. In the vendored httplib 0.46 an exception escaping a content provider aborts the process; the provider ends the response instead. Upstream's 0.54 serve_guarded fixes the cause -- the vendor lift is owed either way, and the catch is harmless belt until it. |
||
|
|
a28221eb6a |
sched: refuse a prompt id that names no vocabulary row
The scored-prompt path (Request::token_scores) has always vetted its ids against the
vocabulary; the prompt itself never was. Raw id arrays arrive at admission verbatim from
the request body -- /v1/completions, /v1/embeddings and the generator take them -- and an
id past the embedding table is gathered by the step, fails it, and a failed step is a
device fault (spec 17): one request, {"prompt":[2147483647]}, ended every session on the
server. The check belongs at admission, where a refusal is a 400, not mid-pass, where it
is an exit.
The sched fixture's model declares 512 vocabulary rows and its requests spell prompts
from 1000 up; admission now refuses those, so the fixture's vocabulary moves above the
ids it uses.
|
||
|
|
ed5f990d92 |
qwen MXFP4 feed-forward: the gated fold up to 16 rows, not 8
decl_gated_fold_mx declared gemm_nt_q_gated_mx over 1..8 rows only, from before libr4d had gemm_mxfp4a8_gated_gemv_wide (9..64, byte-identical to gemv_wide followed by gated_quant_fp8, the pair it replaces). TranslateGemma already folds to 64 through RADIANCE_G3_FOLD_ROWS; Qwen's 16-row verify steps (two sequences at speculation 7) still ran gate_up and gated_quant_fp8 apart. Qwen3.8-27B MXFP4 + DFlash2 at TP2 on 2x R9700, production flags, ms a decode step, three interleaved rounds (medians), the 1..8 band -> folding to 32: 16 rows (x2): 1k 20.96 -> 20.78 (-0.9 %), 16k 21.96 -> 21.70 (-1.2 %) 32 rows (x4): 1k 23.97 -> 24.10 (+0.5 %), 16k 26.06 -> 25.98 32 rows (x8 short block): 1k 24.99 -> 25.14 (+0.6 %) and 64 rows lost 2.1 % (16k x16) on the base before this main. So the band is 16: a taller step takes exactly main's path. Where the wide row does not resolve (K at or under decode_shortk's corner), the declaration drops to 1..8 instead of losing the fold. Greedy output is identical to main (300 tokens, two prompts). arch_test: qwen35_fp8_mxfp4_feed_forward_folds_verify_steps_up_to_16_rows (one and two sequences of 8 rows fold, three to eight take the pair). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
187a015bda | sched: tighten preempt gate headroom and test pool | ||
|
|
e668d493d9 | sched: gate preempted prefill on whole recompute plus running headroom |