Commit Graph
81 Commits
Author SHA1 Message Date
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
keptn42 cc46e3b714 core/mm: the Radio image family and video tubelets
Nemotron-H Omni's processor: NVIDIA's size rule for one tile, torch's antialiased bicubic on float
pixels, patches in merge-block order, and video in tubelets labelled as the reference labels them.
A picture and a video frame share one patch row, so one embedding GEMM serves both. mm_test against
golden rows.
2026-11-04 22:08:53 +01:00
Deadcode 19d4e8fe0e radiance 1.17.0
IQR-V4 for Qwen3.8-27B:
- 15 recipes, data/recipes/q38-27b-iq2r-v4 .. q38-27b-iq8r-v4 (2.5 to 8 bits a weight), docs/IQR.md
  "IQR-V4". On the quantisation board's private split every entry has 2-19% less KL than its V3 twin
  of the same size (10-19% from 2.5 to 5.4 bits); IQ4R-L-V4 is 24% below the official FP8 checkpoint
  at 55% of its size, and IQ2R-L-V4 (2.8 bpw) is below the MXFP4 checkpoint. Containers with the
  DFlash2 drafter and the vision tower: huggingface.co/StillDeadcode/qwen3.8-27b-iqr-v4, served by
  deploy/compose/qwen3.8-27b-iqr-v4.yaml (IQR_V4 names the size)
- GPTQ runs in act order inside the column trellis (tcq_order=1); the head-fed projections
  (attn_output, ssm_out) take a bf16 scale a (row, 128) block from five bits up; widths from
  measured prices
- A vocabulary-weighted lm_head: four width classes of the computed trellis (output.k<B>), the
  tokens carrying the probability on the widest, decoded in one launch by logits_gemm_vocab with
  16-bit head activations; 0.62 ms at one token on a TP2 rank against the int8 head's 1.02 ms.
  tools/vhead.py and data/vhead/ build the class split from the bf16 checkpoint; libquant reads the
  head's input Hessian for every class
- At IQ6R-L and up, the int8 lm_head is GPTQ'd against its input Hessian (same bytes, median KL
  -8..-12%)
- embed_lookup_iqr takes u7/u8 tables under a zero point and the 4096-state trellis at 6 and 7 bits
- The whitepaper: radiance.stilldeadco.de/whitepapers/iqr-v4.pdf

Faster IQR kernels:
- The one-token GEMV gives each 16-row weight tile a block whose waves split K (5120 x 6144 at one
  token 42.3 -> 30.0 us), with a biased-int fold, a v_perm activation broadcast and one code stream
  a column
- A 16-token WMMA tile without block barriers serves 2 to 16 tokens (6- and 7-bit codes from one
  token): a 4-bit weight takes 0.52-0.66 of FP8's time from one token to sixteen, 1.15-1.74x V3's
  kernels from four tokens up
- The activation quantisers after the IQR gate_up (gemm_iqr_gated), the delta net's decode conv
  fold (gdn_conv_recurrent_update_had) and the attention gate (gate_had_quant_i8g) are folded into
  their producers, byte for byte the same codes: 128 fewer launches a decode step
- End to end on one R9700 (TP1, no speculation): IQ4R-S-V4 decodes one stream in 24.7 ms against
  the MXFP4 checkpoint's 25.8 at five times lower KL; IQ3R-S-V4 is faster than MXFP4 at 1 to 8
  streams. Prefill stays 8-9% behind MXFP4's 4-bit tile

Quantisation tooling:
- rescale=1 refits each row's scale to its codes after GPTQ; gptqsim measures a tensor's W16A16
  form (tcq_code=mad16); an int8 trunk's calibration Grams can be recorded from the codes its GEMMs
  read (--calib-dir, TP1)
- Fixed: the GPU trellis packs tcq_code=mad16's values two int16 a register

New models (merged):
- Spark 2.5 (spark25: bf16 and rotated-int8 IQ8R checkpoints, tensor parallelism with exact
  collectives, reasoning and tagged tool calls) with its DSpark drafter (exact attention and Markov
  walk ops), docs/SPARK25-IQ8R.md (@gostar)
- Ling-3.0-flash (bailing_hybrid: KDA, dense latent attention with mla_attn_paged, group-limited
  sigmoid routing, the clipped SwiGLU and its MTP layer as a serial drafter), its w4a8 recipes and
  compose files for four and two cards (@keptn42)
- Gemma 4 12B (gemma4_unified, served by the gemma4 plugins): its picture and audio embedders, a
  picture's placeholders read both ways on the sliding layers as the model was trained (the
  scheduler ends no prefill chunk inside such a run; RadBatch::n_bidi), windowed attention at
  head_dim 512, the assistant head as MTP drafter at one, two and four ranks, suppress_tokens from
  generation_config, bf16 and i8g compose files (@keptn42)

Merged:
- The prefill KV split sized by the live KV length rather than the model's max_ctx, recorded passes
  keyed by their split geometry, and --gpu-memory-mib, the inverse of --gpu-headroom-mib (@gostar)
- Possessive quantifiers in tokenizer patterns where the greedy reading provably matches the same
  (Ling-3.0's), and the Grafana dashboard's first screen of totals (@keptn42)
- The dashboard's history line (decode, prefill and TTFT over finished requests, kept in the
  browser, JSON export), session extremes that age and reset on a restart, card-count changes, an
  Advanced tab for the poll intervals, each request's prefill time from admission in /stats
  (prefill_s), and the page's JavaScript run by tests/js (@Memoria)
- From PR #390: the file tier reads a routed layer with its own router's counts and waits for its
  deposits; the stop-string hold-back keeps back only a tail that can still become a stop string
  (before, every delta waited up to the longest stop's length); the sampler's planes are sized by
  the step's token bound, the n-gram ban runs beside a drafter, and a top-1 row issues no candidate
  cut (@Code000)
- The n-gram reader refills its reads as they land, and a decode gather waits on the other rank's
  read of a row instead of reading it again (#369, @pokesjw)
- libr3d's GEMM structs value-initialised so the tape audit sees no padding (@RikshaDriver)

Added:
- --ngram-placement disk=DIR: the n-gram table read from its own file, DIR/ngram-<id>.bin, filled
  from the container at the first start, on a faster or separate drive (#130)

Fixed:
- input_reference's H.264 round trip runs on libopenh264, which the image carries, at a quantiser
  held at the crf (a side under 16 padded and cut back); a build with no H.264 encoder answers 501
  (#163)
- kvtier: at most 1024 session rows under one shared first block; with one shared prompt the list
  grew a row a request and prefill fell from 9k to 2.5k tok/s after 500K requests (#375)
- Speculative steps on an architecture with no pass-key callback keep their recorded passes under
  the live-KV prefill split

Plugin ABI 35:
- RadArgs::kv_used_max_h and wgp_count, RadBatch::kv_used_max_h and positions_h, the optional
  rad_arch_pass_key export and RAD_KERNEL_CAP_DYNAMIC_PREFILL_SPLIT; RadEncoderDecl::bidirectional
  and RadBatch's n_bidi runs. The layout fingerprint table is regenerated; out-of-tree plugins
  rebuild against 35

Thanks to @gostar, @keptn42, @Memoria, @Code000, @pokesjw and @RikshaDriver.
2026-11-04 18:56:58 +01:00
keptn42 a00e5e7094 mm: Gemma 4 12B's pictures and audio
The 12B (gemma4_unified) has no tower: its embedder takes a whole
48 x 48 pooling window as one patch, so a patch is a row (merge 1),
its values u / 255. Its audio is frames of 640 samples as they are,
one frame a token, the last zero-padded. Goldens from transformers.
2026-11-04 07:20:29 +01:00
Constantin c96cfc9e7b test: verify DSpark device KV rollback 2026-11-03 13:56:46 -05:00
Deadcode 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.
2026-11-02 18:35:02 +01:00
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.
2026-10-31 07:50:43 +01:00
fl0l0u 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.
2026-10-31 07:50:43 +01:00
fl0l0u 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.
2026-10-31 07:50:43 +01:00
Deadcode 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.
2026-10-30 22:01:01 +01:00
overchop 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
2026-10-30 15:02:09 +01:00
Gaspa79 94c90b17ad nemotron 3.5 implementation 2026-10-30 10:22:53 +01:00
Brandon Bertelsen ec243c2a7d Merge main into laya-arch-plugin 2026-10-29 13:45:18 -04:00
Code000andPi 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>
2026-10-29 16:23:28 +01:00
fl0l0u 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.
2026-10-29 16:22:35 +01:00
Deadcode 4a61d7296b radiance 1.14.0
New models and formats:
- libr3d: a kernel library for RDNA3 (gfx11) cards
- nomic-embed-text-v2-moe (the nomicbert plugin)
- Gemma 4 E2B with its per-layer MLP width, and Google's unmodified E2B/E4B directories in bf16
- DeepSeek-V4.1-Flash converted straight from its release: the Engram tables, the fused imatrix and
  rad-convert --chat-template for a release that ships no template
- GGUF Q8_0, Q4_K and Q6_K tensors import as their planes; rad-convert writes them without a recipe
- Qwen3.8-Flash-Next-FP8 converts and serves through qwen4exp_fp8

Speed:
- hc_read's decode kernels as one grid (34.7 -> 25.2 us at 4 rows) and its tiled up-mix pipelined
- gemm_fp8a8: the narrow form's scales staged through LDS (Flash-Next int8 at 32 rows 83.6 -> 68.3
  us), the gated three-tile form at 8 waves (gate_up at 48 rows 272.9 -> 180.6 us)
- Qwen3.8-27B: the delta net's out-projection read beside its decode recurrent update (x1 19.40 ->
  19.10 ms a step), and the verify's split-KV attention sized by context depth (x3 at 180K 42.4 ->
  40.3 ms a step)
- Hy-Memory (HYV3) decode: fused QK norm, RoPE and KV store, residual adds folded into the norms,
  coalesced one-token expert GEMMs
- spechub: the coupled verify walks the live candidates only (151 -> 31 us a launch)

Speculation:
- DFlash2: lossless coupled acceptance at T > 0 (--draft-coupling on)
- A block drafter's proposals verified as a tree, on by default for the Gemma 4 31B's DFlash2, with
  a block-16 tree that runs its short block under load

Features:
- Decode-hot residency: --draft-expert-placement host, --expert-profile, --expert-pin-top, and
  --expert-stats FILE for the routed experts each layer selects
- --ngram-placement ram=DIR: one n-gram table shared by engines on separate cards
- Prefix cache: --prefix-resume exact (default) resumes a hit on the cold run's own chunk grid, so it
  answers bit-identically; snapshots at a head other prompts share, from 528-token prompts, and for
  tip-only one drafter window below the tip; hits on models whose KV groups have different block
  sizes; the snapshot store keeps a floor of 8 ahead of --host-headroom-mib
- Typed tool-call argument tags; rad-chatparse --request renders and reads back one request as the
  server does
- MiniMax-H3: keyframes ride a latent upscale
- Gemma 3's fused all-reduce junction on the lossy wire

Fixes:
- A speculative step shorter than its band (an MTP step of 4 rows at gqa 8) no longer stops the
  engine with a scratch refusal at issue (#293)
- --p2p off: prefill back to 1.12.0's rate; 1.13.0's push check read a host-memory slot over the link
  twice (#323)
- A chat template that cannot render a conversation is refused at load, not mid-request
- imatrix entries found under llama.cpp's spelling; the W4A8 prefill's tail scale read; the GDN conv
  kernels on an f32 weight; dense integer rows at the group they compute (a Q8_0 weight at group 32)
- --expert-profile refuses a profile recorded on another model
- hc_read's one-grid wait traps past its deadline instead of reading a stale value

Changes: Plugin ABI 31, unchanged. RADIANCE_DRAFT_TREE, DFLASH2_TREE_NODES, DFLASH2_TREE_TEMP and
DFLASH_Q_TEMP are gone (trees run where the probe says they pay; temperatures 1.25 / 0.6).
2026-10-29 12:04:24 +01:00
Brandon Bertelsen 711cdd0cd7 mica: Mica on /v1/systemone over the qwen35 plugins; d1's readout shared 2026-10-29 00:50:14 -04:00
Brandon Bertelsen 9c605a103d laya: Laya decision models on /v1/systemone (arch/laya) 2026-10-28 23:44:38 -04:00
Brandon Bertelsen d24cf32a13 Merge main into clef-flash-arch-plugin 2026-10-28 22:53:52 -04:00
baKon f43929ccb8 core/mem, core/sched: a prefix hit on a model whose KV groups have different block sizes, and a hybrid's window in the checkpoint slot
DeepSeek-V4.1 declares its compressed attention at one KV row per r tokens: kv_index_r2 and
kv_compressed_r2 at 2-token blocks, kv_index_r1 and kv_compressed_r1 at 1-token blocks, beside a
16-token sliding window (kv_window), a linear compressor state (kv_comp_tail_r2) and a conv window
(kv_engram_tokens). On that model no request ever reused a token, for two reasons:

- PrefixCache::configure took the first full group's block size as its granularity and left every
  paged group with another block size out ("block 1 != cache granularity 2: not cached").
- KVManager put a trunk's window in the checkpoint slot only on a model without linear state, and
  the scheduler refuses a hit that leaves a trunk group uncovered. With linear state beside the
  window, every hit was zeroed (HitCut::Window).

Either alone leaves the hit at zero. On an agent's growing conversation that is the whole context
prefilled again every turn.

The cache now holds every paged group but a windowed one. An entry covers the lcm of their block
sizes and holds lcm / B blocks of a group with B-token blocks (PrefixCache::entry_groups,
blocks_per_entry). A lookup hands each group its own blocks for adopt(); insert, eviction, trim,
rebind, restore_room, release_session and unshared_tokens count per block; trim() and trim_for()
count entries. The chunk quantum is already a multiple of every paged group's block, so
checkpoints and hits stay on the entry grid. With equal block sizes an entry is one block a group,
as before.

A trunk's window rides in the checkpoint slot whether or not linear state is beside it; the slot is
the state, then the window pages, the layout KVManager::checkpoint_copy already walked. The
scheduler lets a hit stand on a windowed trunk group when it resumes at a window snapshot
(win_hit no longer needs a model without linear state); any other trunk group the cache does not
hold refuses the hit, as before. The reserve's trim asks for entries, from the group furthest
short. The idle tiers move an entry as its blocks: TierExec and the slot layout take
entry_groups(), where a group appears once for each block it holds in an entry, and the VRAM
estimate counts the same.

No plugin on main has a window beside linear state or paged groups of different block sizes, so
every model here keeps its cache and slot as they were. DeepSeek-V4.1 (#266) has both; its slot
grows by the window's pages (10 blocks of kv_window, 6.25 MiB a rank at TP4).

Tests: mem_test -- an entry at the lcm over block sizes 2/1, 2/4 and 16/2 (lookup blocks, adopt,
refcounts, eviction and trim in entries, restore_room, unshared_tokens), a publish short of one
group's blocks refused and unwound, checkpoints on the entry grid (and the binding's key), an
interval off the grid refused, a hybrid with a window and mixed blocks, an entry over mixed block
sizes through the host tier byte for byte (one to three ranks, replicated beside zero), and a
checkpoint carrying linear state and the window together; the window-snapshot rule's test now
expects the window beside linear state. sched_test -- a hit on a hybrid whose slot carries the
window resumes at the snapshot, a trunk group neither cached nor in the slot refuses the hit, a
hit over mixed block sizes adopts each group's own blocks, and the reserve trim asks for entries.
2026-10-28 12:50:54 +01:00
Brandon Bertelsen a96bfe821f clef: the joint schema head on the card, served on /v1/systemone 2026-10-28 00:33:55 -04:00
baKon 72a58d0c0c core: --expert-stats FILE, the routed experts every layer selects, from the heat engine's histograms
Which experts a served model actually uses, per layer, is what deciding how to spend an expert's
bits needs, and the core already has it: every routed layer's counts come back to a host bank once
a pass, and the heat engine drains the landed banks once a step, one step behind. --expert-stats
FILE credits the same rows to a host tally and writes it as JSON every 30 s and at shutdown,
through a temporary and a rename (place/xstats.h). No device work, no copy, no synchronisation;
where the heat engine is off (every expert in VRAM, a static plan) the drain runs for the tally
alone, and at shutdown the streams are drained and the banks still in the ring are credited.

Counts are filed by step kind: prefill (no decode rows), decode, mixed (one histogram cannot split
it) and draft, which is every routed layer past the trunk (an MTP or DSpark head; its bank holds
the step's last draft pass). Each rank files its passes' kinds when it issues them.

A histogram row is the rank's own experts from zero, so under expert parallelism (deepseek41) it
is the rank's slice. The map from a rank's index to the model's expert id comes from the container:
index e is the unit declared with group expert e, and the directory entry of that unit's weight
names the expert. An expert several ranks hold (a width slice each) is counted on the lowest; a
rank that counts nothing does not drain for the tally. Without directory ids the map falls back to
the indices (one rank, or every rank holding the model's count) or to rank order.

The file carries the model, the routed layers, each layer's expert count and top_k, tokens and
steps issued by kind, histograms, passes, observed tokens and selections per kind and layer, the
per-rank drain counters (lost, unmapped, unclassified), and counts[kind][layer][expert].
/server_info names the file. Router weights are not summed: they stay on the card.

Tests: xstats_test (the map, the tally's kinds and merge, the file); config_test lists the flag
and checks it is off until it names a file.
2026-10-27 18:34:32 +01:00
Deadcode 6645337f69 radiance 1.13.0
New models:
- Tencent Hy-Memory (HYV3) from its BF16, FP8 and GGUF checkpoints, with its native tool calls
- M2XFP4: metadata-augmented MXFP4 weights for Qwen3.8-27B and its DFlash2 drafter (top-1 89.1% ->
  92.4% against plain MXFP4), its quantiser and recipe, and ParoQuant's M2XFP4 checkpoints
- Gemma 4 E2B/E4B audio input; NVIDIA-Nemotron-3.5-Bolt-E4B in int8 and 4-bit, on two cards by
  default; Ornith-1.5-122B compose files

Speed:
- Weight reads beside the decode all-reduces (qwen35_fp8, gemma3; --weight-prefetch, on by default):
  the 27B MXFP4 with DFlash2 61.2 -> 67.9 tok/s at c1, TranslateGemma 27B +13%
- Head-256 split-KV decode attention at 256 workgroups and without bank conflicts (27B: +3-5% a
  step at 25-41K context), and the prefill KV split for small launches (a short turn over a long
  context decodes the other sequences 27% faster in that step)
- MXFP4 decode gate_up, activation and fp8 quantiser in one launch (27B, Gemma 3 up to 64 rows:
  TranslateGemma +2-5% at 2-8 streams)
- ParoQuant int4/int5 tiled GEMMs 6-9% faster
- Speculation: a step's tokens are sent before the drafter's passes end, no step waits behind one
  that ends its requests, and the MTP head's first draft no longer collapses after short chats in
  the prefix cache

Features:
- --kv-resident N: KV streaming for a context bigger than VRAM (qwen4exp_fp8, GLM-5.3)
- MiniMax-H3: reference media and keyframe conditioning with the VAE encoders
- Krea 2 rebalance presets balanced, detail and subtle
- The dashboard's request history; a stall watch that reports a frozen step's thread and stack
- rad-tune at the served configuration, collectives measured as the exchange; Gemma 4 E2B/E4B's
  per-layer embeddings read ahead off the step path
- A GPTQ calibration tap and recipe for Gemma 4 31B's w4a8 container

Fixes:
- The two-rank all-reduce checks that a peer's push has landed before reducing it
- z-lab's DFlash drafter on Gemma 4 31B keeps drafting after a prefix-cache hit
- MiniMax-H3's modulation rows

Changes: Plugin ABI 31: out-of-tree plugins must be rebuilt. RADIANCE_PREFETCH_BESIDE is
--weight-prefetch now; RADIANCE_NO_HUGE_PAGES, RADIANCE_IDS_EARLY, RADIANCE_ATTN_BAND_SPLIT,
R4D_PREFILL_SPLITS, RAD_PLE_TIMING and RAD_PLE_CACHE_ROWS are gone.
2026-10-27 16:47:35 +01:00
AshlynandClaude Opus 5.5 bf6c019571 engine: stream a step's tokens before the drafter's passes behind it end
Since 1.11.0 a block drafter's context and query passes (DFlash, DFlash2), like a serial drafter's
rounds (MTP), are queued behind the step before its readback, and the host waited for all of them
before it read the sampled ids. The ids' copy was already issued ahead of the passes, but the
commit that streams the tokens came only after the passes had run: every token, the first one
included, reached the client a drafter's passes late.

The copy now has an event of its own (tok_end_). collect_step waits on it, the commit streams the
tokens while the card runs the passes, and the step loop waits for the step's end (step_end_)
right after the commit, before finish_*_drafter reads the slots and before anything else is
issued. The commit issues no device work, so whatever it releases is in use only by the passes
that wait covers, and the next work that could reuse it is issued after the wait. KL mode and
embedding programs keep the old wait; RADIANCE_IDS_EARLY=0 restores it, for an A/B.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 09:18:57 +01:00
C_Tamas 06172e98de Merge branch 'pr1-device' into pr2-engine 2026-10-25 17:19:16 +07:00
Dustin Ewan 32bb5592d0 engine: a stall watch across the step loop -- a frozen step reports the blocked thread, its syscall and its stack instead of hanging silently 2026-10-25 10:31:06 +01:00
gearwave00001 7c3b5ab7d5 merge 1.12.0: gemma4 E2B/E4B and Nemotron Bolt E4B arrive; the ref2va audio, rows and ABI work carried across
conv1d keeps both stride forms: upstream's causal codec downsample with cu_div (Fish Audio) and the port's explicit-pad non-causal one (the H3 audio encoder's), in libref, libavx and libr4d alike; the ABI takes upstream's 27 on top of the port's RadVideoGenBatch growth.
2026-10-24 19:03:26 -05:00
C_Tamas a9e627b7ca engine: the KV plan split, the host mirror, and --kv-resident bring-up 2026-10-24 19:19:19 +07:00
Deadcode 5a9ce4912b radiance 1.12.0
New models:
- Fish Audio drama-3: speech with speaker tags and inline direction, voices cloned from reference
  clips (the `references` field of /v1/audio/speech and the streaming session), two cards
- Gemma 4 E2B/E4B (KV-shared layers, per-layer embeddings, clipped vision linears), with
  NVIDIA-Nemotron-3.5-Bolt-E4B in bf16 with DFlash and vision on one card, and E4B recipes

Speed:
- MXFP4 GEMMs for one to 64 rows and a tiled prefill GEMM at TN=4 from 1024 rows: the 27B MXFP4
  with DFlash2 decodes about 1% faster at c1, 5% at c4 and 14% at c16
- The fp8 and int8 LM heads read their weight once for 65 to 128 rows
- A prefill step of one sequence runs in two pieces on a second lane at two ranks (qwen35_fp8,
  gemma3): a 45K-token prompt on the 27B fp8 in 15.1 s instead of 16.2 s
- Gemma 3's fused all-reduce junctions also under a lossy wire
- --draft-short-from N: a block drafter runs its shorter block from N decoding sequences on
  (off by default; with 8 on the 27B MXFP4: c8 +12%, c16 +18%, c64 +32%, c1 unchanged)
- --tp-attn-split rows: GLM-5.3-Flash's MLA attention split by rows over the ranks, 18 to 21%
  faster prefill; lossy, `heads` stays the default
- --draft-coupling on: Qwen3.8-Flash-Next's MTP drafter samples its proposals from its reranked
  top-8 and the target's draw is coupled to it; pays at high temperatures (c1 at T 1.0: 155 ->
  178 tok/s), costs at low ones; off by default

Features:
- Edited prompts on windowed models (Gemma 4) reuse their prefix: periodic window snapshots, and
  snapshot-backed prefix KV kept across recomputes (an edited tail on Gemma 4 31B: 96 s -> 2.6 s)
- DELETE /sessions/<label> and DELETE /sessions?id=<id> forget one stored conversation
- --state-cache-dtype f16: the delta-net state cache at half the memory (qwen35 plugins; lossy)

Fixes:
- A browser's CORS preflight allows DELETE

Changes: Plugin ABI 27: out-of-tree plugins must be rebuilt. The environment switches the PRs
added are flags now (--tp-attn-split, --draft-coupling, --state-cache-dtype).
2026-10-24 13:12:28 +02:00
mici81andClaude Opus 5.5 877e8e44e4 block drafter: the short block on the card's driver
1.11.0 runs a block drafter on the card only (issue_block_drafter). Engine::block_shape chooses the block
and the proposal count a step runs: the drafter's own, or its short block from --draft-short-from
decoding sequences on, off again two below. The card's query pass runs that block, ADV_BTAKE takes that
many proposals from the front of each row at the drafter's pitch, and the step issued ahead verifies
that many (expect_draft and finish_block_drafter read block_steps_). sched_test runs the card driver's
sequence at DFlash2's short block (4 rows, 3 proposals) against the host's reference.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-23 11:26:39 +00:00
Deadcode 9eaf10da6e radiance 1.11.0
New models:
- GLM-5.3-Flash reads pictures: its vision tower and processor (--image-tokens sets the budget),
  with decode kernels for a few rows and the DSA indexer split over the ranks
- Sage-A1.5 (fp8 and MXFP4) with its vision tower and a DFlash2 drafter
- Unlimited-OCR (bf16)
- Gemma 4 31B with z-lab's DFlash and RedHatAI's DFlash2 drafters; at four cards its all-reduces
  are fused with the junctions, overlapped with the compute and sent compressed
- Ornith-1.5-35B-A3B w4a8 compose files

Speed:
- Block drafters (DFlash, DFlash2) accept their drafts on the card, and the next step is issued
  ahead
- The four-rank all-reduce is faster for every --tp 4 model
- qwen35_w8a8: the norms and SiLU write the int8 linears' operands directly
- --attn-prefill-fp8 off|qk|pv|both: fp8 QK and PV legs for the h256 prefill attention (about +20%
  prefill on a 221K-token prompt for the 27B MXFP4 at TP2); lossy, off by default

Features:
- Control vectors: --control-vector off|on|disabled (disabled by default), a per-request switch,
  and the published Qwen3.8-Flash-Next refusal-direction vector (its license is in NOTICE)
- Krea 2: the `rebalance` request field, as ComfyUI's ConditioningKrea2Rebalance
- Cards with a small PCI BAR run, with kernel arguments kept in host memory
- Dashboard: live acceptance figures; statsdump rotates its file at a size cap
- KV caches every rank holds whole (GLM-5.3's latent and index caches) take one host-tier slot

Fixes:
- Long conversations taking turns no longer fall back to an early snapshot: a host-tier restore
  makes room as memory pressure does and waits a step for the previous turn's release (two
  conversations of 142K and 147K tokens sent back to back: 31.3 s per turn before, 2.8 s now)
- Kernels before Linux 6.16 (amdgpu below 3.64) no longer hang at startup: virtual memory
  management is turned off there, with a warning
- Gemma 4 dense scales its token embeddings as Hugging Face does (bf16), which changes its output
- The four-rank all-reduce fences prefill-sized messages, for a rare divergence after a fresh start
- GLM-5.3: every refusal names the setting and the reason; its template keeps string content
- Several pictures in one request no longer refuse processors that take one image at a time

Changes: Plugin ABI 26: out-of-tree plugins must be rebuilt. The environment switches the PRs
added are fixed rules or flags now (R4D_ATTN_FP8 is --attn-prefill-fp8).
2026-10-23 11:57:52 +02:00
gearwave00001andClaude a1a75da7e9 merge origin/main: the upstream LoRA-runtime refactor beneath the ref2va port
Merges upstream 1.10.0 (152 commits: the LoRA acquire/runtime refactor, the
form-1 LTX-2 scheduler family, guidance terms + negative prompts, decoder
selection, input_reference, new architectures) into the ref2va port branch.
Resolution rule throughout: keep BOTH feature sets; ABI numbering follows
upstream (RAD_ABI_VERSION 26, RAD_FORMAT_VER 2), with the port's video fields
unioned into RadVideoGenBatch/RadVideoGenDecl and abi_layout_table.h
regenerated from the live table.

Notable reconciliations:
  * videos.cpp: the task grammars are disjoint by capability -- keyframe tasks
    (i2va/l2va/flash-attn l2va/fl2va) are recognized only when decl.encodes,
    so upstream models keep refusing them as unknown tasks; input_reference,
    the LoRA tag/field pipeline, and the guidance/negative_prompt rendering
    coexist with refs/ref2va; the prompt put() helper hoisted to block scope
    for the media branch.
  * video_schedule(): upstream's (steps, video_tokens, refine) keeps its
    positional slots; the port's shift_video/shift_audio overrides move to the
    tail so upstream's schedule tests call unchanged.
  * r4d_selftest conv3d cases: the port's sp/st/causal/down/refl geometry and
    upstream's tpad/tpre fold into one reference (ft = causal ? 2 : tpad==2 ?
    2+tpre : 1); rms_mod rows keep the port's i8/fp8 quant modes alongside
    upstream's wadd/norm_once/norm parameters.
  * tests/oot_plugins.sh: the per-plugin cmake --install gains a --prefix
    staging dir -- plugin .so files still land in the absolute
    RAD_PLUGIN_INSTALL_HOME, but libr4d now also installs r4d_selftest to a
    relative bin/, which needs no root.

Host ctest: 112/113 (mm_test's webp gap pre-exists this merge); r4d_selftest,
engine_e2e, oot_plugins, abi_layout, all LoRA tests green.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-22 18:38:04 -05:00
d912c694f3 feat(sampler): port linear MTP coupling and cooperative verify upstream
Port GitHub PRs #12 and #13 onto Codeberg upstream main, retaining upstream kernel-chain handling. Include the source Clang target-attribute fixes required by the host build; omit the KFD header workaround and unrelated fork work.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
2026-10-22 22:58:08 +02:00
NunzeandClaude Fable 5.1 66a1d5aa15 kv tiers: rad_kv_group_replicated -- a group every rank holds whole is kept once a host slot
Under tensor parallelism a host slot held every rank's shard of an entry end to end, so a
group every rank holds whole (an MLA latent cache computed from a replicated projection) was
stored once a rank: on GLM-5.3-Flash at eight ranks 396.75 KiB a 4-token block for 49.59 KiB
of distinct bytes. The plugin now says which paged groups are replicated (additive export,
RAD_ABI_VERSION does not move), and the slot holds those once, in one window at its front
that rank 0 writes and every rank reads back on a restore; the sharded groups follow, one
window a rank, as before. Without the declaration nothing changes.

TierExec::slot_layout is the one place the slot arithmetic lives: bringup takes the windows
from it, and it refuses a group replicated on one rank but zero, unflagged or another width
on another. A follower moves only its own window on a copy out (nothing, when every cached
group is replicated) and both windows on a restore. The startup log names what is held once
and the tokens the tier holds either way.

RADIANCE_DEBUG_TIER_VERIFY now covers the claim: each follower gathers the replicated groups
into a pinned scratch beside the copy and hashes them once landed, and the engine, once every
rank has landed, has the leader compare its window with every follower's sum.

mem_test moves a chain through the real TierExec with a replicated and a sharded group at 1,
2 and 8 ranks, the ranks' copies differing on purpose, and checks every rank gets the leader's
bytes back; beside a zero group; the verify path alike and differing; and the layout's refusal.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-22 09:08:44 +00:00
NunzeandClaude Opus 5.5 b0bcb74c5b core/mm: GLM-5.3's processor -- a canvas within a token budget, padded rather than stretched
A fourth processor family beside Qwen-VL, Gemma 4 and LFM2-VL, chosen by vision_config.model_type
glm5_next_vision, as transformers' Glm5NextImageProcessor (torchvision backend) computes it:

- The canvas: both sides rounded up to patch * merge (28), grown by the area ratio under
  min_image_tokens, and fitted by the reference's binary search over the picture's height past
  max_image_tokens, a token being two frames of 28 x 28 pixels.
- The picture keeps its aspect ratio, is never enlarged while it reaches the floor, is resized
  with torchvision's fixed-point bicubic only when its size changes, and sits in the top left of a
  canvas of zero bytes, which the normalisation turns into each channel's -mean / std as it does
  the reference's padding. Patches as Qwen-VL's (merge-block order, (channel, frame, y, x), the
  picture in both frames, CLIP's mean and deviation from processor_config.json).
- <|begin_of_image|>, one <|image|> a token, <|end_of_image|>; the tokens rotate at their
  positions (the language model has no rotary). Pictures only.

The budget is in tokens and comes from processor.image_processor.{min,max}_image_tokens; one
encoder pass bounds it, so it is lowered to max_patches / merge^2, as a Qwen-VL pixel band is
(4096 tokens at --mm-max-patches auto, the checkpoint's 8000 at 32000). --image-tokens sets the
ceiling; the pixel-band and video flags, a request's image_tokens and a video are refused by name.

tests/mkglm5golden.py writes glm5_golden.h from Glm5NextProcessor; mm_test checks canvases over a
grid of sizes and both budgets, and whole pictures (padded only, grown under the floor, shrunk to
a budget) patch for patch and token for token, all bit-exact, and the processor read from a
container's keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:06:34 +02:00
gearwave00001andClaude 3a7a79fb47 videos: per-request shift/audio_shift; the fried look is decode/quant, not schedule
Adds `shift` (video) and `audio_shift` (soundtrack) as per-request /v1/videos
fields, (0,100], each defaulting to the model's trained shift; echoed in the
video object and advertised in the model card as video_shift/video_audio_shift.

ABI-invisible: VideoRequest carries the two doubles, video_schedule() re-shifts
that stream's sigma grid, and the shifted sigmas ride RadVideoGenBatch::sched --
the plugin reads only sigmas/timesteps, never a shift scalar, so RAD_ABI_VERSION
stays 24 and no plugin rebuilds.

Diagnosis (cont.20): the review batch's blown-highlight/crushed-black "fried"
look is present in the text-only T2VA control at native res (clip 54-79% vs the
reference's ~4.5%), so it is not the keyframe/tower path (#52) and not a
regression (old ex10 T2VA has clip 51%). It is not the sampler (euler vs
res_multistep: clip 53-61% vs 56-65%) and not the shift: the container already
runs 12/3 (the reference's settings) and shift=4 leaves clip at ~54%. With
sampler, shift and CFG (=1, no guidance) all matched, the gap is downstream of
the schedule -- the video VAE decode scale parity and/or the DiT int8 quant, i.e.
#37/#44/#45. The shift field ships regardless: correct, useful, and requested.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-21 09:11:34 -05:00
NunzeandClaude Opus 5.5 4be0a34791 kv tiers: a restore makes room the way pressure does, and a chain the pool cannot hold stops at a snapshot
A restore reserved only from the free list. The reserve's trim leaves a quarter of the pool free
after every publish, so a returning conversation larger than that came back as far as the free
list reached, and the lookup stopped at the first block still on the host. On GLM-5.3-Flash at
eight ranks, two conversations of 314K tokens in a 446,832-token pool: the second turn of the
first brought back exactly the 27,930 free blocks, hit 111,772 tokens, and on its hybrid state
resumed at the snapshot at 1,024, since geometric backoff keeps nothing between 1,024 and 131,072.
Its prefill took 84 s instead of under one.

PCBinding::restore_plan now makes room before the engine plans the restore, the same way
PCBinding::evict does for an admission: PrefixCache::trim_for drops entries whose host copy has
landed, the engine lands pending copies (flush_fn), and it drops again. It never erases one,
spares the restoring chain itself and every chain a waiting request holds, and like trim never
touches one a running sequence reads. The free quarter may go; the reserve's trim after the next
publish frees it again. One block table serves every rank, so the room rank 0's cache makes is
room on every rank, as with evict.

When the pool still cannot hold the chain, PrefixCache::restorable_from cuts it at the deepest
valid snapshot the shorter prefix reaches, so no block comes back past the point the hit resumes
from; without recurrent state it cuts where the room ends. TierExec::issue_restore keeps its own
cut as the backstop.

Both cuts are counted: radiance:prefix_restore_cuts_total for restores the pool could not hold
whole (/sessions moved.restore_cuts), and radiance:prefix_hit_cuts_total{reason="resumed_below"}
for admissions that resumed more than one checkpoint interval below their attention hit, which
hit_cut_tokens alone did not tell apart from many small tails (/stats and /sessions hit_cuts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 15:24:20 +02:00
AshlynandClaude Opus 5.5 cb5a69ac3f engine: a block drafter on the card's acceptance -- its passes queued behind the step, the next step issued ahead
A block drafter (DFlash) ran its two passes after the commit, staged from the committed sequence:
the verify, a host wait and the commit, the context and query passes, a second host wait for the
proposals, then the next step's build and issue, with the cards idle through each host turn and
the ranks starting every pass at different times. Pipelining was off for block drafters.

It now takes the serial drafters' path (sched/advance.h). After the trunk's ranks join, the
acceptance runs on every rank (ADV_ACCEPT). block_begin runs before the commit (on_card): the
context pass mirrors the trunk step, whose positions the host knows (a row issued ahead continued
from the committed end, as commit() reads it); the query block's rows are device rows staged at
the furthest anchor acceptance could leave, with the KV reservation that far, and ADV_BLOCK puts
the anchor (the token the verify chose) and the masks at the card's committed end. After the
query pass, ADV_BTAKE takes the proposals into each StepSlot behind the anchor, which is the token
row the next verify reads (ADV_TRUNK), so issue_ahead verifies them with no host round trip. The
slots come back with the step's one readback; finish_block_drafter checks the card's acceptance
against the host's, as the serial driver does, publishes the proposals and moves the drafter's
filled range.

RADIANCE_DRAFT_BLOCK_HOST=1 keeps the host's driver, for the A/B, and has a row in GUIDE.md's
environment table. On libref with the tiny 31B-shaped checkpoint (and one doctored so its drafter
is right part of the time) the two drivers give the same replies, the same draft acceptance and
the same sampled text, and greedy matches plain decoding. sched_test runs 24 pipelined steps
against the host's driver: the same trunk steps and the same context and query passes, positions,
lengths and slots (the context pass's token ids aside, which that pass does not read);
advance_test covers the two modes and the chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:48:51 +02:00
C_Tamas f5cb4b8ff3 server: the panel names the family the vector was validated against
The summary line led with the layer range, which is the least load-bearing term on it: a file
carrying another model's directions is refused at startup, so the range alone never tells the
operator whether this vector belongs to the model on the card. The panel now reads
`qwen4exp · layers 4-44 · project · scale 1`, with the family taken from the same
`meta_.arch_id` the loader compared against the file's `controlvector.model_hint` -- served as
`arch` in the payload, not invented by the page.

The switch's label says what it does rather than what it is called, and the note under it says why
the change is not retroactive: a running request keeps the choice it was admitted with, and a
session with a refusal already in its context may repeat it.
2026-10-21 09:26:17 +02:00
C_Tamas f3979aa538 docs, tests: say what the branch does, and test what the docs say
Review found four places where the branch's prose had outrun its code:

  - docs/GUIDE.md 4.10 promised that an incompatible sidecar "stops startup" two
    sentences after promising it is "reported and skipped" (the code warns and
    serves without it), and claimed deployment-level bit-identity for a request
    without the vector, which the PR explicitly withdraws. Both now say what the
    engine does; the wording is core/cvec.h's, which already had it right.
  - cvec_test claimed discovery order and a range past the model in the PR, but
    neither case existed. Both are there now, reusing the file writer and load()
    the file already had, so discovery -- the branch's policy choice -- has
    coverage at all.
  - the libr4d row descriptions still said "experimental speed projection" after
    the naming commit, and pointed at the unit that no longer exists;
    ref_hc.cpp's comment had a duplicated clause.
  - /stats' `n_layers` reported the direction count (47 of 48 layers); it is the
    model's layer count now, with first/last carrying the range.

The alias is read before the field's own name, so a request that sends both is
read as `control_vector`, and engine.cpp's /server_info comment is back above
engine_info.
2026-10-21 09:26:17 +02:00
C_Tamas 40f7390766 naming: comments and log lines say control vector, not speed projection 2026-10-21 09:26:17 +02:00
C_Tamas 66c6d71254 sched, mem: the per-request switch reaches the device, and the cache keeps the modes apart
`projection_on_rows` expands each request's choice across its tokens once per step, into the int32
mask hc_project reads; rows outside every sequence are zeroed first, so the reused arena region can
never carry a previous step's flag.

The prefix cache keys a projected request's blocks on the vector itself, through the same extension
point the runtime LoRA adapter uses: one content key spanning the whole sequence, pushed into
`media_keys` beside the adapter's, so every block overlaps it. Blocks and linear-state checkpoints
(whose keys are the same chained hash) therefore never cross modes; an unprojected request, or a
deployment with no vector, adds no span and hashes exactly as before, and an adapter and a vector
compose.
2026-10-21 09:26:17 +02:00
C_Tamas 64adee3ece core: a control vector loaded from a controlvector GGUF, discovered per model family
A control vector is one unit direction per layer, applied to the residual stream while the model
runs (llama.cpp's --cvec-mode project). This is the loader and its ABI, with no configuration
surface: a vector is a property of the model family, so the engine looks for one beside the
container, in its directory or in $RADIANCE_HOME/vectors, and uses it when it fits the container.
The operation's parameters (layer range, scale, mode) come from the package's own JSON.

Validation is against the container, never the file's provenance: architecture hint, direction
width against n_embd, every layer in the range present, F32 rows. A discovered file that does not
fit is reported and skipped; the switch stays off until a request asks for it.

The ABI grows by one trailing, zero-defaulted field (RadBuildCtx::cvec), so an architecture plugin
that ignores it is unchanged, and the cache gains a salt (0 without a vector) that keeps blocks and
linear-state snapshots of one mode from being reused by the other.
2026-10-21 09:26:17 +02:00
zivius bdc5c5b063 core: references for an audio generator -- a request's clips of a voice and their transcripts (RadAudioGenDecl::tmpl_ref, ref_item), decoded to mono at the model's rate and padded to whole frames, each frame a prompt row the plugin encodes in the PROMPT pass (RadAudioGenBatch::ref_audio, ref_cu, ref_frame); /v1/audio/speech's and the streaming session's references 2026-10-21 01:00:13 +02:00
zivius 832a88faac core: a speech model without instructions, and a refusal's reason from its text_prepare -- an audio generator may declare tmpl_plain alone (a request's instructions refused by name), and the reason a plugin leaves in the output buffer reaches the caller 2026-10-20 23:07:33 +02:00
zivius baf6e89ecb core: an audio generator of one branch over a hybrid language model -- the driver stages a delta net's state and convolution groups beside the paged one, with each entry's context and num_accepted, the generator loop zeroes the slots a request is granted, and a model may read its input with special tokens (its speaker tags) 2026-10-20 23:07:16 +02:00
Deadcode 4246a1dd04 radiance 1.10.0
LoRA for image and video generators:
- civitai and Hugging Face adapter files as published: kohya, ComfyUI and diffusers/PEFT key names;
  LoRA, LoCon, LoHa, LoKr and full-weight diffs; DoRA, OFT and Tucker are refused by name
- stacked per request with a strength each, through the `loras` field or <lora:name:strength> tags
  in the prompt; --lora-dir serves every file in a directory, GET /v1/loras lists them, and
  --max-loras / --max-lora-rank size the slots on the card (generators default to rank 64)
- Krea 2, Qwen-Image 2.1, FLUX.3 [klein], MiniMax H3, LTX-2.5, Anima and SDXL

New models:
- Anima (base, aesthetic and turbo): Cosmos-Predict2 DiT with the Qwen3-0.6B text encoder and the
  Qwen-Image VAE, on one card
- Stable Diffusion XL and its single-file finetunes (Illustrious, NoobAI including V-Pred, Pony),
  read as civitai ships them, with the Euler, Euler a and DPM++ 2M samplers

Recipes:
- q38-27b-mxfp4-df2: any bf16 Qwen3.8-27B or finetune at MXFP4 with the DFlash2 drafter
- Krea 2 finetunes from civitai: scripts/krea2_native.py reads Krea's own key names, and
  krea-2-fp8-unscaled keeps a plain-fp8 file's codes exactly

Changes: --max-num-batched-tokens defaults to 2048 (was 8192). Plugin ABI 25: out-of-tree plugins
must be rebuilt.
2026-10-20 21:05:16 +02:00
Deadcode 685ec5bd85 radiance 1.9.0
New models:
- LTX-2.5 (base and distilled): video with a stereo soundtrack from text or from text and a first
  frame, on one card, with its duration head, tiled VAE decoding, the diffusion decoder and the x2
  latent upsampler
- Krea 2 Raw and Turbo, and FLUX.3 [klein] and its base: text to image, and for FLUX.3 edits from up
  to ten reference pictures, on one card
- GLM-5.3-Flash from AMD's Quark MXFP4 export, on eight cards (John McDonough, Nunze)
- Gemma 3 / TranslateGemma 27B with an optional DFlash2 drafter (mici81)

Engine:
- --kv-cache-dtype fp8_v4 and k6_v4 for Gemma 3 and Qwen3.8-Flash-Next (mici81)
- the rotated int8 trunk (i8a8h) for Qwen3.8-27B (eddie168168)
- eight-rank all-reduce bands, weighted shards and pieces (Nunze); --host-headroom-mib (sfjes)
- the dashboard shows the single-stream decode floor and its most recent window (Memoria)

Fixes: prefix-cache reservations kept until their save lands (baKon), tool calls in Responses
namespaces (#119), system messages merged when a template refuses several (#137), a prefill
continued with no open step (#127), calibration of a Gram accumulation (#122), JSON Schema patterns
read unanchored (davetha), GLM-style tool calls, the KV floor counting every sequence's state.
Plugin ABI 24.
2026-10-19 21:58:07 +02:00
Memoria (Noblistic) d4998b1f75 server: report how long bringup took, as a raw figure
A restart's cost is the one number a reader needs in order to decide whether one
is worth suffering, and any guess at it would decide the answer by itself. The
server knows it exactly: the interval from process start to the socket listening,
on this machine, with this model and this cache state.

Emitted on /stats as startup_s, 0 until the server has listened. Raw figure only
-- the page no longer consumes it. It is here because it is the missing half of
any restart decision a human or a tool makes downstream, and because the
decode-step advisory that did consume it was withdrawn the same day it shipped
(see the following commit for what the live data showed).

Trailing zero-defaulted field on both SchedMetrics structs plus the adapter copy;
neither struct is ABI-pinned, so this is the sanctioned append.

Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI

(cherry picked from commit 76a9e2f7a28b8e034cfd56caa091792c68fe19b6)
2026-10-19 17:35:05 +00:00
gearwave00001andClaude 72624973ad ref2va: merged-cell modulation lifts the reference-photo ceiling from five to nine
A modulation cell is a pure function of a segment's kind -- (modality ada,
timestep block) -- so all reference photos share one cell. Runs of consecutive
same-cell segments collapse to a group; group boundaries are a subset of the
fine segment boundaries and the merge is sequence-length independent (the key
is kind alone). The modulated norm now reads COARSER group boundaries via a new
trailing RadVideoGenBatch::mod_cu while attention keeps the fine seg_cu, and the
fixed-width table is pitched by GROUP count. Nine photos therefore occupy four
groups (prompt / all-photos / soundtrack / video); buffer sizes and the arena
are unchanged (kMaxSegs stays 8, no kernel change, no re-convert).

No regression for <=5 photos: each photo cell already filled its own column from
the same input rows and weights, so it was bit-identical to the others; merging
issues it once instead of N times and yields the same per-row value. Only the
previously-rejected sixth through ninth photos change, by being allowed.

Driver: rad_arch_video_mod_segs (trailing plugin export) computes the merged
groups host-side; the driver stages them into R_MOD, guards the GROUP count
against max_ref_segs at submit (a clean refusal beats a step-loop fault), and
the plain path stages the fine table into both operands.

Device-verified on dual gfx1201 / TP2 with a CONTROLLED same-seed battery
(task=ref2va, seed fixed on every job, so neither the seed nor the token count
is a confounder): same prompt, same seed, same ref-count, DIFFERENT image
content give DIFFERENT outputs -- the reference is genuinely consumed. Nine
photos complete (the case the pinned build refused at submit), whole-run fault
scan clean.

Adds docs/NOTE-REF2VA.md: what this port reproduces of the DaSiWa workflow and
what it does not -- the residual 8-group ceiling under heavy interleaved mixed
refs, the reference-token / row budget, continuity tail (unimplemented), the
video/audio reference paths (plumbed, not yet device-verified), references x
latent-upscale exclusion, and open conditioned-step parity.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-19 12:31:55 -05:00