Commit Graph
529 Commits
Author SHA1 Message Date
Code000andClaude Opus 5.5 d0fd4aa1bb spec: --draft-verify token|block|traversal for the coupled MTP chain
--draft-coupling verifies each row of the chain on its own. Two lossless
sequence-level verifiers accept more drafts from the same chain: Block
Verification (arXiv 2403.10444) decides the whole chain at once, Traversal
Verification (arXiv 2505.12398) walks a path from its last draft back to its
first. --draft-verify token (default) is the engine as it was; block switches
the coupling on; traversal needs it and is refused otherwise.

Block: the sampler marks the consecutive bound rows of a request with the
block's length (RadMtpCoupleState::blk) and mtp_couple_verify decides the block
on the workgroup of its round-1 row, every FP64 sum a fixed lane tree so the
result is the host reference's bit for bit. The wide-plane serial helper is a
kernel of its own, which leaves couple_verify without scratch.

Traversal: a new op mtp_trav_verify takes the step's topology (parent row, draft
token per row) and decides a request on one workgroup, 0 bytes of scratch: the
target's law as integer masses of a fixed-point exponential, the walk in FP64.
Its header and kernel also handle nodes with several children (Gumbel-top-k and
RheoSampling siblings); the serial head here drafts one, so that part has no
producer yet and is covered by the tests only.

RadMtpCoupleState grows from 152 to 168 bytes (nkids, scheme, blk), so
RAD_ABI_VERSION is 41.

Exactness: mtp_block_test enumerates the draft tree of a toy model and runs
chi-square over the real verify code; mtp_rrs_test runs chi-square and an
exhaustive enumeration of the walk (worst |joint - P| 7e-14) with negative
controls that fail; spechub_device_test compares the device rows with the host
rows. Measured on Qwen3.8-Flash-Next IQR-V4 (TP2, MTP chain 3, coupling) on our
branch: about +1% tok/s with traversal, +4.6% at T 1.0 top_k 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 21:49:45 +01:00
Code000andClaude Opus 5.5 e912b04f5a libr4d: skip the scalar-cache invalidate behind chained waits in kernels that make no scalar load after the wait
r4d_chain_wait() ends in r4d_chain_acquire(): the agent-scope fence for the
vector caches and s_dcache_inv for the scalar data cache. The latter is needed
only by a kernel that reads, behind the wait, something an earlier launch of the
chain wrote through a scalar load (a value all lanes share). s_dcache_inv also
costs the refetch of every kernel argument afterwards, on every wave.

New r4d_chain_wait_vec() waits with the fence alone. It is used at 41 wait
sites in 20 units (the IQR m16/m64, w2a8/w4a8/w8a8/bf16/i8_kpar and fp8a8
GEMMs, the activation quantisers, the attention decode and paged-window
kernels, hc_*, the norm and activation kernels of r4d_model_bf16, rowtopk,
ple_gate, prefetch, dflash_conv, the all-reduce). A wait site keeps the full
flush when any instantiation of its kernel has a scalar load after the acquire.
-DR4D_CHAIN_SCINV_ALWAYS puts the instruction behind every wait again.

tests/chain_scalar_audit.py (ctest chain_scalar_audit, label slow, no card)
keeps this honest: it compiles every chained HIP unit to gfx1201 assembly with
the flags of compile_commands.json and fails when a chained kernel without
s_dcache_inv has a scalar load, from a base other than the kernarg segment
s[0:1], behind its global_inv. Building the audit with
-DR4D_CHAIN_SURVEY_NO_SCALAR (every wait skips the flush) flags 1123 kernels,
so the check does detect the real cases; as committed it reports 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:43:11 +01:00
Code000andClaude Opus 5.5 ca7a7212ec qwen4exp: verify/decode pass launch order, prefetch width, chain polling, turnover slots
Lossless (no kernel arithmetic or operand change): the router weight is read beside the mixer
all-reduce; k/v projections before q|gate; the indexer's keys behind the attention launches within
the exact bound; verify-height prefetch at 32 workgroups (`prefetch` takes an optional `blocks`
param) and the shared down arm before the routed down from 2 rows (kVerifyRows); chain waits poll by
grid size (R4D_CHAIN_TINY/SMALL/MID); the mover's kept-free turnover slots follow the swaps the
engine asked for (MoverConfig::turnover_adaptive) instead of a fixed 640.

arch_test: new a_flash_next_decode_step_orders_its_small_launches; the pinned graph fingerprints and
step hashes of qwen4exp_fp8 move (re-pinned). place_test: the adaptive turnover. r4d_selftest: the
`blocks` param of prefetch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:33:07 +01:00
Code000andClaude Opus 5.5 946a6f9e2b aql: the prefetch stream takes the half-lap system acquire too
The expert-prefetch stream (rad_xp_stream_create, agent_only) downgraded every system-scope
acquire to agent scope because it reads no host-written data. Its kernel arguments are
host-written into its own ring, though: after a wrap, an agent-scope acquire leaves the slot's
old line in the L2 and the launch runs with the previous lap's arguments. Keep the exemption
for host writes and epochs; take the system acquire on the ring's half lap (one in 2048
prefetch launches). New device test: launches on a prefetch stream across three ring laps read
their own arguments -- 8709 of 12805 stale without the fix, 0 with it.

Fixes #491

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:32:20 +01:00
Code000andClaude Opus 5.5 01f08152dc aql: no packet-header acquire on chained launches whose kernels acquire for themselves
A chained kernel that has lost its barrier bit is launched ahead of the kernels
it depends on and reads nothing until its prologue wait has passed, where it
acquires itself (and, since the previous change, empties the scalar cache). The
acquire in its packet header runs when the packet processor launches the kernel,
before the launches in front have written, so it guards nothing the kernel
reads and only holds the packet processor: on an R9700, 2.1 us per launch with
the agent-scope acquire against 1.2 us without.

rad_kernel_chain may now answer 2 (libr4d's rows do): the chained forms' acquire
covers everything they read. The loader records it (KernelRow::chain_fenced);
the engine asks rad_dev_chain_infer(2) when chaining pays and every row that can
chain, from every loaded library, says 2 (one row answering 1 keeps the acquire
on all chained packets). The backend then issues a chained dispatch without its
barrier bit with no header acquire, live and in played passes, unless the ring,
the host epoch or a copy asks for one; releases, barrier packets, plain kernels
and the prefetch stream are untouched, and a card with its arguments in VRAM
and no HDP flush register keeps the acquire. RADIANCE_AQL_CHAIN_FENCE=1 puts it
back on every chained launch.

Qwen3.8-Flash-Next IQR-V4, TP2, MTP chain 3 with coupling, ABBA over 2 pairs:
+0.75% tok/s [0.73, 0.78], all 156 texts identical. The three device tests
added before now also run with the packets unacquired, and a shipped-plugins
test requires libr4d's chained rows to answer 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 19:21:59 +01:00
Code000andClaude Opus 5.5 cfec01ec8d qsa: skip score/select where no attention reads them; select once per pass below the exact bound
Architecture-only (no kernel, op schema or graph change). The attention block tells the indexer
whether it reads the selection (AttnGatedFP8::qsa_use): dense steps (<= 1024 tokens of context)
issue no query norm, qsa_score or qsa_select; single-row-per-sequence steps under the exact bound
read the block table; multi-row steps under the bound select once per pass (the selection is
layer-invariant there, every complete block in block order) and the other QSA layers reuse it.
Block keys and tail run every step. The exact host bound (RadBatch::kv_used_max_h) decides which
side of the bound a step is on and keys the pass. RADIANCE_DEBUG_QSA_EAGER=1 restores the old
issue pattern.

arch_test: the pinned step hashes of qwen4exp_fp8 move (graphs unchanged) and two tests pin the
new issue pattern; ref_test pins the equalities it rests on (qsa_select below the bound).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:41:16 +01:00
Constantin d1b5a45e31 feat(qwen4exp): support U4 gate with W6NL down experts 2026-11-17 18:35:11 +01:00
John 590dbcc178 fix(minimaxh3): keep mixed-site encoder operands host-readable 2026-11-17 18:28:50 +01:00
keptn42 73a284d799 data/recipes: ling-3.0-flash-iq8r-w4nl64
The recipe of Ling-3.0-flash and its fine-tunes on an IQ8R trunk: the trunk lines of
ling-3.0-tiny-iq8r.recipe, the 512 routed experts of a layer as rotated four-bit codes into the w4nl
codebook at an E4M3 scale a (row, 64 of K). An empty CALIB directory rounds the experts to nearest
with a scale search.

Ling-3.0-flash-Sante converted with it (experts rounded to nearest) on four R9700 against the bf16
original, 80 MT-Bench questions, 42,767 tokens: mean KL 0.00461, 99th percentile 0.0494, top token
the same 98.0 %.

the_ling_flash_iq8r_w4nl64_recipe_decides_the_model_it_was_written_for reads the recipe as it ships
over the plugin's names: the IQ8R trunk, the w4nl64 experts, the shared down projection, the f32
casts and the weights kept bf16. recipe_test: 14 of 14 cases; ctest -LE 'gpu|oot': 181 of 181 (3
skipped).
2026-11-17 18:26:13 +01:00
keptn42 33f9644701 bailing_hybrid: Ling-3.0-flash on an IQ8R trunk
Flash clamps its SwiGLU in its last layers (routed 35-41, shared 34-41). The plugin and MoeFP8's
check for int8 activations refused a rotated int8 trunk over them, since the int8 gated products
had no clamped form. With the previous commit they have one, so both refusals go. MoeFP8
keeps the refusal for a W5NL down projection: no clamp writes its rotated E4M3 codes.

flash_iq8r_clamps_its_gated_products_then_quantises_them_rotated declares flash's IQ8R container
at one, two and four ranks, every rank: 15 swiglu_step, each followed by had_quant_act_i8g reading
its plane at group 128; against the same container without the clamp lists 15 ops more and 15
gated_had_quant_i8g fewer, and no unrotated int8 or E4M3 quantiser. The steps run lint-clean. It
fails without the previous commit. The graph hashes of the bf16 and four-bit containers stay the
same. bailing_hybrid_arch_test: 9 of 9 pass; ctest -LE 'gpu|oot': 181 of 181 (3 skipped).
2026-11-17 18:26:13 +01:00
Constantin 79ac2bd50d Add Muse Glimmer IQ4R-V4 with quantized DFlash2 2026-11-17 18:24:56 +01:00
Code000andClaude Opus 5.5 7bd195d394 vram: charge the runtime's resident queue scratch to the card budget
Once a kernel with a private segment has been dispatched (rad_step_advance has
544 bytes a lane), the HSA runtime hands its queue scratch memory and keeps it:
about +114 MiB on a card after the first speculative step, +150 MiB with a
larger segment, with or without HSA_NO_SCRATCH_RECLAIM. The VRAM budget does
not count it, so a serving process was left with only 27-65 MiB free after its
first speculative steps -- a thin margin for any kernel that later takes a
bigger private segment (the runtime then faults the queue with OUT_OF_RESOURCES
instead of failing the load).

The backend now reports rad_dev_resident_scratch_bytes(): 5 MiB per CU (160 MiB
on an R9700, which reports 32), over the measured 114-150 MiB, and 0 on the
host backend and on unified memory. The engine puts it into VramFacts::
queue_scratch, and the budget charges it with the hardware queues (the
resolver, vram_budget_need, and the report line).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:18:56 +01:00
Code000andClaude Opus 5.5 8dcd8fdcd7 place: --expert-pin-top cuts fractional profile shares correctly
pin_hot() set the pin threshold to the share at the cut minus 1.0, which
assumes integer gaps between shares. A profile's per-layer shares are
fractions in [0, 1] (xs_profile_load divides by the layer's total), so the
threshold went negative and every resident expert counted as pinned at any
--expert-pin-top, leaving the heat engine no slab slots (decode -4..9% on
Qwen3.8-Flash-Next IQR-V4 against the same run without pinning).

The threshold is now the share just below the hot set (-1 when the hot set
is every expert, so everything pins). A test with fractional shares pins the
hottest quarter and fails without the change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:17:08 +01:00
Code000andClaude Opus 5.5 8f2e511fcc aql: flush the host data path before every doorbell; empty the scalar cache behind a chained wait
Two latent bugs that the packet processor's acquire (about 0.9 us a launch) has
been hiding by timing.

1. Kernel arguments and the chain record are written into VRAM through the BAR,
   and the card's host data path keeps such a write until it is flushed. Nothing
   ordered that against the doorbell (the sfence only orders the CPU's own
   buffers). A kernel the card starts a microsecond or two after its doorbell
   reads the slot as the launch one lap of the ring before left it: old
   arguments, or no chain record, in which case the launch counts nothing and
   the chained launch behind it waits for good. The backend now stores to the
   card's HDP flush register (HSA_AMD_AGENT_INFO_HDP_FLUSH) in front of every
   doorbell, in publish() and in a played pass's ring(). Without a register
   (the argument ring in host memory, or a driver that gives none) nothing
   changes, and a warning says so at startup.

2. rad_chain_wait()/r4d_chain_wait() end in an agent-scope acquire fence, which
   invalidates the vector caches. A load whose address every lane shares is a
   scalar load, served from the scalar data cache, and nothing but the packet
   processor's acquire (which runs when the kernel is launched, before the
   launch in front has written) empties that. A chained kernel can therefore
   read a stale scale, count or activation from the arena address an earlier
   launch read. The waits now issue s_dcache_inv behind the fence
   (r4d_chain_acquire in libr4d, chain_kernel.h in the core's blit kernels).

Evidence on an R9700 with the packet acquire left as it is: a probe of
1024-block readers behind a chained wait saw a stale shared value in 1 launch
of 1800 without the s_dcache_inv and in none with it; card-side copies issued
one by one with 50 us between them stalled the queue in its first lap, four
runs in four, and six runs in nine of 300000 back to back ended with a unit
moved by another launch's arguments, when the packets went without their
acquire and without the flush, and in none with the flush.

New device tests: a chained reader sees a shared value the launch in front
wrote, a chained launch reads its own arguments after the ring has lapped, and
a copy issued after a pause finds the record written for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:16:12 +01:00
DokterSmol bfadfbee76 tests: lfm3 int8 and IQ8R trunks
Declare and step of the IQ8R container, the plain int8 trunk beside the
bf16 one, the trunks the plugin refuses, and the shipped recipe's
container against the bf16 container of the same tiny checkpoint.
2026-11-17 18:12:32 +01:00
DokterSmol 6b96295f54 tests: lfm3's config.json through the checkpoint reader
The rotary per attention class with the full layers' partial factor, the
window, the layer list and the booleans arrive as the keys the plugin reads;
the typed rope_theta is the default, which the plugin does not read.
2026-11-17 18:12:32 +01:00
DokterSmol 29057b0c6b lfm3_bf16: the sandwich joins as norm_add_norm where a library serves it
A layer's post norm, residual add and feed-forward norm are one launch, and so
are its feed-forward's post norm, add and the next layer's input norm: 50
launches for the chain's 144 at 24 layers. The op is asked for with
rad_op_declared, as gemma4 does; libref and libavx do not carry it and run the
rmsnorm / add / rmsnorm chain, as does the last layer's feed-forward. The arm's
output has its own buffer, since a join reads it beside x and writes h.
2026-11-17 18:12:32 +01:00
DokterSmol 1f00224501 libhalo: windowed attention at head_dim 128 with 4 queries per kv head, and the row-form names of rope and rmsnorm
What LFM3 needs on gfx1151 beyond the rows libhalo has. The window kernel is
instantiated at (128, 4) as in libr4d: the decode leg keeps q_len <= 16 and
every longer q_len, windowed or not, lands on the new pair. rope_rows and
rmsnorm_rows are registered under their row-form names and launched as rope
and rmsnorm, as libavx and libref register them, so a plugin written for
libr4d's row forms resolves on this part instead of falling to the host.

Emulator cases as libr4d's (split verify, ragged window, fp8, non-causal with
a missing block, WMMA prefill with and without the window) and selftest
launches.
2026-11-17 18:12:32 +01:00
DokterSmol 21c4544b61 tests: lfm3 resumed from the prefix cache equals a cold run
The full-attention layers resume from cached blocks, the sliding layers from a
window snapshot and the convolutions from the same checkpoint slot; under
--prefix-resume exact and nearest the reply and its probabilities equal a cold
run's.
2026-11-17 18:12:32 +01:00
DokterSmol 6997f8da14 tests, docs: lfm3 in the family tests, with its golden and declare cases
A tiny LFM3 (conv, full attention, conv, sliding attention; window 8, conv
width 7) joins the engine tests every family runs: the golden against the
reference implementation, chunking and batching, libavx against libref,
decode against prefill, concurrent requests and speculation by prompt lookup.
Its golden is made by mklfm3golden.py from the modelling code LiquidAI ships
with the checkpoint, since transformers has no LFM3 class.

arch_test covers what the plugin declares for each layer kind, what it
refuses, and a step through both attention groups.
2026-11-17 18:12:32 +01:00
DokterSmol 660d410196 libr4d: windowed attention at head_dim 128 with 4 queries per kv head
LFM3's attention: 16 query heads over 4 kv heads at head_dim 128, in full
layers and in sliding layers with a 256-token window. The decode leg
(r4d_attn_paged_h128_gqa4.hip) serves q_len <= 16 and ranks above; every
longer q_len had no row at this geometry. A row pair (bf16 and int8
cache), its constraints, selftest launches and emulator cases (split
verify, ragged window, int8 cache, non-causal with a missing block, WMMA
prefill with and without the window).
2026-11-17 18:12:32 +01:00
Victor Ionescu 38c182a2ba chat: a tool-call delimiter is not a turn terminator
A converted checkpoint can name a token end-of-generation that the chat format
itself writes as one of its call delimiters -- Qwen3.8-Flash-Next's
`</tool_call>` is a single added token, and a container that lists it in
generation_config's eos list stops every tool-calling turn the moment the call
closes. The damage is worse than a late stop: a second call is never written,
finish_reason says "stop" on a tool-calling turn, and a reply that quotes the
tag as that token is cut mid-sentence (seen in a coding session where the model
wrote about the template and the turn ended between two tokens).

The bridge already derives the format, so it knows what the model writes as a
call boundary. It now reports the end-of-generation ids whose spelling is one
of those markers, leaves them out of the reply parser's terminators, and the
engine demotes them in the decoder's stop predicate with a warning. The
template's real terminator (<|im_end|>) is untouched, and a model without
tools, or a container that names nothing extra, is unchanged.
2026-11-16 18:03:16 +01:00
Victor Ionescu b988378e70 chat: read a function name that ends at whitespace (Ling 3.0)
Ling-3.0-flash's template writes a call as the opener, the function name, a
newline, and only then the argument tags:

    <tool_call>read
    <arg_key>path</arg_key>
    <arg_value>/a</arg_value>
    </tool_call>

The differential analysis names the function between the opener and the first
argument tag, so its end is the bare newline and name_suffix comes out as
whitespace alone. chat_format_check refused that, so every request carrying
tools answered 501 with "this model's tool calls cannot be read back:
name_suffix must end the function name with something besides whitespace" --
the whole tool-calling surface, for every Ling-3.0 checkpoint.

A suffix with no core of its own is the suffixless ending written out: the
name stops at the whitespace. The reader now takes it that way (name_open keys
on the trimmed core, so the name runs to the first arg_prefix or call_end,
whitespace trimmed), while the grammar still writes the template's newline.
The object family has no such terminator -- its brace ends the name -- and
keeps the refusal, as does the wrapped format whose bare name_prefix would
otherwise read as a call.

Adds the real template as a fixture and a regression test that derives the
format, builds the grammar, and reads a two-call reply built from the derived
fields; a second test pins the object family's refusal.
2026-11-16 18:03:16 +01:00
Constantin ba3ebd380f feat(qwen4exp): support calibrated U5 gate/W5 down recipe 2026-11-16 17:58:41 +01:00
keptn42 157959fd80 server: a control-vector variant, MODEL:NAME, that runs with the vector on
A request turns the control vector on with the `control_vector` body field, or the deployment's
default applies. A client that can only choose a model cannot send the field, and a gateway can
allow or refuse a model by its name but not a field. --control-vector-variant NAME lists
MODEL:NAME as a child of the model, the way an adapter is listed, and a request naming it runs
with the vector on whatever the default; the model's own name keeps the default. Unset, the
default, lists nothing.

The key needs --control-vector off or on. NAME keeps the rule model names keep (no ':' or
whitespace), and may not be a --lora adapter's name or the served model's own. The variant's
name with "control_vector": false is refused, since the request asks for both. With adapters
enabled the variant takes no adapter lookup, and /v1/load_lora_adapter refuses its name.

config_test 68, fleet_config_test 18 and server_test 191 cases pass, and the host suite
(ctest -LE 'gpu|oot') passes. On two R9700s at TP2 (Qwen3.8-Flash-Next IQR-V4 with the shipped
vector), through the front: /v1/models lists MODEL:uncensored and GET /v1/models/MODEL:uncensored
answers; a policy prompt to the variant is answered and to the model's own name refused; the
variant with "control_vector": false is a 400.
2026-11-16 17:57:46 +01:00
keptn42 aadabde0de http: a route's captures replace those the request already carries
Router::dispatch put a route's captures into the request with std::map::insert, which keeps a key
the request already has. The front matches /v1/models/ID itself and hands the request to the
model's router with the path rewritten, an alias as the model's name and base:adapter as the
adapter's, so the model read the front's id: through the front, GET /v1/models/ALIAS and
GET /v1/models/base:adapter answered 404. The captures of the route that matched now replace those
of the same name; nothing sets a request's params before a dispatch otherwise.

server_test: a_request_handed_on_reads_the_capture_of_the_route_that_matched_it fails without the
change and passes with it.
2026-11-16 17:57:46 +01:00
Jintak Han b27f352259 Adapt gemma4_bf16's SWA implementation to gemma4 2026-11-16 17:53:54 +01:00
fl0l0u c9bce68d45 museglimmer: the reply-format table moves to arch/common
chat.h sat in arch/museglimmer/ while the ct plugin and chatparse_test
included it across the directory boundary -- a shared reply-format
table, and the house answer for that already exists twice over:
rad_gemma4_chat.h and rad_deepseek41_chat.h in arch/common. Moved to
rad_museglimmer_chat.h beside them; the three consumers take the same
<arch/...> include the other two already use.

Standards axis of the 2.1.0 review pass, finding 9.
2026-11-15 22:02:30 +00:00
fl0l0u 97b4590761 mm+text+tests: three one-line residues the 2.1.0 review pass logged
The ATEM handoff's think_out called touch(0) twice on the hold branch
(harmless -- touch is edge-triggered -- but a merge artifact in an
otherwise surgical state machine); processor.cpp grew a second,
byte-identical Python-rounding helper 700 lines below the one it
already has, renamed only by an underscore; and the rewritten
RAD_TESTS_NO_CORE comment hand-enumerated eight tests while the set
below it names nine -- the comment now points at the set instead of
drifting from it again.

Standards axis of the 2.1.0 review pass, findings 6, 7 and 10.
2026-11-15 22:02:30 +00:00
fl0l0u c256342bc1 tests: the hash-check tests read the shared timeout, not a literal
artifact_sums and vendor_sums each set TIMEOUT 120 outright, where the
tests around them use ${RAD_TEST_TIMEOUT}. In the fast (Release) gate
the variable is 120, so the fast suite is unchanged -- but under ASAN,
TSAN or a Debug build it rises to 600 for every sibling, and these two
shelled-out hash sweeps over the vendor and artifact trees stayed pinned
at 120 there, the one config where a filesystem walk can be slowest.

Same idiom as the neighbours now: one knob, no per-test literal to
forget when the budget moves.
2026-11-15 22:02:30 +00:00
fl0l0u 66b0dcf019 server: the guarded-route set is declared once, at registration
The front kept its own list of which routes answer the local operator
keyless -- guarded_route spelled out the same eight (method, path)
pairs Server::register_routes registers with a local_operator handler,
and its comment admitted the copy ("Kept in step with Server::register
routes"). A new guarded route meant editing the registration AND the
front's list AND the test that pins the list against drift; miss one and
the front wakes a parked model for a stranger who is then refused -- the
exact A-05 bug class -- silently.

Router::add now takes a `guarded` flag, set on the six registrations
that guard (and their DELETE siblings). Router::guarded(method, path)
asks the matcher -- the same split_path + :label match that reaches the
handler -- and the front copies the flag as it mirrors each model route,
so guarded_route is one line reading the front's own copied marks. One
declaration per guarded route, at its registration; the matcher that
decides the wake is the matcher that dispatches, so slash and :label
forms cannot disagree with the handler and the drift risk is gone.

front_test still pins every shape (guarded: slashes, /sessions/:label,
the trailing-slash collapse; not: GET /sessions, /stats, inference,
/sessions/a/b) and transport_test exercises real dispatch through them.
Behaviour unchanged -- the same eight routes wake nothing for a stranger.
2026-11-15 22:02:30 +00:00
fl0l0u 5e2e596644 format: bound the geometry the bailing layout products are built from
The layer-count cap made the walk safe; the arithmetic was still open.
The rebuild multiplies container-supplied widths in int64 -- heads *
(nope + rope) rows for the q_b split, heads * 256 * latent for the
fused kv -- and hands the products to sized allocations and a
comparison. A wrapped q_b product that coincidentally equalled the
tensor's rows would run the split at a wrong per-head boundary (the
bytes stayed the file's own, but the weights went to the wrong names);
on the 32-bit tier, an overflowed element count truncates through
size_t to a small allocation the copy then overruns.

The family gate now caps what these products are built from -- heads
and the MLA rank at 4096, rope at 256 dimensions, the full query width
at 65536, the layer group within the stack; the shipped geometry is
128/64/512 with tens of heads -- and the q_b row product is computed
with overflow checks instead of trusted. checkpoint_test pins the wide
heads and rank against the honest small stack.

Found by the 2.1.0 review pass (axis: hostile model files); widened
past the reported site to the fused-kv product the same axes cleared
only as file-bounded.
2026-11-15 22:02:27 +00:00
fl0l0u d893fd05d1 diag: the baseline and corpus files are read like the reports they are
Both files diagnose consumes are written by other runs and pasted
between people: --diagnose-baseline is an earlier report, the corpus a
forwarded file. Neither was read like a supplied file. The baseline got
the unbounded Json::parse, and compare_outputs then walked it with
throwing accessors -- a member it does not expect throws, and nothing
between run_diagnose and main catches -- so a crafted "earlier report"
aborted a run with std::terminate after hours of benchmarking work. The
corpus got a hand-rolled unbounded fread loop and a raw parser per
line: a deep line recursed the parse to a stack overflow before the
fingerprint check could ever run.

Now: capped read and parse_container on both (the corpus's size refusal
lands before the bytes are read), a per-line over/deep refusal that
names the line, and one try around the comparison so any structure the
comparison does not expect is the refusal it should be -- "the baseline
is not shaped like a report", parity not compared, the run keeps its
own results. diagnose_test pins the deep line.

Found by the 2.1.0 review pass (both security axes, independently).
2026-11-15 22:02:27 +00:00
fl0l0u f4981154fc text: the tool-call arguments probe parses under bounds
bad_arguments names the offending tool_calls[].function.arguments when a
refused conversation reaches it -- and it probed each string with the
plain Json::parse. The HTTP edge depth-caps these strings (its comment
is explicit that the strings could otherwise overflow a worker's stack),
but nothing capped the VALUE COUNT: a client whose conversation had
already failed the template -- exactly the path this refusal exists on
-- could hand the probe a few million flat values, and the probe grew a
DOM no one would ever read, once per request, inside the body's 512 MiB.
Offline callers (fleet, diagnose) reach the same path with no edge at
all.

The probe is parse_bounded now, at the same depth the edge enforces and
a values budget a tool call cannot approach; over, too deep, and not
JSON each name themselves in the refusal, and the honest case still
refuses in the template's own words. chat_test pins all three bounds.

Found by the 2.1.0 review pass (axis: hostile sockets).
2026-11-15 22:02:27 +00:00
fl0l0u 392746da6b museglimmer: the vision tower bounds the config it allocates by
MuseTower::declare read vision_config.num_hidden_layers and the position
grid with only a positive check, then handed them to host vectors --
full.assign(depth), L.assign(depth) -- before any weight was consulted.
A container stating 2^62 layers threw std::length_error (or bad_alloc
just below max_size) out of the declare phase, and nothing between there
and main catches: the process died with a SIGABRT and no report, where
every other bad config in this file says what it dislikes on stderr and
refuses with RAD_E_INVAL. The grid sides were the same story multiplied:
pos_emb_height x pos_emb_width is a signed product of container values
that can overflow before any comparison could see it.

The gate now refuses depth past 128 and a grid side past 512, against
published maxima rather than round numbers: the deepest vision encoder
ever shipped is 48 layers (ViT-22B, InternViT-6B -- this family's towers
are SigLIP-class, tens), and the largest stored position table a side of
92 (SigLIP at 1292 px over patch 14; CLIP 16, SAM 64; native-resolution
towers store no side x side table). The caps sit ~2.6x and ~5.5x past
those, so they never bite an honest container, and at the cap itself the
guarded shapes are harmless: the depth vectors cost KiB and the grid
products top out at 2^18, too small to wrap signed 64 before a
comparison sees them. museglimmer_test pins both caps at their boundary
and far past it -- the grid at both sides together, since one side
alone the height==width rule refuses before the cap is consulted.

Found by the 2.1.0 review pass (axis: hostile model files); caps
sourced against published encoders and tightened at the operator's
request, from the first pass's wide 512/4096 margins.
2026-11-15 22:02:26 +00:00
fl0l0u 4943bba2fb format: a bailing container must promise a walkable layer count
bailingmoe3_layouts rebuilds the release GGUF's layouts by walking every
layer the container claims -- and it runs on the open path, before any
plugin gets a vote. Its gate checked the counts were positive and nothing
more: a GGUF naming 2^62 blocks sends the name-probe loops over centuries
of iterations. The process never listens, never refuses; StallWatch notes
the silence after two minutes and stops there. A negative
first_k_dense_replace opens a second loop of the same order, starting
below zero. This is a hostile container's permanent hang, the same
supply-chain class as the round-two finding on the shard index: the
refusal must land before the walk.

The gate now caps n_layers at 4096 (the family's real models are an order
of magnitude below; 4096 layers is not a slow load either) and requires
the dense prefix to lie inside the stack. checkpoint_test pins all three
shapes -- 2^62 layers refused, negative prefix refused, a small honest
stack opens as before -- and the test GGUF writer gains the INT64 KV type
they are spelled in, which the u32 field could not carry.

Found by the 2.1.0 review pass (axis: hostile model files).
2026-11-15 21:15:23 +00:00
fl0l0u 90b1229bfc place: the profile file is read like the untrusted file it is
--expert-profile read its file with no size cap -- any file, gigabytes,
appended into memory before a single check -- parsed the text with the
unbounded parser, and took n_trunk_layers through int32. That last one
is the quiet one: the loader refuses "this profile is for another
model" by comparing the file's layer count with the live model's, and a
value that wraps past 2^32 lands on exactly the number the comparison
asks for.

The read now caps at 64 MiB while appending -- past it, nothing further
is grown and the file is refused by name -- the parse is the container
helper (parse_container) like every other file input, and n_trunk_layers
is read as int64 and range-checked before it reaches the comparison. An
xstats_test case pins the loader's three refusals -- wrapped trunk
count, negative count, oversized contract -- and the tmp-symlink
refusal of the previous commit: the planted symlink survives untouched
and the profile file still lands.
2026-11-15 20:38:10 +00:00
fl0l0u 444b85158b scripts: hfget refuses names curl cannot fetch faithfully
A listing entry named "weights.bin#x" downloaded cleanly, checked clean,
and was the wrong object. curl ends a URL path at '#' and '?': it
requested "weights.bin" while hfget recorded the entry as
"weights.bin#x". An attacker who lists the truncated object's real size
and oid under a decorated name passes the size check, the oid check and
the manifest -- the bytes arrive under a name nobody asked for, and the
directory reads complete. hfget's name screen checked traversal, control
characters and its own manifest, but not curl's path terminators.

The jq screen now refuses any entry whose name carries # or ?. The child
that writes each file re-screens its name too, and its old case missed a
name ending in "a/.." (the parent's regex caught those, the child's did
not) as well as the terminators -- both arms added, the `?` quoted so it
stays literal and not the single-character wildcard. Two hfget tests: a
listing carrying "model.bin#x" is refused whole, and a child handed
model.bin#x, model.bin?y or sub/.. refuses before any request or write.
2026-11-15 20:38:10 +00:00
fl0l0u 965a7caa51 hf: a lone container does not outrank weights beside it
Give --model org/repo and the engine picks what to serve from the fetched
directory: one .rad on the top level won outright, whatever else was
there -- and .rad was not in the skip list a safetensors set imposes on
.bin/.pth/.gguf, so hfget fetched the rival too. A repository that ships
a real safetensors set beside one decoy .rad chose for the operator: the
container wins, the engine loads and serves it in place of the model the
operator named.

hf_served_path no longer resolves that tie by rank -- a container among
safetensors or gguf weights is refused by name and the operator passes the
file they mean -- and hfget skips .rad when a safetensors set is present,
as it skips every other rival. A repo holding only a container still
serves it: the fix is against the silent tie-break, not against .rad.
2026-11-15 20:38:10 +00:00
fl0l0u 4c9a79ca98 tests: the served dashboard bytes get hashed from outside
dashboard_page.h is the Node build of dashboard/, committed because the
engine's build has no Node. The ctest dashboard_page compares dashboard/'s
sources against the digest recorded INSIDE that header -- which proves the
sources and the header's own claim agree, nothing more. Rewrite the header
and its embedded digest together and the check passes while the engine
serves a page nobody built from these sources.

artifact_sums.sh hashes the artifact itself from outside, the mechanical
half vendor/SHA256SUMS is to vendor/UPSTREAM: tests/ARTIFACTS names every
committed built artifact and its hash, and a lone tamper of a served byte
now fails. A rebuild re-records the manifest in the same commit. The
residual gap -- a single commit rewriting an artifact AND the manifest --
is exactly the vendor-tree gap, and documented as such.
2026-11-15 20:38:10 +00:00
fl0l0u be09d90c71 libquant: the codebook loader caps as it reads and refuses an infinite unit
vq= is the one codebook path that reads a file; table= caps its values
at 4096 but vq= appended every line to a growing vector and checked the
count only after reading the whole file, so a 10 GB codebook grew 10 GB
of vector before anything said no. And its "# unit X" line parsed X with
sscanf %lf -- which accepts "inf" -- while the fallback guard was
!(unit > 0.0), an infinity passes. A "# unit inf" file set every decoded
value to infinity.

The count is now checked as rows append, at 4096: the widest code the
grid emits is u12, so past 4096 codewords could not be indexed even with
the memory read, and the old code silently mis-indexed the over-4095 case
itself. And only a finite positive names a unit -- "inf" and "nan" fall
back to the entries' own rms, as a malformed value already did. A
quant_test case pins the 4096/4097 boundary and that "# unit inf" now
decodes finite.
2026-11-15 20:38:10 +00:00
fl0l0u 981cd1e4e1 format: the index does not get to reach outside the model dir
hfget screens the names a repository LISTING carries, but the shard
index is one of those listed files, and nothing screened what its
weight_map names. An index of "../../etc/passwd" led the loader to open
that path -- outside the model directory, as the serving user -- and a
directory merging two checkpoints has every reason to hold a real index.

shard_name_ok now reads every weight_map value before the first open:
no absolute name, no empty, "." or ".." component; relative subdirs,
which real repos do use, still pass. The refusal names the index and
the offending shard. A checkpoint_test case opens a poisoned index in
six shapes and the honest one once, and only the honest one reads.
2026-11-15 20:38:09 +00:00
fl0l0u e46a8ba3d4 util: the bounded read refuses before the tree exists
yy_convert enforced its value budget and depth bound in a second pass
that ran only after every frame of the document had been collected into
a scratch vector. The bound that promises a refused body has not grown
memory grew its scratch with the body: a 200k-empty-array swarm counts
no scalar at all, and the old code refused it after the whole swarm sat
in the frame list.

Both bounds are now enforced where a value is DISCOVERED -- every value
counted, containers included, which is what the pre-migration parser
callback counted and what the tests already pinned -- so a body past
either bound ends the walk while the scratch is still budget-sized. What
stays proportional to the body is yyjson's own read arena, capped by the
byte bound at its open, and oai.cpp's comment now says exactly that. A
json_test case carries the swarm.
2026-11-15 20:38:09 +00:00
fl0l0u 7b9f33653f vendor: the jinja engine budgets its nesting and its range()
A container's chat template is server-side attacker data the engine
parses and runs without any budget. The parser recursed once per nesting
block or paren: tens of KB of "{{ (((" or "{% if %}" in one
tokenizer.chat_template stack-overflowed whoever read it -- the
capability probe or the first render -- past every catch, and errors-
as-values cannot hold a stack overflow. And range() materialised one
array element per step: {{ range(4000000000) }} was an OOM per render.

Both entry points now share one 128-level guard whose throw is the same
exception class a malformed template already raises, and range() refuses
above 65536 values -- far past any template that exists, small enough
that the whole range stays transient. The refusals cross the ChatTemplate
seam as the error values the seam promises (a chat_test case pins that
both shapes refuse and that real nesting still renders). UPSTREAM keeps
the addition under the chat lift's record; the manifest re-hashes.
2026-11-15 20:38:09 +00:00
fl0l0u 2fda03ccdd vendor: the pattern parser counts its nesting, and refuses past 64
A tool schema's `pattern` reaches the grammar converter as client data,
and the group scanner recursed once per nested '(': a few tens of KB of
brackets inside one JSON string was an uncatchable stack overflow of the
request worker. The body's depth and value bounds never saw it -- the
brackets are string content, not JSON nesting -- and 0003, the patch that
made this same function survive a hostile pattern, hardened the empty and
the looping cases but never the recursing one. It is the one remote crash
in the audit, and one request is the whole attack.

transform() now counts its nesting and records the refusal once, where
every unwinding frame met the same '(' and repeated it; check_errors turns
it into the clean throw the server already answers with a 400. Proven on
the compile host against the real converter: the 20000-group pattern is
refused by name, a 40-group pattern -- far past anything a real schema
nests -- still compiles. The record keeps the addition under 0003's name,
whose footing it stands on.
2026-11-15 20:38:09 +00:00
fl0l0u b83d53cf19 front: a refused request does not wake a model to be refused
Every forwarded request leased its model, and the lease fired demand for a
cold or parked one before any handler ran. On the guarded routes -- the lora
admin, /diagnostics, /reset_prefix_cache, DELETE /sessions, the control
vector -- the handler then answered 403 keyless: the wake had already asked
the scheduler for a real load, which can fetch the repository and evict
residents to make room. Loop one cheap GET over an enumerated model name and
the fleet churns for an audience that never gets an answer.

The front already knows reads that report on a model are no reason to bring
one back; the same courtesy is now owed to a request the guard will refuse.
The fleet hands the front its operator rule -- the very predicate its admin
guard reads -- and a guarded route from anyone else reads the not-open state
and stops. Open models still dispatch, keyed boxes still wake everything,
and the operator keeps the diagnostics that bring a parked model forward.
2026-11-15 20:38:09 +00:00
fl0l0u 41a1aa00fe fleet: the admin routes read all three legs, as the engine's guards do
The fleet front guarded its admin routes with the loopback socket alone.
The socket is the one leg that forges: a DNS-rebinding page is same-origin
with its victim's browser and dials through loopback, and a localhost proxy
delivers remote clients on loopback sockets carrying the public Host. With
CORS open by default, a web page in the operator's browser could unload and
park any model, reload the fleet, and read the topology -- disk paths in
the body -- from outside the machine.

The three-leg rule (loopback socket, no foreign Origin, a Host that names
this box) was Server::local_operator's, locked inside Server. Hoist it to
server::local_operator(request, bind_host, local_hosts) beside the request
whose fields it reads, keep the member as the delegate it now is, and let
the fleet's guard call the very same predicate with its own config's host
and --allow-host names. One rule, two callers, no forked wording.
2026-11-15 20:38:09 +00:00
Deadcode 2a2b756371 radiance 2.1.0
New models. Recursive Flint (39.8B, about 2.5B active) by everplays (#422): `arch/flint`, as an
IQ8R container with rotated int8 experts or a four-bit one, with a sink-aware WMMA prefill
attention and the fused attention prologue at `rotary_dim` 0. Meta Muse Glimmer 30B by
launch80_assets (#423): bf16, an int4 trunk or IQ8R, its windowed vision tower, its DFlash
drafter, the ATEM tool dialect and context extension. Ling-3.0-tiny by RikshaDriver (#441):
served from its GGUF releases or as IQ8R on `bailing_hybrid`, with six more libr3d kernels. Block
FP8, MXFP4 and NVFP4 conversions of the three are not served. IQ8R containers of all three
(round to nearest, no calibration) are on Hugging Face under StillDeadcode: flint-iq8r,
muse-glimmer-30b-iq8r-dflash and ling-3.0-tiny-iq8r. They were checked for sane answers on two
R9700; nothing was benchmarked, and Muse Glimmer's pictures, video and tool calls were not tried.

Speech. Breeze-TTS-2 clones a voice from a reference recording and its transcript, with an
optional delivery direction, by farcryjohn (#436). The published Breeze container needs
converting again with the updated recipe before it can.

Tools. A model entry with `diagnose: DIR` runs a fixed workload on the engine instead of serving
and writes a report: step times, tokens a step, draft acceptance, TTFT and prefill rates by
category, concurrency and prompt length, and with `diagnose-baseline` a token-for-token comparison
against an earlier report (docs/DIAGNOSE.md), by Code000 (#418).

Scheduler. `mixed-step-target-ms` holds a mixed prefill and decode step to a service time, off by
default, by tnhnyzc (#413). `scheduler.stuck-exit` (60s by default, 0 never) ends the process when
the device has advanced nothing for that long, so a restart policy brings a hung server back
(#409, #415, #428).

Fixed. Draft trees with the int8 KV cache, which stopped Gemma 4 31B with DFlash2 on its first
request (#454, diagnosed by aelfwyne). The expert loan held at zero by a few leftover cache blocks
after long sessions (#455, diagnosed by thekk1). The mapped tier's pages kept in the page cache
across a load and a restore, by C_Tamas (#421). Replayed tool calls with blank arguments, and
arguments that are not JSON refused naming the call, by dschmitz (#444). The dashboard's card
temperature reads the junction sensor, by dschmitz (#453). The VRAM shortfall report says what the
KL mode needs, by baKon (#448). The out-of-tree plugin test builds its plugins in parallel and
takes its toolchain from the tree.

Plugin ABI 40: out-of-tree plugins need to be rebuilt.

Thanks to @everplays, @launch80_assets, @RikshaDriver, @farcryjohn, @Code000, @tnhnyzc, @C_Tamas, @dschmitz, @baKon, @aelfwyne and @thekk1.
2026-11-15 16:00:05 +01:00
Deadcode ddcb9c69bb radiance 2.0.0
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.
2026-11-14 22:32:28 +01:00
Code000 451b136874 tests: the preemption cases pin --prefill-interleave 0
The served default --prefill-interleave auto:1 (previous commit) follows measured step times, so the
four sequences of preemption_by_recompute_continues_each_stream_exactly sometimes never overlapped
enough to preempt and the test's CHECK(n > 0) failed in about half the runs under a loaded host
(plain main: 6/6 pass). The cases are sized for the fixed schedule they were written against;
small_pool_args() now pins it. Nothing they check is loosened: the streams must still match and
preemption still happen. With the flag: 6/6 alone and 3/3 beside 40 busy threads, and the case
takes 3 s again instead of 5-12 s.
2026-11-05 20:37:24 +01:00