Commit Graph
374 Commits
Author SHA1 Message Date
mici81andClaude Opus 5.5 b66752adcc libr4d: gemm_mxfp4a8_gemv_wide, the gemv row's WMMA form at 9 to 64 rows
The WMMA form takes up to four 16-row tiles a wave: each weight word of a chunk is loaded and folded
once and multiplied with every tile's activation fragment, so the weight streams once from DRAM to
registers whatever the row count, with no LDS staging. A row's sum is its tile's WMMA chain alone, so
its bits are the same at every tile count: the first row is bit-identical from M = 1 to 64 (selftest),
across the gemv row (M <= 8) and the new gemv_wide row (9 <= M <= 64, K % 128 == 0, same entry and
priority). Several streams with speculation land there (4 x (1 + 7) = 32, 16 x (1 + 3) = 64).

--perfmx against the decode row that served 9..64 before (us, Qwen3.8-27B / TranslateGemma per-rank
decode shapes): down 51-80 vs 56-105, ssm_out 27-42 vs 30-55, attn_qg 40-63 vs 44-74, TranslateGemma
down 61-97 vs 66-123, o 22-35 vs 25-51, gate_up at 24-48 rows 110-141 vs 145-170; gate_up at 48-64
rows about even (Qwen) or behind (TranslateGemma at 64, 171 vs 153).

Selftest: gemv_wide at RT 2..4, both activation grids, a partly live tile, parts; the M-invariance check
runs the wide row under the gemv row's selection (mxfp4a8_numeric's any_row).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-24 11:09:03 +02:00
mici81andClaude Opus 5.5 75b4d0baa7 libr4d: gemm_mxfp4a8_gemv, the MXFP4 x fp8 GEMM for one to eight rows
One stream's decode (M = 1 + the draft depth) is a pure weight stream; the decode row stages the
weight through LDS and leaves narrow projections at a third to two thirds of DRAM bandwidth. The new
row (priority 58; M <= 8, K % 64, N % 16; the same packed weight bytes as every MXFP4 row) keeps the
weight in registers: WMMA from register fragments when K % 128 == 0, v_dot4 otherwise. The form and
the wave count per block depend on K alone, so a row's output bits do not depend on M (a verify
step's first row equals the plain decode of it). The scale and reference planes must be 4-byte
aligned.

Selftest: every reachable instantiation (both forms, both activation grids, M = 1..8, tile counts
divisible by 4, by 2 only and odd, parts), the output prefilled with NaN, an odd column stride, and
the first row's bits against M for gemv and decode. --perfmx times the MXFP4 rows at one shape.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-24 11:09:03 +02:00
John d6957e88a1 sched: skip periodic window snapshots under tip-only
Treat tip-only as a true opt-out from periodic window snapshot creation and interval chunk splits, while retaining the existing tail snapshot and explicit request checkpoints. Leave recurrent-state scheduling unchanged and report the effective chunk bound accurately.

Cover geometric-backoff and keep-all interval behavior, tip-only chunk planning and single-snapshot reservation, aligned and short prompts, explicit checkpoints, and recurrent-state scheduling.
2026-10-24 11:08:38 +02:00
John 192fe10278 sched: checkpoint sliding windows at prefill intervals
Keep intermediate window snapshots as well as the prompt-tail snapshot so a tail edit can resume below its divergence instead of re-prefilling the entire matched prefix. Reuse the existing checkpoint retention policy and preserve the pre-template-divergence tail boundary.

Add scheduler and cache regression tests for interval snapshots, aligned prompt tails, constrained chunk budgets, and edited-prefix lookup. Update the geometry report and guide to describe periodic window snapshots.
2026-10-24 11:08:38 +02: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
AlexandClaude Opus 5.5 123c439684 krea2: rebalance, the text taps at ConditioningKrea2Rebalance's gains
A request may ask for Krea 2's twelve text taps to be multiplied by fixed gains
before the text fusion, as ComfyUI's ConditioningKrea2Rebalance (nova452) does at
its defaults: multiplier 4 times the per-layer weights 1, 1, 1, 1, 1, 1, 1, 2.5,
5, 1.1, 4, 1. `rebalance: true` on /v1/images/generations (JSON or form) sets
RAD_GEN_COND_REBALANCE in RadGenBatch::cond_opts, appended in ABI 26; the plugin
then scales each tapped layer's rows into te.h2 with chan_affine (f32, rounded
once) and scatters those instead of te.x, so the residual stream is untouched.
Without the field every pass issues exactly what it did before; other models
ignore it.

The gains cannot be folded into weights: the taps enter the fusion's layer-wise
blocks raw, through a pre-norm residual.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:55:38 +02:00
NunzeandClaude Fable 5.1 7aa51e5b4a libr4d: r4d_selftest folds the exact all-reduces' oracle from inputs whose sum depends on the order -- the old pattern passed any order
The eight-rank two-shot claims the same bits whatever the shard weights and piece count: a word is
reduced by one thread of its owner, acc = 0.0f, then src[0..7] added in ascending rank order in
fp32 and rounded once (reduce2 in r4d_ar_twoshot_Nrank_exact.hip), the one-shot's ar_vsum fold;
weights move only which rank owns a word, pieces only which step reduces it, and every form
(lockstep, ring, split) keeps both. The selftest's check of that claim was blind, though:
ar_pattern_value is k / 64 with |k| <= 254, and eight such values sum exactly in fp32 in any
order, so a kernel folding in another order, or twice-rounding a partial sum, passed.

ar_rough_value gives bf16 values (8 significant bits) whose exponents span 2^-12 to 2^12, so
partial sums round and the order shows: of 20000 elements, 547 fp32 sums differ between
ascending order and rank 3 first. The exact wide rows' pattern runs (ar_wide_pattern, the
weighted eight-rank runs over weights, pieces and forms) and --perfar8 now fold their oracle
from it, ascending from 0.0f, and must match it bit for bit; the lossy and fused cases keep
ar_pattern_value, whose bounds assume its range.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-22 11:54:56 +02:00
NunzeandClaude Fable 5.1 c25bca83d5 libr4d: RADIANCE_AR8_FORM -- the eight-rank two-shot's steps in ring order, or with a flag after each half instead of a handshake a step
The eight-rank two-shot reaches 56% of its link time at 16 MiB (1316 to 1340 us against 763), and
measured(K) = f x link time(K) + h x (K + 1) fits f of about 1.45 and h of about 20 us a step:
both the transfers and the step boundaries lose time. Two schedules of the same work go after
them, each a new form beside the existing one, chosen by RADIANCE_AR8_FORM (unset or lockstep:
as before) or per launch by the `form` parameter:

- ring: the first hop goes to the peers in ring order from rank + 1 instead of ascending. In the
  lockstep order every card but rank 0 starts by writing rank 0's shard, then rank 1's, so the
  seven senders can converge on one receiver while the other links idle; in ring order each card
  receives from one peer at a time.
- split: ring, and the one handshake a step, which waits until every peer has finished the
  whole step (next piece's first hop, this piece's reduce, the previous piece's assemble), becomes
  a flag after each half, awaited only before its data is read: before reducing piece j the
  peers' first hop of j, before assembling j their reduce of j. A card whose half is done goes on
  with the next piece's first hop while a slower card still reduces, so each link runs at its own
  pace instead of the slowest card's per step. The flags stay one monotone word per (block,
  source): the first hop of piece 0 at v0, of piece j + 1 at v0 + 2j + 1, the reduce of piece j
  at v0 + 2j + 2; the launch reserves pieces + 1 steps for its 2 pieces + 1 values, so it mixes
  with every other kernel on the instance. A launch still ends only after every peer has
  published its last reduce inside it, so the slot parity argument holds unchanged.
  r4d_ar_publish and r4d_ar_await (r4d_ar_wide.h) are the two halves of r4d_ar_handshake.

Neither changes which rank folds a word or in what order, so all forms give the bits of the
lockstep form, which compiles to the code it was. Ring and split are eight-rank only; the
three- and four-rank launches stay lockstep and refuse another form. Every rank must read the
same form; init compares it with the other eight-rank settings.

--perfar8 numel iters dtype forms (comma-separated) times the forms side by side; the timeline
prints a pair a synchronisation (K + 1 handshakes, or 2K awaits split, up to 8 pieces).
r4d_selftest's weighted eight-rank runs repeat for ring and split at 1, 4 and 8 pieces over even,
uneven, single-owner and zero-weight tables and with the piece count changing launch to launch,
and the box's own weights run auto, duplex and off. On one card (R4D_SELFTEST_ONE_CARD) all three
forms give the fold on every rank at 65536 to 8388608 elements, even and weighted, bf16 and fp32.
Which form is fastest on the board is for the TP8 window to measure.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-22 11:54:56 +02:00
NunzeandClaude Fable 5.1 5b9bc13e5f libr4d: RADIANCE_AR8_SHARD_WEIGHTS=duplex -- shard weights from the both-directions link model, 8 to 1 instead of 4 to 1
The eight-rank two-shot in pieces runs both hops on a link at once, so each direction of rank r's
link carries (1 + 6 x_r) N for a shard fraction x_r: N - x_r N out in the reduce-scatter and
7 x_r N out in the all-gather, the same in. The slowest rank sets the time. The quadratic rule
(round(4 (rate / max)^2)) gives four Gen5 x16 and four Gen5 x8 cards 4 and 1: x8 carries 1.3 N at
28.6 GB/s (763 us for 16 MiB) while x16 carries 2.2 N at 57.1 (647 us), so the x16 links idle
15% of the time.

r4d_ar_weights_duplex equalises the ranks instead: x_r = (T B_r - 1) / 6 where positive, the x
summing to 1, filled from the fastest rank down. On that board it gives x16 2/9 and x8 1/36,
weights 64 and 8, and both kinds of card carry the same time's bytes: 7/6 N / 28.6 GB/s, 685 us
for 16 MiB, 10% under the quadratic rule's 763. On the earlier board with two Gen4 x8 links it
gives 64,9,0,64,0,9,64,64: the Gen4 cards nothing, as the measured best 4,1,0,4,0,1,4,4 did, the
Gen5 x8 ones half of what it gave them.

It is a new value of the variable, not a new default: unset and "auto" keep the quadratic rule,
so nothing runs differently until a measurement on the board says so. Which rank owns a word
changes only the link it crosses, not its fold, so the bits are those of every other table.
--perfar8 reads the variable the same way. r4d_ar_links_test checks both boards, equal links and
that every rank with a shard finishes together.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-22 11:54:56 +02:00
NunzeandClaude Fable 5.1 91200c900b libr4d: the eight-rank two-shot's timeline -- where a 16 MiB all-reduce spends 1.36 ms against 0.76 ms of link time
At 4 x Gen5 x16 + 4 x Gen5 x8 the weighted two-shot moves a 16 MiB message in 1316 to 1340 us
(K4 to K8, --perfar8), against 763 us that the x8 cards' links need for its bytes, and
measured(K) = f x link time(K) + h x (K + 1) fits f of about 1.45 and h of about 20 us a
handshake. Whether that is link efficiency, waiting for the slowest rank, the local reduce or the
step boundaries cannot be told from the period alone.

A launch now takes an optional `timeline` parameter, a device buffer of nblocks x
R4D_AR_TL_WORDS int64 (r4d_ar_shards.h). Every block of the eight-rank two-shot stamps the device
wall clock after its sequence step, at each handshake when all its stores have drained (arrive)
and when every peer's flag has been seen (release), and after its last local work. The stamps sit
in r4d_ar_handshake behind a null check, so a launch without the parameter pays a branch per
handshake; no value changes either way.

r4d_selftest --perfar8 --timeline launches each two-shot point once more with the stamps on and
prints, per rank, the first push, every step's work and wait, and the final assemble. In one piece
that is the reduce-scatter's send, its receipt, the reduce with the all-gather's send, its receipt
and the local assemble, so the two hops are measured apart; in K pieces it shows which rank works
while the others wait.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-22 11:54:56 +02:00
NunzeandClaude Fable 5.1 b34af6c509 libr4d: eight ranks on one card for r4d_selftest -- the eight-rank protocol testable on a box with fewer cards
The eight-rank collectives could only run on eight cards, so a change to their protocol, shard
table or arithmetic went untested until a TP8 window. Their bits do not need eight cards: a peer
on the same card is just another region of its VRAM.

build() now skips hipDeviceEnablePeerAccess for a peer on the rank's own card (the runtime refuses
it, and nothing needs it). On distinct cards nothing changes.

R4D_SELFTEST_ONE_CARD=1 lets --perfar8 run its eight ranks on the first card: each rank takes a
non-blocking stream of its own (one stream would serialise ranks that spin on each other), main()
raises GPU_MAX_HW_QUEUES to 16 before the runtime starts so the streams get queues of their own,
the block counts stay at 4 and 8 so all eight ranks' blocks are resident at once, and the workers
meet at a barrier before fini and the frees, which synchronise the card. With a card a rank the
worker keeps the legacy stream, so the timed launches are as before. On one card the results are
checked against the fold exactly as on eight; the times are not a board's, since the card runs
the eight queues in time slices of several milliseconds, and the run says so.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-22 11:54:56 +02:00
NunzeandClaude Fable 5.1 4f821ce0b9 glm5next: the latent and index caches are declared replicated -- the host tier holds each once a slot
Every rank computes the whole normed latent (kv_store over the replicated kv_a) and pools
into the whole index cache, in the head form and the row form alike, so both cached groups
carry rad_kv_group_replicated. At eight ranks a 4-token block costs 49.59 KiB a slot
(kv_latent 48.00 KiB over its 12 layers, kv_dsa_index 1.59 KiB) rather than 396.75 KiB,
12.4 KiB a token rather than 99.2 KiB: --prefix-cache-mib 32768 holds 2.7M tokens rather
than 338K.

glm5next_test pins the two flags at 1, 2 and 8 ranks; the flag is outside the recording
fake's graph hash, so the pinned graphs and steps stand.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-22 09:08:44 +00: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
Juup 17d004d0d0 data/recipes, deploy: Sage-A1.5 MXFP4 with DFlash2
The trunk linears, the routed and shared experts, and the DFlash2 linears
round to OCP-MXFP4 (fp4_e2m1, one e8m0 scale per 32 of K); output.weight
stays block FP8 and the draft head its 2-bit copy. 19.52 GiB against the
block-FP8 sibling's 34.45, served at 25.8 GiB of VRAM a card on tp2.
2026-10-22 11:07:23 +02:00
Juup ef219c2192 arch, data/recipes, deploy: Sage-A1.5's routed trunk with its vision tower, and DFlash2 in place of the MTP head
Sage-A1.5 (InternScience) is Qwen3.5-MoE's routed trunk with the Qwen3.5 vision tower beside it -- a shape qwen35moe_fp8 already declares, but no fixture covered the two together: the MoE fixture had no tower, the VL fixture was dense. arch_test gains q35moe_vl_meta, and checks the tower declares once for the build (not a copy a rank), that it is withheld when no encoder budget is given, and that the routed blocks, the folded shared expert and the MTP layer's own router are still declared beside it.

sage-a1.5-fp8.recipe puts every trunk linear -- attention, the delta net's in- and out-projections, the routed and shared experts of all 40 blocks, and the MTP layer at index 40 -- into block fp8, the head likewise, and keeps the routers, the shared-expert gates, the delta net's parameters, the norms, the embedding and the whole vision tower as the checkpoint ships them. recipe_test reads the shipped file and asserts all of that.

sage-a1.5-fp8-df2.recipe is the same trunk with incoai/Qwen3.6-35B-A3B-DFlash2's tensors in place of the MTP head, which the shared source declares through declare_dflash2. On two R9700s it decodes 392.9 tok/s against 281.6 with the MTP head, at 49.3% acceptance and depth 7; on one card, 231.6 against 168.3.

Compose: sage-a1.5.yaml (two cards, four 32k sessions), sage-a1.5-tp1.yaml (one card, an 8 GiB pinned host pool, one 262,144-token session) and sage-a1.5-df2.yaml. README, DOCKER.md and ARCHITECTURES.md list the containers and the drafter.
2026-10-22 11:07:23 +02:00
NunzeandClaude Opus 5.5 c4a47673f2 docs: GLM-5.3's vision -- the tower, its processor and traps, converting, serving
ARCHITECTURES.md's glm5next section describes the tower, the processor's budget against the
encoder pass, and the readings that are wrong without an error (the downsample's column order, the
rotary's pairing, no rotary in the language model, the draft head's image rows), with what the
tower measured against transformers. GUIDE.md, spec.md §11, PLUGIN.md, the README and the compose
file say GLM-5.3 takes pictures and how a container gains the tower.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:06:34 +02:00
NunzeandClaude Opus 5.5 1f7e1faa73 tests: GLM-5.3's template renders a picture as the reference does; its tower against transformers
The golden renders gain GLM-5.3's picture between text: the engine's media marker becomes
<|begin_of_image|><|image|><|end_of_image|> with no separator, as the template's own emit_image()
writes it (tests/mkchatgolden.py).

tests/glm5_vision_reference.py runs transformers' tower alone on the CPU (only model.visual.*,
about 3 GB) over the pictures of one encoder pass and writes the processor's patches and the
merger's rows, with --taps the tensors on the way (the patch embedding, block 0's q and k after the
rotary, blocks 0, 11 and 23, the post-norm, the downsample), in bf16 or f32. With --compare it
checks what an engine wrote with RADIANCE_DEBUG_MM_DUMP: patches bit for bit, rows to a cosine of
0.99 and a median per-row relative error of 0.08 against the bf16 reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:06:34 +02:00
NunzeandClaude Opus 5.5 2387a23e00 glm5next: pictures -- the tower last, its rows over the trunk's and the draft head's embeddings
With the container's tower and an encoder budget (--mm-max-patches), glm5next declares
rad_block_glm_vision.h's tower after every text and draft op, its weight groups from 46, past the
MTP layer's; an encoder pass issues only the tower. The encoder's rows overwrite the placeholders'
embeddings before the vocab-sharded lookup's reduction (MediaRows), in the trunk and in the draft
head's own lookup (GlmMtp::declare_inputs with `media`), which is what SGLang feeds its draft
model: without them the drafts read the placeholder's embedding and acceptance falls on a prompt
with a picture. The model has no rotary, so nothing else changes in a step. The probe states the
tower's merged block (enc_merge 4).

glm5next_test: the tower only with an encoder budget, at one and eight ranks, its maps, groups,
rotary, unfold and clips; the refusals; an encoder pass issues the tower and nothing else over
two pictures; a prefill with a picture scatters its rows before the all-reduce in the trunk and
in the draft head's history pass, a text step none; a sizing declare with the tower is the real
graph. The operand-count and container cases run on the container with the tower. The pinned
text graph and steps are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-22 11:06:34 +02:00
NunzeandClaude Opus 5.5 b8885461ee arch/common: GLM-5.3's vision tower -- an axial rotary, a 2 x 2 downsample through conv2d_unfold
rad_block_glm_vision.h, transformers' Glm5NextVisionModel: the Conv3d patch embedding as a biased
linear with no position table; 24 pre-norm blocks of RMSNorm, a biased qkv whose q and k are
RMS-normed per head and turned by a 2-D rotary (qk_norm_rope's axial mode, the row on the first
quarter of the frequencies and the column on the second, NeoX pairs across the whole head),
attention within a picture, and a SwiGLU clipped at swiglu_limit (gate above, up both ways, with
gate and up joined into one GEMM); post_layernorm; the 2 x 2 stride-2 downsample; the merger's
bias-free projection, LayerNorm, exact GELU and clipped SwiGLU.

The downsample needs no new op and no weight permutation: the processor stages patches in
merge-block order, so conv2d_unfold (two input rows of two patches a block) writes each merged
block as one row in the checkpoint weight's own (channel, kernel row, kernel column) order, and
the [4096, 1024, 2, 2] weight is read as a [4096, 4096] linear as stored. Every op has rows in
libref, libavx and libr4d.

Weights are replicated and RAD_ACCESS_PER_REQUEST, a group a block, as rad_block_vit.h's are; a
sizing declare sizes the activations at the probe's rows and declares nothing to the core. A
tower with another activation, rotary, no swiglu_limit, no attention bias or rows of another
width than the model's is refused by name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:06:34 +02: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
NunzeandClaude Opus 5.5 69f4906a5c docs: GLM-5.3's decode at a few rows
The five changes for decode's few rows in the glm5next section, where they apply and their
kernel times.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 15:26:57 +02:00
NunzeandClaude Opus 5.5 b86b25e406 arch/common: GLM KDA issues both low-rank down-projections before either up-projection -- one ordered point fewer a layer
A KDA layer projects its input seven times: qkv, beta, the two rank-128 down-projections into
the forget and gate paths, their two up-projections, and the output. The block issued forget's
down- and up-projection, then gate's: a recorded pass orders the input's four readers, then
forget_b, then gate_a reading the input again, three ordered points where two would do. Both
down-projections now issue before either up-projection, in declare as in step, because the
buffer plan takes lifetimes from the declaration order and forget_low and gate_low must not
share bytes while both are live. The same GEMMs over the same operands, so the bytes are the
same; the pinned step hashes move with the order (world 1 0x906897570034f5f5 /
0x68ffc03d2b640d51, world 8 0x9f39f6f7a04dc4d3 / 0x3818eedb4ac10d1b), and the block's test holds
the four readers first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 15:26:57 +02:00
NunzeandClaude Opus 5.5 f909576d09 libr4d: logits_gemm_bf16_cols -- the bf16 head without a block per column at n_embd 4096
logits_gemm_bf16 runs a 256-thread block per vocabulary column. At n_embd 4096 a thread makes two
16-byte weight loads before the block-wide sum, and each row widens both operands for its own
product: GLM-5.3's TP8 slice (19360 columns) took 303 us at six rows and 1133 at 24, where a verify
pass of eight streams lands, against 235 at one.

The new row runs a wave per four columns: lane l takes, in turn, threads 32q + l of the old
block for q = 0..7 -- the same 8-wide k chunks summed from 0 and added in k order, the same lane
butterfly per q, the eight wave sums added in q order from 0 -- so each column gets the old row's
bytes. bf16 widens to f32 exactly, so each weight is widened once for every row and each
activation once for every column. It outranks the block row at n_embd 4096 only; the block row
is unchanged and serves every other width.

Measured at the TP8 slice (r4d_selftest --perflogits), us:

  rows                 1      6      8     16     24     48
  logits_gemm_bf16  239.1  303.2  378.2  741.4 1133.2 2354.5
  ..._cols          235.5  247.5  250.4  404.5  635.6 1220.1

Two columns a wave and 16 rows a pass measured slower. r4d_selftest compares both rows byte for
byte from one row to past one 8-row chunk, at a vocabulary off the column step and a pitched
activation with a NaN and a signed zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 15:26:57 +02:00
NunzeandClaude Opus 5.5 1ff9abe2ba libr4d: gemm_nt_f32 keeps steps of k in flight below 64 rows -- GLM's router read its weights at 150 GB/s
The router (288 x 4096 f32, every MoE layer, the MTP layer in every draft pass) and the index
head gates (32 x 4096) took 26 to 36 us a call at decode's few rows: a lane loaded one weight a
step and fed it straight to its FMA, so a wave had one request in flight. The tile kernel now
loads U steps of k before their FMAs; each lane keeps its ascending fmaf chain and the butterfly,
so every form gives the same bytes, and U = 1 is the tile form as it was.

Below 64 rows the rule takes 2 x 2 tiles with 16 steps, at the router's width from 17 rows 8 x 1
with 8; the wave-per-output kernel for one row goes. Measured (r4d_selftest --cold 256 --perff32,
K 4096), us:

  rows                   1     4     8    16    24    48
  N 288, before       28.1  36.0  36.3  41.9  45.4  47.9
         after        14.4  14.5  15.0  19.1  21.6  35.5
  N 32,  before       27.3  33.3  32.9  36.4  36.2  36.1
         after         9.8   9.8   9.9   9.9  10.0  10.2

r4d_selftest's byte comparison with the host arithmetic passes at every form tried, r4d_emu gains
three shapes with K short of and past whole groups of steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 15:26:57 +02:00
NunzeandClaude Opus 5.5 4fdc786332 libr4d: moe_gemm_fp8a8_f32scale's small-M form at GLM's MTP gate_up slice -- a draft pass routes one token
Every draft pass runs the MTP layer's experts on one token: eight experts, and the expert-major
form's four column tiles a block below 128 routed rows left sixteen blocks, each a chain of 64
stages of 256 K. fp8_f32scale_small takes one column tile of the y-th touched expert a block
(grid rows min(experts, rows) + 1, as the MXFP4 small-M form), stages of 512 K, unconditional
loads masked at the store, LDS-only barriers, and a 128 of K's eight fragment pairs loaded before
its WMMA chain; the per-element sequence is the expert-major form's, so are the bytes.

The rule takes it at the MTP gate_up slice (288 experts, top 8, 512 x 4096) to 384 routed rows.
Down's K of 256 gains nothing from it (within a few percent, a quarter slower at three tokens) and
keeps the expert-major form. Measured (r4d_selftest --cold 256 --perfmxf8), expert-major against
small-M, us:

  tokens       1      2      4      8     16
            73.6   83.6  118.4  214.0  375.6
            36.7   65.8  114.9  203.9  343.9

Byte for byte against the expert-major form at 1 to 16 tokens during the work, and in r4d_emu,
whose grouped cases hold both forms at GLM's MTP slices to a host restatement of the sequence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 15:26:57 +02:00
NunzeandClaude Opus 5.5 961a9b3f13 libr4d: moe_gemm_mxfp4a8's small-M form at GLM's TP8 slices -- a one-stream verify pass is a chain of short expert launches
At 1 to 48 tokens a chunk (8 to 384 routed rows) the expert-major forms spent their time around
the loads rather than on them. Taking the loads out left gate_up at 72 of its 115 us at six
tokens; what remained was the skeleton of each block: 289 grid rows for the few touched experts,
activation scales read row by row from LDS behind a divergent branch, weight rows loaded through
generic pointers (flat loads, which every LDS wait also waits for), loads behind branches so each
store waited for the whole prefetch, and __syncthreads' workgroup fence. With 160 blocks resident
at 21.8 KiB of LDS each, the last round of an expert-major launch ran nearly empty, at the latency
of one block's chain.

moe_mxfp4_small_kernel keeps the expert-major per-element sequence, and so its bytes:

- block row y takes the y-th touched expert, counted by ballot over the offsets, so the grid has
  min(experts, rows) + 1 rows;
- weight codes stay packed in LDS and are decoded at the fragment read, halving the weight tile;
  gate_up stages 512 of K, reading 256 bytes of each weight row at once, down its 128-byte rows
  whole over four column tiles;
- loads are unconditional from clamped addresses and masked at the store, weight rows load
  through global pointers, the barriers order LDS only, and a 128 of K reads its activation scales
  and eight fragment pairs before its WMMA chains.

The rule takes it at GLM's TP8 slices for gate_up to 384 routed rows and down to 32; from five
tokens down reads 3 to 5 % slower than the staged form and keeps it. Other shapes are unchanged.
A deeper register prefetch, a barrier-free form with B straight from global memory and A tiles
sized to the chunk's tokens measured no faster.

Measured at the TP8 slices (r4d_selftest --cold 256 --perfmx), expert-major against small-M:

  tokens          1      3      6      8     16     48
  gate_up, us  36.8   79.5  120.5  145.0  230.3  416.7
               31.4   69.5  101.4  122.4  206.8  390.0

  tokens          1      2      3      4
  down, us     21.2   26.0   34.3   39.5
               16.4   22.5   33.2   37.9

Byte for byte against the expert-major forms over 1 to 48 tokens at every form tried (perfmx with
the old form kept beside it during the work), and in r4d_emu against the host restatement: three
GLM TP8 cases, with runs longer than one tile, dropped slots and E8M0 codes 0 and 255.
r4d_selftest checks the new band against libref at 1 to 48 tokens, and --perfmx names the form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 15:26:57 +02:00
NunzeandClaude Opus 5.5 332b5fa986 docs/GUIDE: a restore gives up other conversations' VRAM; prefix_restore_cuts_total, resumed_below
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 15:24:20 +02: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
NunzeandClaude Opus 5.5 7d392b0400 mem_test: a conversation restored from the host tier comes back no further than the free list
A restore reserves only from the free list, so after the reserve's trim has left a quarter of
the pool free, a session larger than that comes back partly, and the lookup stops at the first
block still on the host. On a hybrid model the hit then resumes at the deepest snapshot below
that point, which the retention ladder can put far down the chain. These tests drive the
engine's restore against the real cache, tiers and manager: two conversations of 0.6 of the pool,
the second admitted by pressure and published, then the first restored. Red on this tree: the
first comes back as far as the free list reaches, the hybrid one resumes below its tip, and a
restore the pool cannot hold is cut where the reservation ended, not at a snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 15:24:20 +02:00
NunzeandClaude Opus 5.5 1ad675e10c glm5next: the DSA indexer scores and selects by query rows over the ranks -- the prefill op that grows with context runs a run of rows a rank, bit for bit
Every rank scored every query row of a step against every complete block of its sequence and
selected its 512 blocks, the same work eight times: 58 ms of a 1029 ms step at a 4096-row chunk
and 20k of context, about 185 ms at 64k, the largest op that grows with the context. From
GlmTp::kSplitRows each rank now scores one run of the step's rows with dsa_score's row_part,
selects for the rows of its run under the bounds the scorer rebased (cu_part), and two
all_gathers lay the page tables and lengths end to end (8 MiB a layer at 4096 rows). The key
side stays replicated. The run's queries are all a rank needs, so the query projection, its
quantiser and the head gates run on the run's rows too, and the gates lose their column split
and gather; the bf16 projection stays on the step's rows where a run would be 64 rows or fewer,
the skinny band whose split count a tuned configuration may set. Each row's selection is the
same kernels' answer to the same operands, so the joined table is bit-identical to the
replicated one and MLA reads it unchanged.

The rule for a run is GlmTp's, stated once: ceil(T / world) rows rounded up to whole 16-byte
words of the gathered row, because an all_gather moves whole words; the indexer gathers one i32
length a row, so its runs are multiples of four (DsaCache::part_rows). A rank whose run lies
wholly past a small step takes the first run and computes dead rows, so every plane it gathers
is written (GlmTp::run_of). The selection planes hold world runs, which can reach past the step,
and the score plane shrinks to one run, 256 MiB to 32 MiB at 64k of context and a 4096-row
chunk. A decode step splits too once rows x live blocks reach 2^18 from 16 rows
(GlmTp::kSplitWork): eight sequences verifying five drafts from about 22k of context, where
scoring 48 rows over 8000 blocks (250 us on one R9700) outweighs the two eight-rank gathers
(about 50 us); a single sequence's six rows never pay. The replicated issue passes cu_part
absent as its tenth operand, because the engine counts operands against the schema and refused
the nine-operand issue at a served engine's first long prompt.

On eight R9700s (TP8, two ranks on Gen4 x8 that day) a 19887-token prompt prefills 3927 tok/s
against 3748 on 1.9.0, 7881 tokens 3990 against 3655, 2k 3849 against 3663; greedy text with the
adaptive draft window is identical. r4d_emu splits decode rows beside a prefill chunk at 2, 4
and 8 ranks and joins the runs as the gather does, byte for byte against the unsplit scorer;
glm5next_test declares the split at 2 and 8 ranks with the lint, holds the row rule to the
formula it replaced at every world, and pins the graph and steps (world 1
0xed3fc26c486ea1b5 / 0x33e5f136f0dbba15, world 8 0x712f01858dbe1047 / 0xf9e357b1333c638f).
dsa_score_fp8's selftest passes 62 of 62 on eight cards, and --perfdsa times the indexer whole
and as one rank's run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 15:24:05 +02:00
NunzeandClaude Fable 5.1 66812280bb r4d_selftest: --perfdsa -- GLM's DSA indexer timed at a context length, whole and as one rank's run
dsa_score scores every complete block of each row's sequence and qsa_select ranks them, so both
grow with the context in decode as in prefill. --perfdsa CTX [M] [iters] times them at M rows in
the packed-cache form glm5next issues, and as one rank's run of a step split over 2, 4 and 8 ranks
by rows (dsa_score's row_part), printing what the split saves before its two all_gathers.

On one R9700, 48 rows (eight sequences verifying five drafts) take 273 + 155 us at 60k of
context and a run of 8 rows 53 + 21 us; six rows save 9 us. qsa_select at 4000 blocks takes 89 us
for any row count up to 32: its split path needs two chunks of 4096, so a list of 3500 to 4096
blocks falls to the single-workgroup kernel past its key cache.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 15:24:05 +02:00
NunzeandClaude Fable 5.1 afe5318259 dsa_score: row_part -- score one run of a step's query rows, and rebase cu for the selection after it
With `row_part` p, `score` holds R rows and row i is query row p * R + i; `q`, `q_scale` and
`gate` stay the whole step's, so a run is the unsplit op's rows bit for bit. A row past the last
sequence scores -inf, so every rank's run can be the same length whatever the step's. The optional
output `cu_part` receives cu - p * R, under which qsa_select runs over the run's own rows (pos
offset by p * R) and finds each row's sequence unchanged; qsa_select itself is untouched.

This is what an indexer split over tensor-parallel ranks by query rows needs from the op: the
scoring is the only per-row work in GLM-5.3's indexer that grows with the context.

libr4d offsets the query operands and compares row0 + r against cu; libref and libavx index the
same way. Without `row_part` nothing changes. Tests: the selftest scores each case's rows in equal
runs and holds every run to the unsplit rows' bytes and cu_part to the rebased bounds; ref_test
checks a run, a run past the step and a short query plane; r4d_emu_dsa (r4d_dsa.hip now runs on
the emulator) splits decode rows beside a prefill chunk at 2, 4 and 8 ranks, selects with the
rebased bounds and joins the runs as the all_gather does, byte for byte against the unsplit
scorer and selection, ties and signed gates included.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 15:24:05 +02:00
AshlynandClaude Opus 5.5 5e8bae8ae6 libr4d, arch, deploy: coded overlap all-reduces, multi-user verify tuning, the split junction, a compose file
The prefill overlap's lane all-reduces coded losslessly at ~12.2 bits a value; the verify step's
GEMM, norm and all-reduces tuned for 17-64 rows; at 4-16 rows each GPU norms its own rows between
a reduce-scatter and an int8 all-gather; deploy/compose/gemma4-31b-w4a8-df2-tp4.yaml.

Squashed from:

- libr4d: the four-rank exact two-shot coded at ~12.2 bits a bf16 value, for the lane row
- libr4d: the prefill overlap's lane all-reduces coded by default
- libr4d: decode-sized two-shots take fewer blocks
- libr4d: gemm_w4a8_nt_m64 at multi-user verify heights (33-64 rows) -- narrower row tiles, wider N
- libr4d: rmsnorm_quant_i8's register form at 512 threads too (33 to 72-120 rows)
- libr4d: ar_rmsnorm_quant_i8_4rank's `sp`, the all-reduce split around the junction
- arch/gemma4_bf16: the 31B's junctions take libr4d's `sp` at 4-16 rows at four ranks
- deploy/compose, README: Gemma 4 31B with RedHatAI's DFlash2 drafter on four cards

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 03:00:48 -05:00
AshlynandClaude Opus 5.5 ab2b3be6c0 core, libr4d, arch: chained launches with block drafters, more prefill overlap, weight reads beside the all-reduces
Chained launches on the AQL backend (a dependent kernel waits on a queue counter in its own
prologue), on by default where the model's plugin measured a gain with its block drafter (the
Gemma 4 31B and 26B); the prefill overlap runs attention per slice with narrower lane-1
reductions; the next GEMM's weight is read into the on-die cache beside each all-reduce at decode
heights.

Squashed from:

- core, libr4d: chained launches -- dependent kernels wait in their prologue, not behind the barrier bit
- core, libr4d: chain a kernel by its name, not by the row that launched it
- libr4d, core: chained forms hold nothing across their body
- libr4d: a chained kernel's prologue polls its counter less often after the first few tries
- core/sched: the advance kernel's chained form
- docs: GUIDE lists RADIANCE_CHAIN; chained launches stay opt-in
- core/device: a chained packet behind a chained one keeps its barrier bit while a plain one may run
- libr4d: qkv_norm_rope and its kv_store fold as chained forms
- libr4d: the split-KV decode attention and its merge as chained forms
- libr4d: the four-rank fused junction's tail form as a chained form
- libr4d: the attention, prologue and junction chained forms hold nothing across their body
- libr4d: the 31B's windowed attention and quant_act_i8 as chained forms; r4d_chain.h stubs for the host emulator
- libr4d: DFlash2's kernels as chained forms
- libr4d: chained forms for the decode tail
- abi, core, arch: chained launches on by default where the plugin measured a gain with its drafter
- arch/gemma4_bf16: the prefill overlap's lane-1 all-reduces take the narrow launch (`overlap` 1)
- arch/gemma4_bf16, libr4d: the prefill overlap runs attention per slice; kv_len_trim
- abi, core, libr4d: RAD_LAYOUT_ANY, and a device-only weight read (prefetch)
- arch: read the next GEMM's weight into the cache beside each collective at decode heights

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 03:00:48 -05:00
AshlynandClaude Opus 5.5 1bb7ad3ef9 The series' PR beneath, composed (a copy; it drops out when it lands)
#159's tree (a full fence on four-rank prefill-sized all-reduces), which the maintainer will merge
by hand in the next release, as the integration branch composed and tested it. Not for review
here: review the last commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 02:59:52 -05: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
AshlynandClaude Opus 5.5 015cba8837 libr4d, arch: the 31B and DFlash2 with fewer launches a step, same bytes
Attention reads q and the gqa-8 drafter's KV in place (attn_paged_qrow); the 31B's attention
prologue stores k and v itself (qkv_norm_rope_kv_store); DFlash2's norm/rope/cache-store chains
and add-then-norm pairs run as one launch each. Carries the launch-cliff padding until that PR
merges.

Squashed from:

- libr4d: attn_paged_qrow on the split-KV decode kernel -- h256/gqa2, and h128/gqa8 by two groups a kv head
- arch: the 31B's sliding layers and its drafter read through attn_paged_qrow where a card serves it
- libr4d: step past the full-card launch cliff in qkv_norm_rope and the row norms
- libr4d: qkv_norm_rope describes its operands, so rad-kbench and rad-tune can time it
- libr4d, arch/gemma4_bf16: qkv_norm_rope_kv_store -- the 31B's prologue stores k and v itself
- libr4d, arch/common: qkv_norm_rope takes v_norm; DFlash2's query pass folds its q/k chain
- libr4d, arch/common: qkv_norm_rope takes n_head 0; DFlash2's context pass folds its key chain
- libr4d, arch/common: add_rmsnorm; DFlash2 issues each residual add with the norm after it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:48:20 +02:00
AshlynandClaude Opus 5.5 04e5480387 arch, data/recipes, libr4d: the 31B's prefill overlap, q|k|v as one linear, RedHatAI's DFlash2, its fc split
The 31B's prefill steps of 1024 rows or more run as two slices with each slice's all-reduces
beside the other's compute; q, k and v as one linear where the container holds them so; the 31B
serves RedHatAI's DFlash2 speculator; DFlash2's fc projection is split over the ranks, bit for bit.

Squashed from:

- arch/gemma4_bf16: a prefill step in two slices, each slice's reductions on the second lane
- arch/gemma4_bf16: q, k and v as one linear where the container holds them so
- data/recipes: the 31B -df recipes make q, k and v one linear (blk.*.attn_qkv)
- arch/gemma4: the 31B serves RedHatAI's DFlash2 speculator (gemma-4-31B-it-speculator.dflash2)
- libr4d: gemm_nt_q takes split_n, and all_gather lands rows at a wider output pitch
- arch/common: DFlash2's fc split over the ranks as windows of block-aligned rows, bit for bit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:48:20 +02:00
AshlynandClaude Opus 5.5 bdb37d5d16 arch: Gemma 4 31B with z-lab's DFlash drafter
Gemma 4's DFlash drafter moves into arch/common so both Gemma 4 plugins declare it, on the int8
grid too; the 31B declares it beside its w4a8 / w8a8 trunk when the container carries one; the
w4a8 and Q8 -df recipes and compose files; the tests.

Squashed from:

- arch: Gemma 4's DFlash drafter into arch/common, for both Gemma 4 plugins, and on the int8 grid
- arch: z-lab's DFlash drafter beside the 31B's w4a8 / w8a8 trunk, its gqa-8 attention at gqa 4
- data/recipes: gemma4-31b with DFlash, the w4a8 trunk with a block-fp8 drafter, and Q8
- tests: the 31B with its DFlash drafter declares the chains where libr4d's fused ops are not declared
- tests: the 31B's steps with its DFlash drafter lint clean, on both grids, at one, two and four ranks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:48:20 +02:00
AshlynandClaude Opus 5.5 239da14d17 libr4d, arch/gemma4_bf16: the four-rank all-reduce by message size, and the 31B's junction fold to 16 rows
The four-rank exact all-reduce picks its transport and block count by message size, for every
tp-4 model; the four-rank fused junction gains its tail form (the two-shot with the junction after
it), which the 31B takes up to 16 rows. Carries rmsnorm_quant_i8's register form until that PR
merges.

Squashed from:

- libr4d: the four-rank all-reduce's fold a word at a time, 16-row standalone all-reduces on the two-shot, counters in L2
- libr4d: the standalone four-rank all-reduce takes the exact two-shot from 32768 elements
- libr4d: the four-rank exact all-reduce's two-shot takes 2 blocks at a DFlash2 verify, not 4
- libr4d: the all-reduce rows' nblocks axis offers 2 and 4
- libr4d: rmsnorm_quant_i8 at decode heights loads the row's operands before its reductions
- libr4d: the four-rank fused junction's tail form -- the two-shot with the junction after it
- arch/gemma4_bf16: the four-rank fold up to 16 rows, on libr4d's tail form

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 09:47:23 +02:00
Marc Siebenhaar 51db508f91 libr4d: R4D_ATTN_FP8 also for the fp8_v4 and k6_v4 caches
fp8_v4's K is E4M3 already and goes to LDS as raw bytes, as on the fp8 cache.
k6_v4's K and the int4 V of both layouts are widened to the value times its
group scale (as for the f16 legs) and rounded once to e4m3 at staging. The
launcher reads R4D_ATTN_FP8 for all three fp8-family caches. The eight new
prefill instantiations spill no registers.

Measured with radiance 1.10.0, fp8_v4 KV, otherwise as above (KL against
the fp8-KV reference with R4D_ATTN_FP8=0):
- R4D_ATTN_FP8=0 with fp8_v4 matches the shipped libr4d (mean KL 0.006713
  in both)
- 3: mean KL 0.0073, p99.9 0.89, max 5.2, top-1 98.3 %
- prompt 200K: 2,609-2,611 -> 3,073-3,091 t/s; 5 x 200K joint prefill
  2,403 -> 2,834 t/s; decode unchanged
2026-10-21 09:46:23 +02:00
Marc Siebenhaar cdc0ae26df libr4d: opt-in fp8 QK and PV legs for the h256/gqa6 prefill attention (R4D_ATTN_FP8)
Ports the 8-bit prefill legs of radiance-vllm-mxfp4's r4d_radiance_extras.patch (commit afa21b5
there) to the h256/gqa6 prefill kernel as two separable bits, off by default:

- O_QK8 (32): Q is quantised to e4m3 once at load (after the folded scale), K stays raw bytes in
  LDS, and Q.K^T runs as fp8 WMMA.
- O_PV8 (64): P is packed to e4m3, V stays raw bytes in LDS, and P.V runs as fp8 WMMA. PGROW
  tightens to 8 octaves (e4m3 max 448) and DOT2 is off.

Both need CONTIG and are compiled out for bf16 KV. Byte tiles halve the K/V LDS footprint.
prefill_launch reads R4D_ATTN_FP8 once: 0 = f16 (unchanged), 1 = QK8, 2 = PV8, 3 = both.

Measured with radiance 1.9.0 on 2x R9700 (230 W), Qwen3.8-27B MXFP4, TP 2, fp8 KV,
--tp-wire wht6:
- kernel, ctx 200K, chunk 6592: 161.8 ms -> 113.9 ms with 3 (x1.42); per-row relative error
  against fp32 1.7e-3 -> 3.1e-2
- prompt throughput at 200K: 2,621 -> 3,082-3,127 t/s; at 25K: 4,746 -> 4,861-5,011 t/s
- --kld-ref against the unpatched build: R4D_ATTN_FP8=0 is bit-identical (KL 0 on 10,198
  positions); 3 gives mean KL 0.0076, p99.9 0.94, max 14.3, top-1 98.4 %, PPL x1.0024
- decode and DFlash2 acceptance unchanged (the decode kernel keeps its f16 legs)
2026-10-21 09:46:23 +02:00
NunzeandClaude Fable 5.1 fa4a7a75a4 glm5next: the plugin over its blocks, one a file, and rad_glm_tp.h for the shards and the split threshold -- the same graph, read in order
The plugin carried the draft head's buffers, weights and ops in its declare and its draft pass
in its step, with the three ops that join the head to its layer declared inside the layer
function; each GLM block carried its core in a header of its own (rad_block_mla_latent.h,
rad_block_kda_state.h, rad_block_dsa_cache.h), the split threshold sat in rad_tp_split.h beside
the router's column split, and 64 / world, 8192 / world, 2048 / world were spelled across the
plugin and the blocks. tests/arch_test.cpp held the recording builder, the run-phase fakes, the
step lint, the batch kits and the fingerprints beside every architecture's cases, 9.5k lines in
one translation unit, GLM-5.3's among them.

Now one block a file in arch/common: rad_block_glm_{mhc,kda,mla,indexer,router,mtp}.h, the
cores joined to their blocks, and GlmMtp the draft head in three parts (inputs, join, head),
declared and stepped around the plugin's layer 45. rad_glm_tp.h (GlmTp) holds the widths a
rank's shard divides, the one threshold kSplitRows and the replicated all_reduce declared once;
SplitF32Proj moves over unchanged. The plugin reads as the stream's buffers, then each block's,
the KV groups, the layers, the head and the draft head.

tests/arch_fakes.h holds the fakes and the helpers every architecture test needs, included by
one translation unit a binary (neither binary links rad_core, as before); GLM-5.3's cases are
tests/glm5next_test.cpp, which includes only its plugin, with two cases new: every op the plugin
issues carries the operand count its schema declares (the kernel libraries' schemas under
$RADIANCE_HOME/kernels, counted as core/runtime/issue.cpp counts), and every declared weight
reads an entry the served container holds, at the dtype its stored encoding calls for (the
container's names and encodings as rad-info -v lists them).

Every declared name, declaration order and issue order is as it was: the pinned graph and step
hashes at one and eight ranks are the values arch_test pinned before the move (world 1
0xed3fc26c486ea1b5 / 0x98ba2952bb37b075, world 8 0x8204e073efdeee0c / 0x1279aecfe4e32d9a), and
arch_test's pins of the other architectures are unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 09:44:46 +02:00
NunzeandClaude Fable 5.1 d2a165d56d jinja: the caps probe hands the template an empty tools array, not [null] -- GLM-5.3's template iterated it and lost string content
json{nullptr} is the one-element array [null], not an empty one. The string-content probe
passed it as `tools`; GLM-5.3's template iterates `tools` under `{% if tools %}`, so the probe's
render threw on the null element, the throw was taken for "cannot render string content", and
with typed content unsupported as well every request logged `render_message_to_json: Neither
string content nor typed content is supported`. llama.cpp master passes json::array() (PR
#27130); so does this probe now. The GLM-shaped template in chat_test asserts string content.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 09:42:27 +02:00
AshlynandClaude Opus 5.5 61266c812b libr4d: a full fence on four-rank prefill-sized all-reduces, for a rare fresh-start divergence
On a freshly started 31B server at four ranks (4x R9700), the first greedy reply now and then
flipped a near-tie: 1 of 8 fresh starts after scribbling the cards' memory. Per-op output hashes
located the divergence at a prefill all-reduce that read a peer's scratch before that peer's words
had landed: the first reuse of a double-buffered slot, inputs identical on every rank. A full
system fence on every thread before the flag (drain 1), or after it (acq 1), cured it on the cards
(26 of 26 fresh starts). The per-wave store wait, the publisher's single writeback and Relaxed
Ordering off on every link did not. The mechanism below the fence is not known.

r4d_cfg_ar now takes drain 1 for a four-rank message of RADIANCE_AR_FENCE_FROM elements or more
(default 131072: 24 rows of the 31B's 5376, above any verify height and below every prefill chunk).
Decode and verify all-reduces keep the per-wave store wait and pay nothing; 0 turns the fence off.
Two-rank all-reduces never take it: Qwen3.8-27B's prefill at tp 2 paid 4.5% for it, and no
two-rank fresh start ever flipped. GUIDE.md lists the switch. Bytes are unchanged either way; only
when the flag goes out moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 02:31:40 -05:00
Memoria (Noblistic) 459529638e dashboard: statsdump exits cleanly when its handle is dead; sparkline comment told a third wrong story
Judge ringer 4 on the final tree (3 slices, Tasmania, independent questions).
Slice A PASS-WITH-CAVEATS, slice B PASS-WITH-CAVEATS, slice C FAIL. Both
findings were real and both are fixed here.

statsdump (slice B, R1 + R2): the rotation fix deferred the death instead of
removing it. If the best-effort reopen inside rotate() itself fails, out stays
CLOSED, the re-raised OSError is swallowed by the cap check's handler, and the
next poll's write raises ValueError -- which no handler in the file catches
(they all catch OSError). Slice B found the unpatched twin in the write-failure
handler: close succeeds, reopen fails (EMFILE/ENOENT/EACCES/EIO -- not ENOSPC,
which append-open survives), and the cap check's out.tell() dies on the closed
handle two statements later. Both paths now raise a dedicated RecorderDead,
caught at the loop: the recorder exits loudly with its exit summary, because a
handle that cannot be reopened means recording cannot continue. Deferring a
traceback by one iteration was the wrong ambition; exiting with the count is
the honest terminal state.

Canaries reproduce both geometries (reopen fails after rotation shift fails;
reopen fails after write fails): pre-fix dies 'ValueError: I/O operation on
closed file' with no summary in both; post-fix exits rc=0/rc=1 with the summary
printed in both.

dashboard.cpp (slice C, FAIL): my previous commit replaced one wrong sparkline
comment with another. The truth, verified against the call sites: setMetric
samples EVERY poll for every tile (idle polls push 0), so the accept sparkline
spans the same 60 s as the others; the only difference is the dash case -- no
draft head, no value, a gap that stretches the line over more wall-clock. The
original comment claimed 10 s drafting windows; my rewrite claimed drafting-only
sampling, conflating the sparkline (setMetric/hist) with the triple's recent
window (noteSample, win=false). Two lies in one comment block, both caught by
review rather than by me.

Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
2026-10-21 09:27:48 +02:00
Memoria (Noblistic) b2e0ef7911 dashboard: the accept sparkline comment described a sampling scheme that never existed
Auditor flagged this twice; it is a lie in shipped source (the comment is
served inside the page), so it goes before merge rather than after.

The comment claimed the sparkline's samples are 10 s drafting windows. No
10 s clock exists anywhere in the page: HIST is 120 at the 500 ms poll
(dashboard.cpp:1249), and the accept series pushes via noteSample only when
the poll drafted (aw.dr > 0). The true distinction from the other tiles is
the drafting-only sampling, not a different window length: 120 drafting
samples are 60 s of continuous drafting, stretched over more wall-clock when
drafting is intermittent.

Comment-only change; no behavior touched.

Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
2026-10-21 09:27:48 +02:00
Memoria (Noblistic) 3178807ba7 dashboard: detail-line 'now' clauses stop reporting stale values as current
Operator ruling 2026-10-20, applied one line down: the idle-0 law exists
because a stale value wearing a current name is a false measurement. Judge
slice 26 found the same defect surviving in the detail lines under the three
figures already fixed -- the headline obeyed the law and its own detail line
did not, so a busy lane that drafted nothing showed 0 and 'now 87% of
highest' directly beneath it.

- Accept tile: 'now' is shown only when THIS poll drafted. The guard inside
  acceptTriple (last.dr > 0) can never be false -- the ring only stores
  deltas with dr > 0 -- so the freshness test moved to the caller, where the
  poll's own delta is known. highest/recent are session statistics by design
  and stay.
- Step tile: 'now X% of best' is gated on this window HAVING decode steps,
  not on the lane being busy. During a prefill-only stretch the lane is busy
  and lastStepMs holds the last decode poll; the headline reads 0, so the
  clause must not print.
- Speculation 'per step': reads 0 when the window took no decode steps
  instead of holding the last value. EXTENSION of the ruling by one figure,
  named here because it was not one of the three the operator listed -- same
  defect class, flagged by slice 26, and it is derived from the step tile
  that already reads 0, so leaving it frozen made the panel disagree with
  itself.

Fully-idle was already correct on all three; every one of these was the
busy-but-no-measurement window.

Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
2026-10-21 09:27:48 +02:00
Memoria (Noblistic) eed70619cc dashboard: 'Average' -> 'Accepted of drafted' -- the label names its denominator
Operator call. The bullet is the engine's lifetime marginal ratio,
accepted/drafted (core/sched/draft.h:172, 'cumulative and exact' -- a pooled
ratio of sums, not an average of anything). 'Average' was wrong twice: it is
not an average, and it hid which denominator it used.

The panel shows two ratios that count the SAME accepted tokens and differ
only in the denominator -- reached for the live figure, drafted for this one.
'Average' distinguished them by time, which is not the axis they differ on,
and invited reading the lifetime figure as a longer window on the live one.
Naming the denominator makes the panel self-documenting, which is the same
reason the live figure became 'conditionally accepted'.

The label is ours, not upstream's: 685ec5b's panel had no such key, so this
asks nothing of upstream vocabulary. No test keys on the string (checked).

Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
2026-10-21 09:27:48 +02:00
Memoria (Noblistic) 87becd5812 scripts/statsdump: rotation failure must not leave a closed handle (auditor ringer Q2)
The disk-full fix in c9aa677 guarded the WRITE path but not the ROTATION path:
rotate() closes the handle first, so if the generation shift or the reopen
itself raises (ENOSPC bites when the directory must grow), out stays closed --
and the next poll's write raises ValueError, which the OSError handler does
not catch. The poller dies with a traceback and no exit summary: the exact
terminal state the size cap exists to prevent.

Fix: rotate() reopens best-effort before re-raising (append-open needs no
disk space, so it succeeds even on a full disk), and the exit close is
guarded so a failing flush cannot eat the summary line.

Can-fail verified by injecting ENOSPC into os.replace at the second shift --
the auditor's geometry, rotation failing with the handle already closed:
pre-fix dies 'ValueError: I/O operation on closed file' with 0 summary lines;
post-fix completes the run, rc=0, summary printed.

Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
2026-10-21 09:27:48 +02:00