New models. Thinking Machines' Inkling 2 Mini by gostar (#584-#586): its text backbone and loop, the
release's NVFP4 and MXFP8 checkpoint read by the converter, an int8 trunk, the vision tower, tensor
parallelism, tool calls (with Warzuponus) and an image processor that matches transformers bit for
bit (millaguie). Inkling's routed experts are served in IQR-V4's four-bit trellis (moe_gemm_iqr),
fitted by GPTQ against Hessians the plugin now records (`--calib-dir`), its token embedding in int8
(read in place by embed_lookup), and incoai's DFlash2 drafter in four bits in place of the release's
DSpark. That container, 14.4 GiB with the vision tower, decodes 190 / 427 / 658 tokens a second at 1
/ 4 / 8 streams at tp 2 on two R9700 with `draft-window: adaptive` (code 240 / 550 / 790,
step-by-step arithmetic 358 / 811 / 1116): 19-43% ahead of the same target with the release's DSpark
drafter and 45-83% ahead of the all-int8 container (26.1 GiB, 124 / 263 / 386), at a mean KL of
0.0066 against the release's weights (int8: 0.0042). DeepSeek-V4.1-Flash on 2.x by baKon (#583),
with its vision tower, its IQ1_S and IQ2_XXS containers and linears and experts served in
llama.cpp's own blocks; parts ported from mikoskinen/r9700-exact-serving by Dad_Vibes' fork.
GLM-5.3-Flash on 2.x with its IQR / IQ8R container, an int8 latent cache and four-card serving by
AnimusNull (#566). Gemma 4 dense on EXL3-V3 by keptn42 (#537), on the EXL3 dense rows and
qwen35_exl3 tensor parallelism by Hero422. NVIDIA's 2-bit Nemotron-3.5-Bolt-74B-A9B on one card by
keptn42 (#477). Wan 2.2 TI2V-5B text-to-video and first-frame video by rkcth (#535). LFM3-1.7B on
RDNA3 iGPUs by DokterSmol (#578). Qwen3.8-27B in bf16 with the DFlash2 drafter, and bf16x12, bf16
weights packed losslessly in 12.25 bits, by eddie168 (#577). Int8 experts for drama-3 by morevgalex
(#598).
Speculative decoding. Draft trees for Qwen3.8-27B's DFlash2 drafts by Kezi (#450, opt-in): one card,
+17% at one stream and +14% at two. --draft-max-lanes and --draft-min-accept, two gates on a block
drafter, and --draft-window-ckpt, its window KV kept in the checkpoint slots, by rkcth (#600-#602).
`draft-window: adaptive` verifies each sequence's drafts up to the first one unlikely to be kept. A
verify's rows share each K and V tile in Inkling's attention by gostar (#608): 93 to 118 tokens a
second at a 70k-token prompt on one card.
Generation. Krea 2 instruction edits with one or two references and registered outfill, LoRA on the
image generators with bias deltas and row-mixer adapters applied per request, and MiniMax-H3's
model-declared sparse attention profiles, by rkcth (#534, #542, #543, #605-#609). MiniMax-H3's audio
reference guide pinned from a frame by 1beb (#595). LTX-2's chunk ceiling raised to 40 by Itoash
(#570).
Fleets and memory. memory.queue-reserve, the hardware queues a card keeps ready, by kevinjd (#589).
memory.pinned-numa-node by Foundry (#580). memory.card-headroom-mib on single-model tensor-parallel
budgets by zihaomu (#624). Parked weights rebuilt on the CPU, memory ownership kept across a failed
handoff and quiescent callbacks serialised, by rkcth (#557-#561). A warm load may unload a parked
model (#592); the first card listed chooses the architecture (#458).
Kernels. libr3d's packed dense IQR GEMM and routed IQR expert rows on gfx1100, and libhalo's GEMV
decode for Qwen3.8-Flash-Next's MoE down, by zihaomu (#562, #620, #622). GGML IQ2_XXS and IQ3_XXS
packed on the card by baKon.
Dashboard. KV cache in tokens (in use, capacity now and with all flexible space), live figures
through long prefill steps, step / decode / prefill / acceptance lines without holes, and expert hit
rates only on tiered models. Seven tile and history defects fixed by Noblistic (#597), vision
encoder and per-card hardware figures by davetha (#574), per-LoRA attribution by dowjames (#552).
Fixed. return_tokens / return_token_ids on the OpenAI endpoints (#571). reasoning_effort "none" and
"minimal" reach a template that takes them as levels, by millaguie (#608). Misaligned loads in the
windowed paged attention over an int8 cache (#540). A retired 27B head refused by name (#541).
rad-convert's GPU trellis jobs kept fed, and --reuse-only, by gostar (#575). jinja's tojson takes
sort_keys by Warzuponus (#582). hfget measures file sizes with stat, by kepler_62f (#623). The
tested C++ compiler is stated in the build guide by lowell80 (#551). The codebase was cleaned up:
shared helpers instead of repeated blocks, and the int8 linear, activation and GEMM code no longer
named after the retired fp8 formats.
Inkling 2 Mini is served in one form: IQR-V4 experts with the DFlash2 drafter
(StillDeadcode/inkling-2-mini-iq4r-v4 on Hugging Face, or
data/recipes/inkling2-mini-iq4r-v4.recipe). A container with the release's DSpark drafter, or with
NVFP4, int8 or 4-bit experts, is refused by name and needs converting again.
Plugin ABI 44: out-of-tree plugins need to be rebuilt.
Thanks to @gostar, @baKon, @Dad_Vibes, @AnimusNull, @keptn42, @Hero422, @rkcth, @DokterSmol,
@eddie168, @morevgalex, @Kezi, @1beb, @Itoash, @kevinjd, @Foundry, @zihaomu, @Noblistic, @davetha,
@dowjames, @Warzuponus, @millaguie, @kepler_62f, @lowell80 and @Code000.
The release's NVFP4 experts (layers 0..19) re-quantised to the rotated int8 that inkling2-mini.recipe
already uses for layers 20..23, so every expert runs moe_gemm_q at i8a8h, which has a WMMA path. On
one R9700: decode 35.9 t/s instead of 28.6, long prompts prefilled about 7x faster, for 23.4 GiB of
experts instead of about 15. Against the NVFP4 container (KL mode, 25218 positions): mean KL 0.0065,
top-1 97.2 %, perplexity 4.737 against 4.744.
The DSpark drafter pays only on this form: a verify runs eight rows through up to 64 experts, which
the NVFP4 kernel cannot do faster than one row at a time. ARCHITECTURES.md gains both measurements.
Inkling 2 Mini's own drafter, run by the core's block drive (RAD_DRAFT_BLOCK, depth 7, block 8):
three dense layers denoise [anchor, MASK x 7] over K and V each layer derives from four trunk
taps (application 5, 23, 41 and the normed output), two of them with a 1024-position window,
then the recurrent Markov head proposes greedily. The trunk taps its stream, runs the verify
rows it already supported, and probes a fixed depth of block_size - 1.
Convert with --draft-model <release>/mtp.safetensors and the release recipe, whose new rules
store the derived softmax and fold weights bf16. See rad_block_dspark_inkling.h for the forward
pass and where it rounds differently from the reference.
Inkling 2's DSpark drafter has 24 query heads over 8 KV heads. The scalar window kernel needed
its workgroup's rows to divide by the head ratio; RowsOf<HD, GQA> now takes Geo's rows where the
ratio divides them and otherwise the largest multiple of lcm(waves, gqa) that fits (24 at gqa 3:
eight positions of three heads, one drafter block). Every existing geometry keeps its rows. The
WMMA tile has no gqa-3 form, so such a launch stays scalar at every shape.
Inkling 2's drafter corrects its base logits with a recurrent (`rnn_hidden`) head instead of
DSpark's fixed bigram: a rank-R gated state over [state, w1[previous]] and the position's
[hidden, f_rnn] context, its tanh latent through the folded head (lm_head @ hidden_out) added to
the bf16 base logit, softcapped, and the greedy argmax the next predecessor. Every step rounds to
bf16 where the reference's torch ops do (vLLM models/inkling2 dspark.py, ops/dspark.py).
libref carries the reference; libr4d one workgroup a sequence for the contexts and the state
update, and a tiled full-vocabulary scan with a reduce between steps.
Inkling 2 ships its DSpark drafter as mtp.safetensors beside the target, configured by the
target's config.json `mtp_config`. --draft-model now takes such a file: its tensors go under
`draft.` as a repository's do, and `mtp_config.<key>` is published as `draft.<key>`.
Two name-map modes for weights a drafter derives from checkpoint tensors at convert:
RAD_MAP_MATMUL (left @ right, f64 sums rounded once, a vector right gives a vector) folds a
projection into the lm_head; RAD_MAP_SOFTMAX takes the softmax of a row. Both are stored by a
recipe rule, as other derived weights are. rad_arch.h gains map_matmul() and map_softmax().
A one-model fleet skips the load broker, leaving card-headroom-mib out of
the engine's VRAM split despite logging it. Pass per-card overrides into
the model budget, size the common split against each card's own reserve,
and use extra rank room for resident experts under expert_tiered. Report
actual per-card reserves and require restart if they change.
Refs: #594
busybox's wc -c without FEATURE_WC_LARGE counts in a 32-bit unsigned
integer, so every file over 4 GiB reads back as its size mod 2^32. A
bit-perfect 5.2 GiB download measured 919 MB: the completeness gate
failed, and the resume arithmetic reported 4.0 GiB of missing bytes on
a file that was already complete.
stat -c %s reads st_size (64-bit) and exists in both contexts hfget
runs in: the host's GNU coreutils and the image's busybox.
pin_pieces registered private anonymous memory with hsa_amd_memory_lock_to_pool
but never mlocked it, so the kernel could swap or migrate pages and the driver
then evicts and restores every queue of the process. Mirror pin_pieces_file:
mlock2(MLOCK_ONFAULT) before the prefault, a warning (not a failure) if it is
refused.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Read vsa_gate_compress, vsa_min_tokens and vsa_dense_prefix_layers from the
checkpoint instead of assuming the gated form. An ungated profile declares
three projections and no pooled-tile buffer, and dense attention stays
declared as the fallback below vsa_min_tokens and on the dense prefix
layers. Tile capacities are sized from the row budget; a step over the
declared capacity is refused by an engine-fatal guard that accepted
geometry cannot reach. Tests declare every profile and also issue and lint
a VSTEP for the gated, ungated, below-cutoff and dense-prefix cases.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Registered outfill places one reference on an explicit 1024x1024 canvas
(outfill: horizontal left|center|right, vertical top|center|bottom), generates
around it with reference-token queries isolated to reference keys (an internal
negative-infinity bias only the driver produces) and a per-span timestep
(RadGenBatch::mode_sigma, appended after ref_log_bias), then blends the source
back over a 32-pixel seam on sides that border generated area; sides on the
canvas boundary keep the source pixels. Adds scripts/krea2_outfill.py, which
applies no adapters unless --lora is given.
Stacked on krea2: support instruction edits with one or two references.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
An edit-enabled Krea container (pipeline.krea_reference_encoder=1) grounds up
to two references through the Qwen3-VL tower and also encodes them as latent
tokens through the Qwen-Image VAE encoder. The DiT's attention takes an
optional log bias from target queries to reference keys (attn_dense_ref, with
a CPU reference and an RDNA4 row), exposed as ref_boost on /v1/images/edits.
Appends RadGenBatch::ref_log_bias (rebuild the engine and plugins together)
and a trailing prefix argument to VisionTower::declare. The lanes of latent
state and the conditioning store follow the configured sequences (at most 8).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
#588 sets LinearFP8::plain_bf16_view on the shared expert's down projection
only when a runtime adapter targets it. qwen35_fp8's declare pre-probes layer
0's shared down (to size the shared activation pair) without that flag, and
MoeFP8 skips its own probe once the weight is mapped. With a targeting
adapter, layer 0 therefore stayed probed as int8: the gate wrote only int8
codes while the gemm_nt view read a bf16 plane nothing wrote, and a group-128
shard kept the trunk's 256 as the pair's group.
Make the pre-probe choose the view exactly as MoeFP8 does
(rad_lora_source_targeted on the same checkpoint source), and size the code
pair from the weight's own group when the view is taken. LinearFP8 records
`viewed` so the choice is not re-derived. With no adapter nothing changes.
The test declares 512- and 768-wide shared experts at TP1/TP2 with and
without a targeting adapter, and lints decode, prefill and mixed passes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The commit that added the key said the reserve was the memory a full-card claim is short of, on the
strength of a failure trace. Two builds later that is measured rather than inferred, on hardware: with
four entries in one exclusive group and the chat seat claiming every MiB of the pool it may use, the
claim that failed the handover back at the default reserve of eight (after the fleet had already closed
all eight queues under that demand, which is the part that makes the trim useless here rather than
wrong) passes every leg at a reserve of two, and ends a full tour with 266 MiB free on a card it used
to be left about 51 MiB on.
The ceiling moved with it: 32000 is a working claim on that box now, and the number that fails is
128 MiB higher. §7.1 says so, because the paragraph otherwise reads as advice to tune a knob for a
couple of hundred MiB nobody would notice.
An entry that claims a whole card with gpu-memory-mib is short of exactly the fleet's queue
reserve on its way back on: eight kept queues is 328 MiB of the card, on a card whose free
pool the claim has already eaten. The gauntlet on kevin-garage measured it at claim 31948 of
a 32113 MiB card, where every leg passes once the reserve is closed, and at 32000, where the
demand still fails after the fleet has handed the 328 MiB back.
The reserve cannot simply be cut for everybody. It exists so a queue is never opened on a
full card, where the driver prefetches the new queue's context save area into VRAM while it
holds the process's memory map lock, that prefetch evicts another such range and waits on an
eviction worker needing the same lock, and nothing moves until a kernel timeout; and a fleet
that parks pays it on every restore, whose streams take three queues a card while its
neighbour has filled the card. That is a property of the fleet, not of the engine, so it
belongs in the file:
memory:
queue-reserve: 2 # 1 to 24, default 8; each queue costs about 41 MiB a card
Fleet::queue_reserve_ is that number and Fleet::queue_keep_ is the smaller of it and
kKeepQueues, so an offload and the last-resort trim leave no more than the reserve rather
than overshooting a small one, and a file that says nothing behaves exactly as it did. The
fleet now says the reserve on one line at the start, with the bytes it costs a card, because
on a full-card claim it is the number to argue with.
Covered by a test in fleet_config_test.cpp: the key parses to 2, and 0, 25 and a word are
refused, while an unset file leaves the default standing. The handover legs themselves are
what the claim is about, and they are measured on the cards, in #484.
An unload left its card holding the reserve of eight kept queues, 328 MiB of an otherwise
idle card, and the next bring-up opened queues ahead of its streams on top of that. A model
claiming a whole card with gpu-memory-mib is short of exactly those bytes on its way back on:
measured on a 31.2 GiB claim of a 31.36 GiB card, five seconds between "4 queue(s) opened
ahead of its next streams (8 open now)" and "the fleet has no room for it: the models that
may leave did not free enough", then "startup stopped: out of memory", with the entry left
failed until the container is recreated. It shows up only after traffic, never on the boot.
So an unload now leaves four kept queues and no more, and a park closes them the same way: a
parked model holds no streams, four is more than its restore's streams take (two a rank, a
third for a second lane), and a card just left is the emptiest and safest moment to destroy a
queue in. The next bring-up reopens as many as its own reservation leaves room for, which is
what reopen_queues already clips to.
card_quiet, which both trims ask, was the reason the reserve could not be closed at all: it
answered for any model with any op in flight, anywhere, and an op that cannot reach the card
(a park, an unload, a yield, a fill, all on cards the model already holds) held every other
card's queues closed. A load or a restore still answers for every card, since its cards are
not chosen yet, and so does a model in bring-up or a resident engine with a rank there; a
parked engine no longer does. The device still answers for the rest, destroying nothing while
any queue of the card holds a packet.
Still to measure on the cards: that a claim of 31948 now settles with about 246 MiB more
free a card after a handover, and that four sessions plus a media leg survive an hour of it.
Refs https://codeberg.org/StillDeadcode/radiance/issues/484
At startup, list which logits_gemm row each M band selected for every
logits_gemm op (a drafter head's is its own op), and the rows registered for it
that no band selected. An opt-in row that is registered but inactive, such as
the WMMA head row whose priority sits below the scalar row by default, is then
visible instead of implied.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The scalar bf16 head holds eight rows at a time and re-reads a column's
weights for every group of eight rows. For M > 8 a block now takes eight whole
vocabulary columns and eight rows a pass, with 16-byte loads of both operands,
each activation chunk widened once and shared by the eight columns.
Every (row, column) sum is formed exactly as the 8-row kernel forms it
(per-thread 8-term chunks added in k order, the same lane butterfly, the same
wave order), so the output is byte-identical; the 8-row kernel stays the form
for M <= 8 and for operands that are not 16-byte aligned.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The bf16 head at verify and draft row counts runs one workgroup a vocabulary
column at any M, so at M = 56..64 it reads the head once per row group.
Add logits_gemm_bf16_wmma: the m64 WMMA body with an f32 store (a wave owns a
16-column tile, the weight fragment is reused over the row tiles, no split
reduction).
Its summation order differs from the scalar row, so it is not byte-identical,
and a row's bytes must not depend on its batch. It is therefore registered
below the scalar row (priority 40 against 50) and never selected by default; a
build opts in with -DR4D_LOGITS_WMMA_PRIO=<n>. The row refuses (falls through
to the scalar row) for operands it does not serve: M outside 17..64, rows that
are not dense, n_embd not a multiple of 16, unaligned operands, and a head of
more than 2^32 weight elements (the launcher holds the element offset in 32 bits).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two guards for two defects that reached a branch tip with a green suite,
plus the recipe fix behind the worse of the two.
artifact_sums: the manifest is checked with `sha256sum -c --status`, which
happily verifies a line naming a file that is not there. The documented
re-record was:
sha256sum $(awk '{print $2}' tests/ARTIFACTS) > tests/ARTIFACTS
The shell truncates tests/ARTIFACTS for the redirect BEFORE the command
substitution reads it, so awk sees an empty file, sha256sum gets no file
argument and hashes its own empty stdin. The manifest becomes
e3b0c44298...b855 -
the hash of nothing against a file named "-". `-c` resolves that name as
stdin too, re-reads the same empty input, matches, and the test passes
whatever the artifact holds. Measured, not reasoned: with that manifest
committed, appending bytes to core/server/dashboard_page.h left
artifact_sums exiting 0 and printing "every hash matches"; and the
re-record run a second time reproduces the same line, so the damage is
stable and silent. The same placeholder sha (e3b0c442, the hash of empty
input) was found in a deploy gate's expected-value field in a separate
incident, so it is a class, not a one-off.
So: the check now refuses a manifest whose entry names a missing file,
names "-", or carries the empty-input hash, and re-recording takes
explicit paths and writes through a temporary file (--record). Both
docstrings that carried the self-truncating recipe now carry --record and
say why. Can-fail: the new script fails against the commit whose manifest
is the placeholder and passes at this tip; a tampered dashboard_page.h now
exits 1 where the old script exited 0.
page_rules: a tile renders the figure string and then the metric's `unit`
as a separate suffix, so a figure run through a formatter that bakes the
unit in prints it twice -- the defect the commit before this one fixes.
No rule could see it: the existing rules look at staleness, drift, joins
and clipping. The rule is written against the tile's shape rather than a
literal line, so it also fails on a tree that has the bug and no
fork-only field. Can-fail: 1 FAIL against the pre-fix page, 0 at this tip.
(cherry picked from commit 79a633d2a14c74923ffd82a5195a8b1534c0d0ca)
fMs bakes " ms" into the number it returns, and the Step tile appends its
own unit as a separate suffix span, so the figure came out "25.34 ms" and
the tile's suffix added a small ms after it: the Performance page showed
the unit twice on every step figure.
The figure goes back to a bare number -- toFixed(0) at 100 and up,
toFixed(2) below, exactly as v2.2 shipped it before this branch's
freshness fix moved the line -- so the tile's own unit suffix is the only
unit rendered. fMs itself stays: the best-detail line it formats appends
nothing after it, which is where fMs is right.
The defect is this branch's own: it came in with the freshness fix, which
rewrote the tile's show() and reached for fMs. The embed page's step tile
was already printing a bare number, so it is unchanged.
Rebuilt in node:22-slim (tsc -b && vite build), page 685,620 bytes,
core/server/dashboard_page.h re-embedded and tests/ARTIFACTS re-recorded
in this same commit.
(cherry picked from commit 25e5dd0b392489bc4d88003c7137d54df02e8dfe)
The Prefill graph kept the plateau the tiles just lost, and it took two things
to make it, neither of which the tile fix touched. The scheduler ages the prefill
window only when NOTHING is stepping - the idle decay is `open ? 0.0 : time since
the last step of any kind` - so while a model decodes, steps happening and none of
them prefill, prefill_tps holds the last prompt's rate. history.cpp then put that
gauge into every sample with no gate at all. On top of that the page drew the graph
from `prefillRate` with `join: true`, which is uPlot's spanGaps: it draws a straight
line between the two values on either side of a gap. In the operator's screenshot
that is a flat ~3,500 tok/s prefill line running through four minutes the lane spent
decoding, which is throughput the model never had.
Decode cannot do this, which is why it is the model. `decode` is emitted only where
steps_decode advanced since the previous sample, or where it reads a true zero
(eabdd34b), and its graph passes no join. Prefill now works the same way: `prefill`
is emitted where it reads 0, or where a prefill-bearing step proves prefill ran -
steps_prefill plus steps_mixed, since a mixed step carries a prefill chunk as well
as decode rows - and the page's tile and graph both read that one column, with no
join. A sample that prefilled nothing reads 0. A sample whose gauge is not licensed
is a gap. A rate is never drawn across a moment that measured none.
One choice here is the operator's to veto: the tile moved from `prefillRate` to
`prefill`. Its reading rule is unchanged - newest sample, 0 when that sample carries
no value, a dash only for a ring with no sample yet - so the tile and its graph are
now the same figure, prefill tokens a second over wall time, the twin of Decode.
`prefillRate`, that sample's fresh prompt tokens over its own prefill seconds, stays
what a prefill that DID run measured and stays what the drift clause reads to tell a
prefill sample from a decode one. `join` itself stays in the chart for what it was
built for: job durations (jobTime), where a gap is only a moment no job finished.
tests/history_test.cpp gains a test mirroring the frozen-decode one: a decode stretch
withholds the figure, one prefill step or one mixed step licenses it, the engine's own
zero passes, and the ring's first sample has nothing to be gated against. stats() now
takes steps_prefill and steps_mixed, 0 by default, which is what makes the withheld
case reachable at all. tests/page_rules.sh gains two rules - no rate tile may pass
join, and the Prefill tile and its graph must read the same column - and adds prefill
to the newest-sample list. All three page guards pass on this tree (page_rules,
dashboard_page, artifact_sums, with the header re-embedded from the rebuilt page), and
run against the source before this change page_rules fails the two new checks, so the
guards have teeth. history.cpp and history_test.cpp compile here; only the SIMD kernel
table neither one uses is missing at link, so running the ring test itself is left to
the image build.
Fifth defect of this set, and not one the recovery left behind: the page rebuilt from
the restored tree was byte-identical to the page the live lane served, so this join
and this ungated column were in that served page too. They predate the uncommitted
work that was recovered; nothing was dropped in the reconstruction.
(cherry picked from commit 6e51c484373b0bdc2919d8429422f85ee8880e66)
(cherry picked from commit 02a4816969482a90b582b54bb482b65e201b71c8)
The tile is headed as a figure now, and it was built on Series.last(), which scans
back up to 300 samples - five minutes - for the newest NON-NULL entry. history.cpp
only puts prefillRate into a sample that actually processed prompt tokens
(`if (n) put(...)`), and history_test asserts the column is absent otherwise, so a
sample after a prompt completes has no value at all and the tile kept the last rate
that was measured: the lane's 3,456 tok/s sits there for five minutes after the
prompt is gone, with nothing on the tile saying it is history. The same thing the
Step tile was doing, on the tile the operator named.
Now it reads the newest sample and lets that sample answer: a sample that prefilled
nothing did zero tokens a second, so the tile reads 0. An idle rate is 0 on this page
and the defect is the freeze, not the zero - the operator's ruling on the acceptance
tile, and fTps already renders 0 as "0" rather than a dash. A dash stays for the one
case where nothing is known: a ring with no sample yet.
Deliberately not changed: the two draft tiles (Acceptance, Tokens per step) still
take the newest non-null sample, because a sample that drafted nothing leaves
acceptance and tokens-per-step UNDEFINED rather than 0, and 0% acceptance reads as a
drafter that stopped working. Freezing there is the decision made when those tiles
were built, not this bug. Inputs/s is unaffected: the engine emits reqRate every
sample, 0 when idle, so last() cannot reach past it.
Added tests/page_rules.sh, wired as the fast unit test `page_rules`, because all
three of these defects reached a live lane and no C++ test could see any of them. It
checks the rules at the source, which the dashboard_page and artifact_sums tests
already tie to the committed header by digest, so the served page is covered by
transitivity: a tile figure must be the newest sample, the drift clause must not fire
on a prefill sample, and a tile must not clip its own figures. Run against the tree
before these fixes it fails 7 checks; against this tree, 0.
(cherry picked from commit 441869259dd148c1c37b21f127afe6d3e4219d66)
(cherry picked from commit a4cb7e1c97f5c95646f8e21f7074c2a1b7ce8119)
(cherry picked from commit 764bfefc3dd86c91555b8a12b72afb1dd20bbfe6)
Both tile renderers set `truncate` on the headline figure and on the detail line:
`overflow:hidden; text-overflow:ellipsis; white-space:nowrap`. The drift line is
`best 11.45 ms · recent 17.37 ms · now 66% of best`, about 45 characters, in a tile
that fits about 20, so what the operator read was `best 11.45 ms · r…` - the part of
the fix that was working was off-screen, which is a large part of why two rounds of
this looked like a fix that had not shipped. On the headline, `truncate` on a flex
child shrinks it before its unit sibling, so a five-character figure came out as
`12.91 ⋯`.
The detail line now wraps (`break-words` plus `[overflow-wrap:anywhere]`, so a long
unbroken figure can break) and the figure keeps its full width. Tiles get taller;
that is the operator's call to judge, since there is no browser on this box.
The fix had to go in both renderers. The first pass put it in `Kpi` in bits.tsx,
which draws the Overview/Requests/Sessions tiles, while the Performance page builds
its own inline `<button role="tab">` tile strip here with its own copies of the same
classes: the component the page actually renders is not necessarily the one that
looks like the tile. The check that catches it is on served bytes -
`curl /dashboard | grep -c 'min-h-4 truncate'` must read 0 - and this commit's page
is byte-identical to the bundle the lane is serving, which is what proves the three
stages here are the ones that shipped.
(cherry picked from commit e561c668cffeab74ea01152b139de9a18c2bd42d)
(cherry picked from commit 572d180aac68577f656e145a7c2da666b50b14bd)
(cherry picked from commit fec8b841c5172e539094bca6c43166f91455cf76)
`Series.last()` walks back up to 300 samples - five minutes - for the newest NON-NULL
entry, which is the right question for a chart and the wrong one for a tile headed
as "now". `step` is decode-only and null on a sample that carried no decode step,
so through a prefill stretch the Step tile kept printing the previous decode step:
12.91 ms on the live lane while the model was doing 3,456 tok/s of prefill, with
the drift clause correctly absent because of the gate. A stale figure with nothing
on the tile saying stale is indistinguishable from a broken tile, and this tile's
own commit already says an older sample must not pass for `now`.
Both step tiles now read the newest sample by index and let it answer for itself:
no decode step in it, so the figure reads as a dash. The embed page's Step tile had
the same shape through `stepAny` and is changed the same way.
Rates are the exception and stay numbers when they are idle: the engine's own
convention, and the operator's ruling from the acceptance tile, is that an idle rate
reads 0 and the defect is the freeze, not the zero. A duration or a ratio is
different - 0 ms is a step that cannot exist - so those read as a dash.
(cherry picked from commit 59b998220758efb04c528671c09a02d86ca59ad2)
(cherry picked from commit 78c3b3516c649fb6d5803c5040c5f4981603e872)
(cherry picked from commit 6311beed6f8f2fe6c5ff86560c679b5f8b04d34d)
decode is model_row's only level without a counter behind it: decode_tps
is the engine's own recent average, so while the device advances nothing
it keeps reporting the last healthy number. A stall that every other
column honestly reports as stillness -- step, accept and tokStep all gate
on their counters moving -- then reads on the chart as a plausible rate.
The receipt is a 2x R9700 TP2 lane recorded at 1 Hz: the queue froze
mid-decode at 18:04:29Z with one packet unretired (barrier-and done=1),
and the dashboard was served "195.5 tok/s, 1 running" for a full minute
after that, which read as a slowdown to anyone looking and as nothing at
all to the rate chart.
Gate the sample on the evidence the neighbours already use: emit decode
only where steps_decode moved since the previous sample, or where the
number is zero -- idle and nothing-accepted are readings, never
leftovers, so they keep passing through. A model's first sample has no
predecessor and can be no one's leftover, so it emits too. Raw /stats
keeps decode_tps as it is; the guard lives where a stale level becomes
a trend line.
history_test: a_frozen_decode_rate_is_a_gap_not_a_stale_number pins the
three branches. 103 checks over 11 cases pass.
(cherry picked from commit afb3e26b9c6d291534d30fc135a0367ed8030bab)
(cherry picked from commit 1db101871392fb80a974a27edb73238167ed83de)
tests/ARTIFACTS records 958be039… for core/server/dashboard_page.h; the header that
main actually carries hashes 96eb2057…. `ctest -L artifact_sums` therefore fails on
main today -- measured at 5a80ee2f, with both the committed artifact_sums.sh and a
stricter one:
artifact_sums: a committed artifact differs from its recorded hash
The page was rebuilt in the dashboard commits (0730cf82, ce476987, bfc249bd) and the
manifest was not re-recorded with it. Re-recorded here explicitly, through a temp
file, so the rest of this branch bisects green:
sha256sum core/server/dashboard_page.h > tests/ARTIFACTS.new && mv tests/ARTIFACTS.new tests/ARTIFACTS
A dual-socket rig whose first-touching CPUs sit opposite the card pays
the cross-socket hop on every pinned transfer, and the pin had no way to
say otherwise: it preferred the node sysfs reports nearest the card,
which is the right answer until it is not. The key is a placement
preference on the fleet's own order, dev_stuck_exit_ms's pattern --
MPOL_PREFERRED, so a node with no memory places nothing and pages land
where they would unplaced. $RADIANCE_PINNED_NUMA_NODE answers the same
for a tool that reads no configuration file. Neither moves a page that
is pinned already.
Serves Inkling2LoopForConditionalGeneration (model_type inkling2_loop) on the host backend and
on the card, at one rank: layers 0-5 once, the core 6-17 three times with shared weights, then
the coda 18-23, so 48 layer applications, each with its own KV and convolution state, with the
cross-pass controllers and the AttnRes block mixing. The routed experts are read in their stored
form, the router in f32 (as GlmRouter's), norms and clip scales in bf16 as the checkpoint stores
them, the padded vocabulary is never sampled, and an answer ends without its <|end_message|>.
tests/mkinkling2golden.py is a float32 torch reference of the loop. It matches llama.cpp
master's src/models/inkling2-loop.cpp on a 12-token prompt (top-5 identical at every position,
largest |dlogp| 7.5e-4). On the real checkpoint, 12-token prompt, top-16 against the reference:
R9700 TP1 top-1 12/12, mean |dlogp| 0.036; host backend top-1 12/12, mean 0.045.
`format: inkling2_loop` selects the inkling2 plugin and reads its checkpoint: the per-tensor
NVFP4 and MXFP8 expert stacks, w13's gate and up rows regrouped, the cross-pass queries split,
and the short convolutions' [channels, width] and the full-attention static_w layouts.
data/recipes/inkling2-mini.recipe keeps the 20 NVFP4 expert layers as stored and takes the 4
MXFP8 layers to rotated int8.
attn_paged_rel, sconv_res, l2_clip, attn_res_mix, situ_mul, gated_quant_i8, SiTU on
gated_had_quant_i8, and moe_gemm_q at nvfp4a8i8 on RDNA4. The NVFP4 experts' scale table is
read at the extent the plugin declares, and gated_quant_i8, attn_res_mix and situ_mul take their
rows from their operands rather than the ranged M.
Checked by r4d_emu cases for each kernel, and on the card against libref
(attn_rel_device_test) or the formula (sconv_device_test, l2clip_device_test).
The reference and host-SIMD forms of what Inkling 2 Mini's loop needs, each documented in
docs/OPS.md and checked in ref_test's op table:
- attn_paged_rel: paged attention with a relative-position bias and a per-row sink, on window
and full layers.
- sconv_res: the short convolutions with their residual, and K and V's dynamic taps.
- l2_clip: the per-group L2 clip with a scale and a position tau.
- attn_res_mix: the block attention residual mix over depth.
- SiTU: situ_mul over a fused gate_up, and act=situ on the gated quantisers; gated_quant_i8,
the unrotated grouped int8 sibling of gated_had_quant_i8.
- moe_gemm_q at nvfp4a8i8: the NVFP4 experts as stored, int8 activations, the scale and level
multiplied in the reference's order.
9bb3c3e6 set plain_bf16_view on attn_output, ssm_out and the shared-expert
down for every container. A rotated int8 weight then declares gemm_nt over a
relaid bf16 view, which no default kernel joins, so Flash-Next containers fail
at startup with no adapter configured (#587, the serving side of #581).
The builder already knows the runtime targets before arch_declare. Expose that
as rad_lora_source_targeted (the same predicate as lora::source_targeted) and
set the view only when the checkpoint source is one of them. With no adapter
those modules keep gemm_nt_q i8a8h.
The vendored engine threw "tojson sort_keys=true not implemented". Inkling 2
Mini's template writes its tool list with tojson(sort_keys=true), so the tool
capability probe failed and tools were off for that model.
Ported from llama.cpp e1925b3695 (#32366, Xuan-Son Nguyen): value_to_json
takes sort_keys and orders each object's keys by their UTF-8 bytes, which is
code point order, as Python's json.dumps(sort_keys=True) does. Nested objects
and objects inside arrays are ordered too; without sort_keys the insertion
order is kept.
UPSTREAM records the backport as 0023; the manifest re-hashes.
--add-vision copies every base weight itself, so --reuse-only has nothing to refuse and was silently accepted. Refuse it with the other options the vision path does not take.
Refuse an --gpus list that names a card twice. Refuse --gpu-workers larger than the number of listed cards, so the option cannot ask for more device-feeding workers than there are cards. Update the usage text and docs/TOOLS.md to match. Not yet built or tested.
Rebase the complete standalone Wan feature onto current upstream, consolidating its previously submitted assembly history. Preserve upstream MiniMax limit tests and Krea deployment-limit coverage alongside Wan and scoped-VAE regressions.
r4dchain_glm_swiglu_clamped_had_quant waits in r4d_chain_wait and adds in r4d_chain_done, so a
chained pass need not put a barrier packet before it. rad_kernel_chain declares row 0 as acquiring
for itself; the plain form serves above 64 rows, as libr4d's quantisers do.
A prefill step of 8192 tokens routes 65536 rows (top-8) into the quantiser, one past the old
bound; the op has no row bound of its own, so the step failed in the arguments check.
gemm_nt_bf16_m16 and gemm_nt_bf16_tiled each carry a dot2 family and a
wave-matrix family on the impl axis. Both are within one bf16 store step
of libref on every launch, but they are not bit-identical to each other,
so a tune cache that moves a shape between them changes outputs at the
bit level.
Measured on gfx1152 (Radeon 860M) with LFM3-1.7B bf16, teacher-forced
against an f32 reference: tiled arms 0 and 1 give one record bit for
bit, arms 2 and 3 another. Over three long prompts (8,191, 4,999 and
2,047 positions) the wave-matrix to dot2 KL ratio is 1.008, 1.024 and
1.094, each 95% interval including 1 (paired block bootstrap). One
position of one 721-token prompt reads KL 0.005 on the dot2 arms and
2.08 on the wave-matrix arms; the op oracle at zero tolerance finds
both families one store step from libref at most on that prompt's 129
GEMM launches.
Documentation only: no kernel, row or build file changes.
gemm_nt_q i8a8 has three kernels (M <= 16, 17 to 127, the tile from 128)
and the by-value test had four random shapes and one cell at M >= 128.
Random codes seldom land on a rounding boundary: over the random
cases a fused add moves about one output in thirty thousand. So:
- the fused-add cell and the scale-order cell run on each kernel, and a
group-order cell (2^25, -2^25, 1: 0x3f80 ascending, 0 from the last
group down) is added and run on each; a cell fails unless the mirror
it is for moves every output;
- eleven more shapes on the tile (M 128 to 513, N 1 to 255, K 128 to
7,680), three launches of the plain-load instantiation (nt 0);
- y has a guard row before and after its rows and a finite canary (the
NaN word is what a store computed from the NaN scale padding writes);
- the activation's padded pitch is K + 12, so its rows start at every
4-byte phase of the tile's 16-byte load.
Seven faults seeded in the tile kernel each fail this test on a Radeon
860M: a fused add, the other scale order, groups summed from the last
down, a swapped 16-k tile of the weight, the previous group's activation
scale, a store guard off by one row, no column guard. The row guard was
the one the test missed before the guard rows.
A prefill chunk on the 32-row block reads the weight once per 32 rows and
costs about 1.2 ps a multiply-accumulate in rad-kbench, 1.5 inside a
model, where the bf16 tile costs 1.0. From M = 128 a block is now a
128x128 output tile, the int8 twin of r3d_vocab_bf16_wmma.hip: one scale
group of both operands and the group's activation scales staged in LDS,
eight 16-row tiles a wave, the group's exact i32 sub-sum closed in C with
quant_dot's roundings (two multiplies, an add, none fused). M < 128 is
unchanged.
The LDS row bases are made opaque with an empty asm. Left visible, the
compiler kept an address register for every pair of staged dwords and
used all 256. The object's .vgpr_count is 163, no spill, with 34,304
bytes of LDS; the kernel declares four waves a SIMD.
Radeon 860M (gfx1152), power-saver, development builds of this kernel:
- rad-kbench --bench, 260 cases at rel_l2 0. At M = 256: N 15360 K 2048
6.7 ms (9.9 on the 32-row block), N 6144 K 2048 2.6 (4.0), N 2048
K 7680 2.4 (4.7). The two sessions differ by about 10% on the rows the
change does not touch.
- LFM3-1.7B, 8-bit container, time to first token, median of three runs
interleaved with bf16: 2.80 s at 2,048 tokens (bf16 3.28 s), 6.07 s at
4,096 (bf16 7.03 s). The 32-row block gave 4.77 s and 9.73 s.
- Op oracle at tolerance 0, 2,048 + 3 tokens: 354 of 354 gemm_nt_q
launches identical to libref.
The header's register figures were wrong (the object says 104 at MT = 1
and 117 at MT = 2) and its bound on a group's sum left out -128; both
corrected. The row text and the README name the tile and the exactness.
The int8 GEMM cases compared at rel_l2 2e-3, which a fused multiply-add in the
group term passed. They now compare every output's bf16 word with a host mirror
of quant_dot, over M 1 to 300 and N 1 to 512 off the tile sizes, padded pitches
with canaries, saturated and all-zero groups, and scales that step 2^6 between
neighbouring groups. Two cells are built to fail: one where a fused add stores
0x3f81 for the reference's 0x3f80 on every output, one (its scales searched on
the host) where a fused add and the other scale order both store another word.
Each case reports how many outputs those two faults would move.
r3d_selftest is built -ffp-contract=off so that its mirrors round where libref
does.
Against the library before the previous commit the cases fail (the two cells on
every output, four random cases on one output each); after it all fourteen
pass.
The group term was closed with v_fmac_f32, a fused multiply-add, so the product
(sub * a_scale) * b_scale reached the accumulator unrounded where libref's
quant_dot rounds it and then adds. libref and every unit here are built
-ffp-contract=off; an fmac written in asm is outside that flag. The term is now
a v_mul_f32 and a v_add_f32.
On a Radeon 860M with LFM3-1.7B's 8-bit container (300 prompt tokens, 3 new),
the op oracle at tolerance 0 over the 354 gemm_nt_q launches: 168 identical to
libref and 186 one bf16 step off at their worst element before, 354 identical
after.
127 rows over 86 schemas. The attention section says how the decode rows size
their split-KV partials and that rad-kbench's attention shape does not reach
depth.
had_quant_act_i8g at n 128, 2048 and 7680 against a host mirror of libref's
had_quant_act_q8: every scale exact, a code at most one step off where the
device's reciprocal differs in its last place. gemm_nt_q at i8a8 over M 1, 5,
16, 40 and 70 (both tile widths, ragged M and N) against a mirror of quant_dot.
One row for every M. The wave-matrix walk of gemm_nt_q_w8a8_m64 over row-major
int8 activations (quant_act_i8g's output, or had_quant_act_i8g's at i8a8h), the
activation's scale per (row, 128 of K) in f32 and the weight's per (row, 128 of
K) in bf16. Arithmetic as libref's quant_dot: the group's sub-sum is an exact
integer, the group term (sub * a_scale) * b_scale, groups ascending, one bf16
store.
M <= 16 is one 16-row tile a wave, above that two; a block reads its weight
rows once, so a prefill chunk re-reads the weight once per 32 rows. i8a8h is
the same launch: the rotation is in the stored weight and in the quantiser.
The row served n == 128 only and wrote the scale as amax / sqrt(128) / 127 with
a 1e-8 floor. libref's had_quant_act_q8 leaves the transform unnormalised and
writes amax / 127, and 1 for an all-zero group (ref_common.h q8_group); the
1/128 of the rotation is in the stored weight's scale. A GEMM fed by the old
row would have been off by sqrt(128) at every group. No model on libr3d issued
the op, so nothing read it.
The kernel is now one wave a (row, group) over any n that is a multiple of 128
(LFM3's int8 trunk issues n 2048 and 7680): the FWHT still runs once per wave,
so its DPP stages stay out of a loop. gated_had_quant_i8g has the same scale
and is not touched here; nothing issues it with a GEMM behind it on libr3d.
The first walk only needs the scores' maximum, so it no longer loads or converts
the V half of a block. In the second walk a bf16 V was packed to f16 at staging
and unpacked to f32 in software for every key and dim; it is now staged as the
cache's own pair words and widened with a shift, which is the reference's value
for every bf16 (the f16 detour was exact only inside f16's normal range).
The second walk's staging and barriers are now reached by every lane. They sat
under the lane's own "has a visible key" test, and an idle row slot sits at a
later position than the real rows: under a window it can see no key of a slice
whose real rows still see a few, and then left its share of the tile unstaged.
With V staged in the first walk too, the stale tile happened to be the right
block; with V staged once, it would be unwritten memory.
One query row over a 4,087-key context, with the split-KV partials and without,
full causal and under a window whose first three keys end a slice. The row's
scratch hook is called as the builder calls it, with the params and no tensors,
and must size eight slices: a hook that returns 0 only makes the shim fall back
to one slice, which is correct and several times slower, so no other check
notices. The window case is the one in which the idle row slots see no key of a
slice the real row still reads.
The builder calls a scratch hook at declare with the band's params and no
tensors. attn_scratch read the row count from t[0], so it answered 0, the shim
halved the slice count to 1 and a single-sequence decode walked the whole
context with one wave a KV head. Size it from n_head, max_seqs and the decode
band's q_len bound, as gemm_scratch does from its dims.
run_row launches the rope rows with their required params and checks finiteness,
so the proportional ladder and a partial rotary_dim were never exercised. Port
libhalo's rope_ladder_case: an f32 mirror of the reference's rotation with the
ladder absent, rotary and head, and the V head byte for byte.
rad_gemm_run (gemm_nt_bf16_tiled and the bf16 logits GEMM) looked for a
joined-planes header through every weight's address on the host. A plain
weight is a rank-2 bf16 tensor in device memory, and on an integrated GPU
the engine's weight pool is not readable by the host: the first prefill
GEMM of a bf16 model on a Radeon 860M (gfx1152) died with SIGSEGV in
rad_gemm_run, the faulting address inside a GPU buffer mapping. The
selftest passed the row because its weights come from hipMalloc, which
the host can read there.
A joined head reaches the launch as rad_planes_layout stores it, one
byte-addressed operand (rank 1, its codes' dtype) in the mapped tier, so
the header is now looked for only on an operand that is not a rank-2 bf16
tensor. Plain weights take the bf16 path as before.
r3d_selftest: a case that maps the weight with HIP's virtual memory calls,
grants access to the device only, and checks the result by value; a host
read of the weight is caught and reported as a FAIL. It skips where the
host can read such memory, since it proves nothing there.
A host mirror of libref/ref_ple.cpp's depthwise causal convolution, ported
from libhalo's causal_conv1d cases: the taps summed in f64 in ref's order
over the same bf16 bytes, and the window rewritten by ref's rule. y is
compared to a relative L2 of 2e-3, the window byte for byte, and the rows
of a sequence that commits nothing must keep their NaN fill.
Cases: LFM2's band at prefill (width 3 over 2048 channels) with an empty
sequence, a cold window over stale bytes and a slot of -1; a decode step
with drafts (num_accepted 2 and 4 in a window of 5); widths 8 and 2; and
the two refusals, a dilation and a window shallower than width - 1.
LFM2's and LFM3's short convolution is libref's `causal_conv1d`: ple_conv
at dilation one with no activation and no residual. r3d_ple_conv.hip
already holds that kernel arm (SILU=false) and said so, but had no entry
point or row, so the op ran on the host. r3d_rad_causal_conv1d launches
the shared launcher with the activation off and `resid` absent, as
libhalo's halo_rad_causal_conv1d does; the schema is libref's, and the
row is constrained to widths 2 to 8, inside the kernel's 8 taps and its
16-slot write-back window.
The selftest gains an operand builder for the row, so it is launched
rather than skipped: two sequences in one prefill chunk, each on its own
state slot with a history to read, the output pre-filled with NaN.
LFM2 and LFM3 declare their q/k head norms as `rmsnorm_rows` and their
rotary as `rope_rows`, the row-form names libr4d serves and libhalo has
taken as names of its own `rmsnorm` and `rope` launches. libr3d had
neither name, so on an RDNA3 iGPU those ops resolved to the host. Both
schemas are libref's (the same parameters and operands as `rmsnorm` and
`rope`), and both rows launch the existing kernels: byte-identical to the
plain ops.
LFM3's full-attention layers rotate 64 of 128 channels on the
proportional `head` ladder (HF's partial rotary), which r3d_rad_rope
refused. The rope kernel now takes the ladder's width (`den`) and the
count of non-zero frequencies (`nfreq`), as libr4d's and libhalo's do:
under NeoX pairing the launcher widens rot to head_dim exactly where
ref_rope does, and pairs past rotary_dim/2 turn by zero and are stored
back unchanged. The `rotary` ladder (absent, or named) launches as before.
The selftest's shape check gains the row forms at LFM2's and LFM3's
geometries (head_dim 64 and 128, q-only rows, the head ladder).
Each of the nine linears of the shared bf16 blocks (MlpBF16's gate|up and down, AttnGatedBF16's
q|gate, k, v and o, GdnBF16's in, z and out) is declared through decl_linear_bf16 (rad_arch.h),
which looks at the encoding the model holds. A bf16x12 weight, libquant's lossless packing, is
declared over its four planes at its codes' dtype, as the lm_head already is at its own, and its
gemm_nt reads dtype bf16x12, whose libr4d rows give the bf16 rows' bytes. Any other weight is
declared bf16 and read at the block's dtype, so a container without bf16x12 weights declares the
graph it did before, for qwen35_bf16, qwen3asr_bf16 and unlimitedocr_bf16 alike. The
choice is per weight, so a recipe can leave any linear bf16.
With data/recipes/q38-27b-bf16x12-df2.recipe this makes qwen35_bf16 serve the packed Qwen3.8-27B
trunk, with no new plugin and no descriptor.
arch_test: with the recipe's encodings faked (the drafter's plain), at one rank and two with the
DFlash2 drafter, every packed linear is declared u8 over all its planes with the same shape, shard
and row parts, and its gemm_nt reads bf16x12; every other weight, op and parameter, the drafter's
included, is the plain container's. Down left bf16 keeps its bf16 GEMM, and a model holding every
weight plain declares what one with no encodings does.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
gemm_bf16_nt_m64 with each B fragment rebuilt bit for bit from libquant's bf16x12 planes, as the
decode rows of gemm_nt at dtype bf16x12. In blocks of 32 along K a lane reads 16 contiguous bytes
a block (sign and mantissa, the 4-bit exponent offsets, the block's largest exponent) and rebuilds
a fragment dword in five VALU; a raw block's fragment comes from the escape table. The B fragments
are the bf16 weights and the rest is gemm_bf16_nt_m64's, so C is byte-identical to that row at the
same split count. Two forms: plain, and PRE (two row tiles or fewer), which loads an iteration's
activation fragments with its plane loads. The M <= 16 row is the m64 row under its own name, so
decode has its own tuning entry, as for the bf16 pair. No spills.
Where launches chain, both decode rows take their chained form, as their bf16 and int8 twins do:
the kernel's body takes CHAIN, bracketed by r4d_chain_wait() and r4d_chain_done() as
r4d_gemm_bf16_nt_m64_body is (no block returns early), with r4dchain_gemm_bf16x12_nt_m64 beside
the plain kernel. The launch takes the row's `chain` at M <= 64 only, as gemm_bf16_nt_m64 does;
its grid covers every row in one launch, so a chained op publishes one completion. kChained gains
gemm_bf16x12_nt_m16 and _m64.
The layout hook (r4d_layout.cpp) takes every plane of exactly libquant's encoding at the op's N and
K, and stores one buffer of four regions (r4d_args.h): SM, D and E, each 32-block in WMMA
B-fragment order, then the escape table whole on every rank, its rows in the same order. A raw
block's D holds its row four times. The relayout refuses what the kernel would misread, an index
past the table or an offset above its block's exponent, and a raw block with stray bytes, which
the inverse could not give back. Otherwise it is a permutation, and the unrelayout is exact; 1.24
ns a value on one thread.
Axes: wv, sk and mb, as the skinny bf16 kernel's, and form (0 PRE at two row tiles or fewer, 1
plain, 2 PRE, refused above two). Only sk sets the bytes. Splits hold whole blocks, and untuned the
law at that unit gives the bf16 row's splits at K = 5120, 8704 and 3072.
gemm_bf16x12_nt_tiled is the prefill row: the weight rebuilt bit for bit into the op's scratch as
the [N][K] bf16 matrix, then r4d_gemm_bf16_nt_tiled over it, gemm_bf16_nt_tiled's band (M > 64,
N >= 128, K % 64), priority and tile axis. It stores the weight with the decode rows' three hooks,
so every band of an op reads one stored form. The unpack is one thread a 32-block: three 16-byte
loads and a byte in, four 16-byte stores out, its four B fragments the decode kernel's own
(x12_block, both lane halves); 31 VGPRs, no spills. Its split is the decode rows' untuned one, so
the packed rows agree at any K, and at K = 5120, 8704 and 3072 it is also gemm_bf16_nt_tiled's, so
an untuned prefill gives the bf16 container's bytes. The scratch hook asks for N x K x 2 bytes at
any M, which at Qwen3.8-27B's TP2 gate|up is 170 MiB, the largest. The launch refuses another
dtype, a tile it lacks, and scratch short, absent or misaligned, before it unpacks. It stays plain.
rad-tune cannot tune the decode rows: its fixture draws a fill, which is no valid packed weight,
and it times warm, where the server streams the trunk from DRAM every step. r4d_selftest
--tunex12 <file> <woff> N K [iters] reads a real bf16 weight from a safetensors file, packs it
with libquant's default table as --perfx12 does, and runs both decode bands at a row count decode
gives them: M = 8 on the m16 row, M = 64 on the m64 row. Its points are every distinct launch of
gemm_bf16_nt_m64's space (wv 1, 2 and 4, each sk the bound and K allow, mb 1 to 4), which a check
confirms against the core's enumeration. At each point C is compared byte for byte with
gemm_bf16_nt_m64 in both forms, then the bf16 row and the packed row plain and PRE are timed in two
interleaved rounds over weight copies past the last-level cache. One x12pt line a point, for a
script that writes the tune rows.
Measured on 1.x, before this port, on Qwen3.8-27B at TP2's decode shapes (M = 8) on an R9700:
0.13% of blocks raw, 12.27 bits a weight, byte-identical at every tuning point, and 0.785-0.829x
gemm_bf16_nt_m64's time with each kernel at its fastest point. At M = 2048 the unpack adds 13-18%
to each of the trunk's TP2 GEMMs, moving its bytes at 511-701 GB/s: about 66 ms a 2048-token chunk
a card over the 336 calls. On radiance 2.1.0, Qwen3.8-27B bf16x12 + DFlash2 at depth 7, TP2 on two
R9700s (210 W), one stream, seven greedy prompts, three interleaved server starts an arm, with the
blocks' declaration that follows, ms a step:
packed GEMMs and ar_rmsnorm_bf16 plain, the reads on lane 1 41.62
both chained, every read on lane 0 (upstream's rule) 41.10
the packed GEMMs chained, ar_rmsnorm_bf16 plain 42.56
Every text byte-identical. With ar_rmsnorm plain, each lane-0 read sits before a plain all-reduce
that waits for it, which is why the GEMMs chained alone are slower than neither. One change outside
this series: a new stream takes the longest-kept spare queue rather than the newest (#478; 2.2.0's
fix makes the same pick). The lane-1 row depends on it most.
relayout_parity_test: libquant's planes through the hooks with the stored hash pinned, the inverse
exact, the op oracle's reading bit for bit for the weight and rank 1's column share, the refusals.
r4d_selftest, each decode row: synthetic weights with a third of their blocks raw (a small one with
an infinity, rank 1's row and column shares, the trunk's seven TP2 shapes), C byte for byte against
gemm_bf16_nt_m64 at every point of the row's tuning space at M 1 to 64 (_m16: 1 to 16), plain and
chained, both rows untuned, and for _m64 M 65 and 200 and the launch's refusals. The prefill row
(x12_tiled): the hooks are the decode rows'; the scratch is the bf16 weight at any M; C byte for
byte against gemm_bf16_nt_tiled at the same tile and split, at every tile, on a 136 x 2240 weight
with an infinity (M 65 to 2048), rank 1's row and column shares of 256 x 4096, and the trunk's
seven TP2 shapes at M 65, 512 and 2048, each with a third of its blocks raw; untuned, C equals
gemm_bf16x12_nt_m64's at 136 x 2240 and gemm_bf16_nt_tiled's at the trunk shapes; each trunk shape
timed at M = 2048 against gemm_bf16_nt_tiled, the unpack included. --perfx12 times the rows on a
real weight. OPS.md: gemm_nt at bf16x12. KERNELS.md: the three rows, by hand until the report is
regenerated.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A trained weight's exponents sit in a narrow window. Along a row, 32 values at a time, bf16x12
keeps each value's sign and mantissa (a byte) and its exponent field as a 4-bit offset below the
block's largest (a byte a block): 12.25 bits a value against 16. A block whose fields span more
than 15, or hold an inf or NaN, goes whole to an escape table, so every bf16 decodes to itself, bit
for bit. The scheme is its own (codes u8, d u4, e u8 [1x32], esc bf16 {cap x 32}, in natural k
order; a kernel's fragment order is its relayout), decoded by the quantiser's hook, through which
rad-convert measures each weight's error.
rad-convert fixes every encoding before it reads a weight, so the table's size comes from the shape
and the option esc: max(64, ceil(blocks x esc)) rows, at most one a block. The default 0.004 is at
least twice the most any Qwen3.8-27B trunk weight needs (blk.59.attn_k, 0.184% of its blocks; the
trunk's are 0.133%). A weight with more raw blocks, or a value that is not a bf16, is refused, by
name.
data/recipes/q38-27b-bf16x12-df2.recipe: the nine trunk linears qwen35_bf16 declares, as bf16x12,
and the drafter as q38-27b-bf16-df2.recipe makes it. The trunk is 34.9 GiB instead of 45.4 (as
converted on 1.x). Serving it needs libr4d rows that read bf16x12 and qwen35_bf16 declaring the
trunk over them, which follow.
quant_test: every bf16 code through packed and raw blocks, bit for bit, and the planes as the format
states them; the edges (16 binades pack and 17 do not, zeros, an infinity, the largest finite
field); the table exactly full and one past it; a value that is not a bf16; decoding any rows and a
rank's column or row share alone; malformed blocks refused; the table's size from the shape.
recipe_test: the recipe's rules. docs/TOOLS.md and spec.md: the quantiser.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
At more than one rank a decode step now reads the next GEMM's leading weight bytes into the on-die
cache while an all-reduce leaves the card's memory idle (prefetch_beside), as qwen35_fp8 and
gemma4_bf16 do:
- gate_up's first 12 MiB, issued after the mixer's o or out;
- the next layer's first GEMM's (q|gate or the delta net's in; after the last layer the lm_head's)
first 8 MiB, issued after down;
- where launches do not chain, the delta net's out-projection's first 12 MiB beside its recurrent
update, in a pure decode step of up to four sequences (GdnFP8's site);
- the DFlash2 drafter's reads, at qwen35_fp8's 12 MiB.
Each trunk read is issued inside its block, after the last GEMM and before the block's own
all-reduce, so it is beside the reduction whether the block or the next norm's ar_rmsnorm runs it.
Issued after the block in the layer loop, as qwen35_fp8 does, it would follow the all-reduce on
the drafter's tap layers and the last. Prompt and mixed steps, and decode steps past 16 rows, take
none. A read is at most its weight's first N x K bytes. `weight-prefetch: off` declares none, the
drafter's included. The blocks' new members default to none, so qwen3asr_bf16 and
unlimitedocr_bf16, which share them, are unchanged.
Where launches chain (rad_chain_on) every read goes on lane 0 as the chained form right behind its
GEMM. The delta net's out read would then sit in front of the recurrent update, a plain launch
that waits for it, so the read would run in series with the update instead of beside it; none is
declared there. qwen35_fp8 puts the same read in front of its fused conv + recurrent update, which
is chained.
A read writes nothing a kernel reads, so the output does not change. Measured on 1.16.0, before
this port, with the reads on the second lane (launches not chained) and the weights of the bf16x12
container (a later commit): Qwen3.8-27B + DFlash2, TP2 on two R9700s, one stream, 7 prompts, two
interleaved starts each, with the sizes behind an experiment switch:
- greedy text byte-identical in every start;
- 43.95 -> 41.76 ms a step (-5.0%); of the four other size sets tried, (gate_up, next, out) =
(12, 12, 8) MiB was within 0.1 ms at more bytes a pass and the rest 0.1-0.5 ms slower;
- a verify pass 43.03 -> 40.13 ms: the GEMMs 2.18 ms faster and lane 0's idle time 1.68 ms less
(the gaps over 10 us after the GEMMs, 1.21 ms a pass, went away); the all-reduces 0.66 ms slower
(ar_rmsnorm 17.4 -> 22.7 us beside a read) and the delta net's kernels 0.36 ms (its update runs
beside the out read);
- the drafter's query pass 2.51 -> 2.38 ms.
Two sequences' verify (16 rows) reads too; it was not timed. Measured on radiance 2.1.0, where the
plugin's launches chain, three interleaved server starts each, the text byte-identical:
--weight-prefetch off against on, with the out read, 50.86 -> 50.56 ms a step on the bf16
container and 44.30 -> 43.77 on the bf16x12 one (the commits below); with the out read against
without it, Qwen3.8-27B bf16x12 + DFlash2 at depth 7 and the series' chained forms, 41.10 against
40.72 (faster in each of the three rounds), with one change outside this series: a new stream
takes the longest-kept spare queue rather than the newest (#478; 2.2.0's fix makes the same pick).
arch_test: where each read is issued in one and two sequences' verify, none in three, a prompt or
a mixed step, at one rank, under weight-prefetch off or without prefetch, and the drafter's reads;
chained, a verify of one and two sequences issues every read on lane 0 right after its GEMM with no
join, the out reads absent and the others where they were; program_ops lists the reads declared
at two ranks.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bf16 head's column form served n_embd 4096 only (GLM-5.3's TP8 slice). At 5120 a thread of
logits_gemm_kernel holds three 8-wide chunks in waves 0-3 of its block and two in waves 4-7, so
the 32 lanes of a wave still agree. logits_gemm_cols_k_kernel runs lane l through threads 32q + l
in turn, as the 4096 kernel does, each with its own chunk count. Every (row, column) keeps the
block kernel's chunk sums, k order, lane butterfly and wave order, so the bytes are
logits_gemm_bf16's. Three chunks for four columns and eight rows spill (256 VGPRs, 160 spilled),
so the three-chunk steps take the rows four at a time: of five shapes that compile without spills,
that one was the fastest. The row's constraint becomes n_embd in {4096, 5120}; the 4096 kernel is
unchanged.
r4d_selftest: --case logits_gemm_bf16_cols adds M 1, 2, 6, 8, 9 and 17 at N 2051 and M 8 at
N 19360 at n_embd 5120. Each is compared byte for byte with the block row, with a -0 and a NaN in
the activation and a row pitch past n_embd. --perflogits takes n_embd and n_vocab.
Measured on 1.16.0, before this port, on two R9700s: Qwen3.8-27B + DFlash2 at TP2 (a vocabulary
slice of 124160 x 5120, the weights of the bf16x12 container, a later commit), with this kernel
behind an experiment switch:
- r4d_selftest --perflogits, us, block row / column form: 1 row 2005.5 / 2010.1, 8 rows 4288.6 /
2157.0, 16 rows 7997.9 / 3888.7.
- Served, 7 prompts, two interleaved starts each: greedy text byte-identical; the head 3.12-3.20 ->
2.04 ms a verify pass; 45.34 -> 44.16 ms a step (-2.6%).
Any bf16 head at n_embd 5120 now takes this row, which outranks logits_gemm_bf16 wherever its
constraint holds. libhalo's copy is unchanged.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
in and z read only the normed input, so the engine runs z beside in when z follows it. At decode
heights the two then share the memory and both stretch: on two R9700s at Qwen3.8-27B's verify
shape, ~145 us each against ~72 and ~43 apart. gdn_conv_update reads only in's output, so in a
pure decode step z now goes after it: z runs beside that small kernel, and gdn_recurrent_update,
which reads z, waits for it.
Only the order of two independent launches changes, so the output does not. Measured on 1.15.1,
before this port, with the weights of the bf16x12 container (a later commit): the greedy text is
the same, and from in's start to the recurrent update's it is 142 us against 166, 1.6 ms off a
47 ms step (two interleaved starts each). A prefill or mixed step keeps z beside in: there z is a
large GEMM, and the order was measured at decode only.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Every bf16 block ended with all_reduce(h) and add(x, h) and the next one began with rmsnorm(x):
three launches at every block boundary, where the int8 trunks run one ar_rmsnorm_* op.
libr4d: ar_rmsnorm_bf16 is ar_rmsnorm_quant_fp8 without the quantiser: norm_quant_row and the
fused kernel take QZ, their last parameter (default true, so every existing instantiation is
unchanged), and at QZ false the reduce, the residual add and the norm's pass are the quantised
forms' code with the codes skipped, so x, the residual and y are all_reduce + add + rmsnorm's
bytes (its replaces chain). Exact wire only, y required; the AR rows' init, fini and tuning axes,
and the host twin every AR row derives. It takes the chained form (r4d_chain.h) at the decode
width of 1024 threads, as the rotated int8 form does; r4d_ar_rmsnorm_bf16 takes `chain` and the
entry passes the row's. kChained gains ar_rmsnorm_bf16; ar_rmsnorm_bf16_host stays plain.
NormBF16 (rad_norm_bf16.h) is a bf16 block's input norm that can take the previous block's
delta: ar_rmsnorm where the step's all-reduce goes out on the exact wire, else add + rmsnorm
after the previous block's own all-reduce, which it asks takes_ar() on the same rows before
skipping. The three bf16 blocks take fold, add_out, ar_in and ar_out, defaulting to the block as
it was (qwen3asr_bf16 and unlimitedocr_bf16 are unchanged). qwen35_bf16 places the folds with
layer_fold() at two ranks: a tap layer and the last keep their add, for the tap and the final
norm. Not under calibration (--calib-dir), whose step issues each block's input norm ahead of the
block for the tap.
Byte-identical (ar_rmsnorm's replaces chain). Measured on 1.x, unchained: on the bf16 container
KL against the reference rows stays 0 and the greedy output and acceptance are unchanged; 55.33
-> 54.75 ms a step. Measured on radiance 2.1.0 with the rest of this series (the weight reads in
front of each all-reduce among it): Qwen3.8-27B bf16 + DFlash2 at depth 7, TP2 on two R9700s
(210 W), one stream, seven greedy prompts, three interleaved server starts an arm, ms a step:
no fold: all_reduce + add + rmsnorm, chained 49.16
ar_rmsnorm_bf16 plain 50.57
ar_rmsnorm_bf16 chained 48.55
Every text byte-identical. Plain, ar_rmsnorm waits for the lane-0 read in front of it. One change
outside this series: a new stream takes the longest-kept spare queue rather than the newest
(#478; 2.2.0's fix makes the same pick).
r4d_selftest names ar_rmsnorm_bf16 among the two-rank fusions it cannot run (no peer rank); its
norm half is rmsnorm_quant_fp8's device function, checked there. OPS.md lists the op; KERNELS.md
lists the row and its host twin as not reached, by hand until the report is regenerated.
arch_test: the two-rank program, the issued ops with and without drafter taps, the lossy-wire
fallback, and no ar_rmsnorm declared under calibration.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
qwen35_fp8 declares DFlash2 and qwen35_bf16 did not, so the checkpoint's own bf16 could only run
without speculation. Its blocks already serve verify steps (rad_block_gdn.h keeps an anchor state
when speculating), so this adds the wiring qwen35_fp8 has:
- the taps: `dflash_src` and a `cast` after each layer dflash_config.target_layer_ids names;
- declare_dflash2, qwen35_fp8's copied (each plugin keeps its own, as gemma3's does), with its
code planes typed by Dflash2::probe_i8, rescoring the drafter's candidates against the head;
- the draft-pass dispatch in step(), and a probe answering DFlash2's trained depth, at which
rad-convert declares, so the container carries the drafter;
- `draft-coupling: on`: the drafter declares mtp_couple_draws and mtp_couple_state and sets Q's
temperature to 0.6, as qwen35_fp8 does (cb0abe9, ce79b12); rad_block_dflash2.h then declares
dflash_couple_propose after the selector, and the engine and sampler couple the target's draw
to it. A geometry past the walk's limits is refused with qwen35_fp8's note. Key off: no op, no
plane.
libr4d: logit_rerank read only the int8 and IQR heads, whose rows carry their scales in the tail,
so a drafter beside a bf16 head would propose from its 2-bit head's own scores. logit_rerank_bf16
is the same kernel reading a plain [n_vocab][n_embd] bf16 row (BF): a lane owns a strided subset
of columns and the fold is the wave sum, with nothing to scale. It declares no layout hook, so it
takes only a single-plane weight: a bf16 head, never an int8 or IQR one, which keep their rows.
Its form is plain; the row is not among the chained ones. The coupled walk reads the cand/unary
planes it fills.
data/recipes/q38-27b-bf16-df2.recipe: only the drafter's weights have rules (MXFP4 linears and
the 2-bit draft head, as q38-27b-w8a8-df2.recipe makes them), so the trunk, the embedding and the
lm_head keep the checkpoint's bf16. No --set: the container states no quantisation and
qwen35_bf16 serves it. As converted on 1.x: 1101 weights, 32 quantised, 52.50 GiB.
Without a drafter, or without speculation, the declared graph is unchanged. The coupling, measured
on 1.15.1 on the bf16x12 container (the same weights packed losslessly, a later commit;
Qwen3.8-27B + DFlash2, TP2 on 2x R9700, 7 prompts, 512 tokens each):
- off: greedy text byte-identical to the build before it;
- on, greedy: text byte-identical; 3.812 tokens a step either way;
- on, temperature 1, top-k 20, top-p 0.95, seed 1: no emitted token outside the top-p cut;
tokens a step 3.242 -> 3.597 (+10.9%), decode 69.0 -> 76.3 tok/s.
arch_test: the drafter beside a trunk whose ops equal the no-drafter declaration's, the tap copies
aside; the steps lint clean at one and two ranks; the probe; the drafter declares the rerank.
r4d_selftest: logit_rerank_bf16 against a host dot product over the same bf16 values, at one rank,
as the second of two (global ids and the pair plane the merge reads) and at K = 2504; the int8
rows' check unchanged. recipe_test: the recipe parses to 8 rules that match the drafter's weights
and nothing of the trunk, the embedding or the head.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The ceiling is the only thing that moves: kMaxVideoRows stays 32,640, so the row
budget still bounds by size (1920x1088 keeps 121 frames / 5.04 s). The activation
arena is sized from the declared maximum, so the wider ceiling is reserved for
every deployment whether or not it ever asks for a long video: 9.21 GiB at 20
chunks, 9.88 GiB at 40.
Block FP8 is retired. A vision linear is BF16, or int8 with a bf16 scale per
(row, 128 of K), read by gemm_i8a8_row. That tile is the prefill GEMM over
row-major codes and scales, selected by w_rb 1, so a tower placed in RAM is
read in place and a text linear is unchanged. Bias, exact-erf GELU and the
residual stay separate BF16 ops. The patch stem, position table, norms and
biases stay BF16.
At decode an expert's run is a row or a few, so the (run tile, column group)
WMMA form stages a 16-row tile for one live row. With every run at most four
rows (T <= 4 top_k) and two classes, w4nl64a8i8h now takes a GEMV: a block of
eight waves per (128 columns, first row of a run), a wave a 16-column tile,
the w4nl levels made f16 by byte permute and dotted by v_dot2_f32_f16, the
sums halved across lanes and folded as the WMMA form folds. Chained form as
the decode band's other launches. Pins other than the rule keep the old forms.
Qwen3.8-Flash-Next IQR-V4 on a Radeon 8060S (gfx1151):
down, one token, 10 experts of layer 0, cold: 60.4 -> 48.9 us
MTP0 decode: 32.7 -> 33.1 tok/s
MTP3 essay / code: 55.1 / 68.1 -> 58.7 / 71.2 tok/s
MTP3 edit (python / cpp): 76.2 / 76.0 -> 80.2 / 80.5 tok/s
Each scale group's sum is exact; one output of 23 040 in that layer differs
from the WMMA form by one bf16 ulp.
3deabdae appended an optional `split` operand to moe_gemm_q (ten operands), but the three
hand-built r3d_selftest cases (moe_gemm_q_e4m3, moe_gemm_mxfp4a8, moe_gemm_w4a8) still
refused any schema that is not nine operands, so they failed before launching. They now
expect ten and describe `split` absent; the libr3d rows only carry it (r3d_moe_call
reads the first nine). On a W7900 (gfx1100): 120 clean / 3 failed -> 123 clean / 0 failed.
Fixes#553
The three module kinds a runtime adapter targets (attn_output, ssm_out,
ffn_down_shexp) are declared, when stored rotated int8, as a plain bf16
GEMM over a kernel-relaid view of their planes. The lora_plain kernel
relayouts FWHT_128(codes*scale) to the plain basis at load, so core LoRA
(op_is_site, issue #475) injects shrink/expand around a plain GEMM.
Sources in scopes core never targets (mtp/draft, vision, audio) keep the
stock fused i8a8h declaration byte-identical.
With the lora_plain kernel (merged in #479) a clean clone now serves
runtime adapters with no out-of-tree plugin.
A process that cannot make an io_uring ring (Docker default seccomp,
kernel.io_uring_disabled, a kernel without the ring flags) refused the
n-gram kernel at declare and the model could not start: only
--security-opt seccomp=unconfined served Qwen3.8-Flash-Next.
When the ring is refused, every table read now runs as pread(): a
positional read on a read-only file, safe from every thread, with the
same spans, the same cache publish, and the same urgent-read priority.
The reads are slower: one round trip each. The engine starts, serves,
and says once in the log what was refused and what it fell back to.
The ring path is unchanged for processes that have it.
The Models table gains GLM-5.3-Flash's IQR-V4 container and its download, the keys table its
row (server.kernels puts glm first), and it leaves the list of models this version does not
serve. tp4.radiance.yaml carries the settings the measured image served with.
The device sources include libr4d's RDNA4 headers, so like libr4d the
plugin now narrows its GPU targets to gfx12 with rad_plugin_gpu_targets
and builds the host rows alone when none is left, instead of compiling
the device code for every target of a mixed build. glm5next_test loads
glm.so, so it depends on it when both are configured. The export
block's opening comment named only glm5next's own op.
ops_doc holds OPS.md to the schemas the loaded plugins dump; it now
loads glm.so when built, and the fused clamped SwiGLU with the rotated
int8 quantiser has its row and its contract. The i8 latent mla_attn
note said no device row served it; plugin/glm's do.
The plugin's schema stays declared where its gfx12 device rows are left
out, and GateQuantFP8 asks rad_op_declared before it issues
swiglu_clamped_had_quant_i8g, so on such a card a model would pick the
fused form and fail at startup with the op unserved. rad_plugin_open
now reads the KFD topology as libr4d's does (2.2.0) and declines when a
card is listed and none is gfx12; a machine with no card listed keeps
the plugin for rad-convert and the host tests. The check takes the
topology directory, and a glm5next_test case runs it on fake trees.
glm.h and the plugin info named one op; they now name the int8-cache
mla_attn rows too.
Upstream gave moe_gemm_q an optional trailing `split` (3deabdae) and issues it
only on a checkpoint-cut step, leaving it off otherwise, which
core/runtime/issue.cpp admits for trailing optional operands. The schema count
check now accepts from the required count up to the schema's, as the core
does. The loaded schemas include plugin/glm's (when built), so the fused
clamped SwiGLU op glm5next issues is covered rather than reported missing.
GUIDE: GLM serves kv-cache-dtype i8 through plugin/glm's reader, which needs
server.kernels: glm,libr4d,libavx,libref in that order; fp8 stays GLM's alone.
ARCHITECTURES: the 2.x container from the FP8 release (data/recipes/
glm53-iqr-v4.recipe), the width split for IQR experts, what stays wide, MTP
and the MLA row form not served on an IQ8R trunk. plugin/glm/README: the
plugin's rows, load order, tests and the measured KL and BetterBench tables.
Drafted by openai-porter.
declare accepts i8 beside bf16 and fp8; the latent group takes the ordinary
int8 row at head_dim 256 and every MLA store and attention names it. The index
tail, the DSA index and the KDA caches keep their dtypes. The device reader is
plugin/glm's; without it selection reaches only libref's host row, which
serving refuses.
glm53_v2_kv_cache_dtype_narrows_the_latent_group_only: default, bf16, fp8 and
i8 at TP1/4/8, first and last rank, 11 stores and 11 attentions a rank; f16
refused.
The ordinary i8 cache row at head_dim 256 is 516 bytes: 512 codes and an f16
scale for each 256-wide half. The matrix form (libr4d's unpaired
attend_matrix, which the head form serves at four ranks and fewer) keeps the
raw codes in its tile, exact as bf16, and applies the two half scales outside
the products: two QK dots, each times its half's scale; the value product
takes p * scale per half as its high/low operand; the maximum and the
denominator stay on the unscaled probabilities. Eight heads, or
RADIANCE_GLM_MLA_WAVE, take the wave form (libr4d's attend with an f32
dequantising load). One row for mla_attn constrained to kv_dtype i8; libr4d's
bf16 rows state no kv_dtype, so the plugin must come first in server.kernels.
glm_device_test: both forms against libref's host reader at 1-63 rows, 1/8/16/
64 heads, up to 600 blocks (split and merge), missing pages, empty and
all-absent rows, zero-scale halves; outputs poisoned, nonfinite values fail,
blank rows must be exact zeros. Worst error 0.23% of peak on gfx1201.
plugin_test: the real plugins' selection in both hierarchy orders (drafted by
openai-porter).
GateQuantFP8's clamped path issues swiglu_clamped_had_quant_i8g at the
consumer's group when a loaded library declares it (plugin/glm), as it already
issues swiglu_clamped_quant_fp8 for E4M3 codes; otherwise the pair as before.
Only architectures that set fuse_clamped (GLM) take it.
Served at TP4 with the plugin: 87 op bands resolve to it, coherent 20/20.
A kernel plugin beside libr4d for ops only glm5next issues. Its first op,
swiglu_clamped_had_quant_i8g, is swiglu_clamped then had_quant_act_i8g (or
had_quant_act_iq8r at group 256) in one launch: libr4d's gated quantiser body
with the clamped expression, its Hadamard and int8 helpers included by path.
The op name is new, so loading the plugin changes no other model's selection.
A device row and its host reference row. tests/glm_device_test holds the device
row to libr4d's chain byte for byte (codes, scales, bf16 product) at an
expert's TP4/TP8 slice and the dense TP4 slice, 1 to 16384 rows; the host row
matched every code (0 of 7.0M).
Whole IQR experts (expert parallelism) left the ranks waiting on the busiest
one in every all_reduce: at TP4 a decode step spent 10.4 ms there against 2.5
ms split by width, with the expert and trunk GEMMs unchanged. An IQR expert is
one f32 scale a row and K in whole 128-wide units, so a rank's 512 columns of
down are four units and its gate/up rows whole rows.
BetterBench TP4: decode 29.4 -> 45.7 tok/s, 4 streams 42.8 -> 58.9, prefill
128k 1569 -> 1656; coherence 20/20 and needle 10/10 both ways.
The routed experts as IQR-V4's computed trellis, the dense, shared and MLA
FP8 linears IQ8R, and everything the release keeps wide as it is stored.
Round to nearest: no calibration data is read. Converted with --max-spec 0
while the plugin does not serve the draft layer on an IQ8R trunk.
rad-convert --plan-only over the release: 25544 weights, 24326 quantised,
1218 kept, 158.84 GiB.
Test: the recipe's first match for every canonical GLM name, the MTP layer's
draft scopes included.
An i8 latent row is the int8 KV layout at head_dim 256: two halves of 256
signed codes, then their two f16 scales (516 bytes). libref and libavx
decode channel c as code[c] times the scale of its half, in both the scores
and the values, without rounding the decoded value to bf16. A missing scale
plane, an odd latent dimension or rows that overlap are refused before any
output is written. No device reader and no plugin change: glm5next still
refuses an i8 latent cache.
Tests: analytical reference cases (both halves in QK and PV, a cache
written by the i8 kv_store, the refusals, the shape) and 35 hand-built
libref-against-libavx cases.
Each rank at four and eight declares its own window of whole IQR experts
(base, probed expert, tables, no width spans). A protected bf16 pair at the
start of rank 1's window is declared whole at the expert's width, with the
sort's protect list in rank-local places and 70 regular experts in two
parity tables; a single protected expert, and an expert with one bf16 and one
IQR projection, are refused. Both cases also check that no declared weight is
mapped twice.
The MoE helper takes a protected expert's whole width from Geom::n_ff_all,
which the model sets to the dense feed-forward's 12288. Where the experts
are declared as a width slice (one card), a protected pair was declared six
times too wide. The MoE layer now declares with n_ff_all at the expert's
2048. Whole experts (two cards and up) never took that path.
Test: a protected pair among IQR experts on one card.
The sizing-declare parity, the replicated latent and index caches, and the
schema operand counts run again over an IQ8R trunk with IQR experts, at
max_spec 0 and in the head form; their assertions are unchanged. The 2.x
encodings and metadata move to their own section ahead of the blocks.
The draft layer's IQ8R and IQR wiring has no coverage yet, so an IQ8R trunk
with num-speculative-tokens above 0 is refused by name, pointing at serving
with 0 and converting with --max-spec 0.
Layer 0's dense gate_up says whether the trunk is IQ8R (rotated int8, one scale
a 256 of K). If it is, every activation a trunk linear reads carries rotated
int8 codes at the trunk's group: the norms' pairs (written by
rmsnorm_had_quant_i8g where it is served, else by each linear from the bf16
plane), the MLA's expanded output, and the dense and shared clamped products.
The routed arm's gated product is rotated int8 at one scale a 128, with a
rotated copy of the block input where the norm does not write the codes.
KDA, the indexer, the router and the MLA's kv_b keep their declarations.
Experts that are not rotated int8 beside an IQ8R trunk, rotated int8 experts
beside any other trunk, and the MLA row form on an IQ8R trunk are refused by
name.
Tests: the declaration at 1, 2, 4 and 8 ranks with and without norm-written
codes, a linted mixed step, and the refusals.
Each routed layer's source and config is built by moe_source() and probed once
in declare(), ahead of the buffers, and kept on the model for the layer's
declare. The routed arm's code pair can then follow the expert format. The
draft layer is still probed where it is declared. No change to the graph's ops
or buffers.
New models. LiquidAI's LFM3 by DokterSmol (#449): `arch/lfm3_bf16`, bf16, int8 and IQ8R trunks,
with the windowed attention it needs on libr4d and libhalo. Ling-3.0-flash on an IQ8R trunk by
keptn42 (#474), its clamped SwiGLU layers writing rotated int8 codes. NVIDIA-Nemotron-3.5-Bolt-74B-A9B
on an int8 trunk by keptn42 (#389), with the LiLiCorr drafter. Gemma 4 26B-A4B's vision tower by
kaczy44 (#522), and `rad-convert --add-vision` to add a tower to an existing container (#523). Muse
Glimmer as IQ4R-V4 with a quantised DFlash2 drafter, W6NL routed experts beside W5NL, the calibrated
U5 gate recipe, and Qwen3.8-27B's native MTP draft head (tools/vhead.py) by gostar (#466, #468,
#493, #536).
Speed. Qwen3.8-Flash-Next IQR-V4 at tp 2 on two R9700 decodes a step in 11.2 ms at one stream (12.4
in 2.1.0), 15.0 at two (16.8) and 21.4 at four (23.2), by Code000's series (#485-#519, #544-#546):
chained launches without the packet processor's acquire where the kernels acquire for themselves,
the host data path flushed before every doorbell and the scalar cache emptied behind a chained wait,
a register form of the fused all-reduce writes, QSA's score and select skipped where nothing reads
them, a lossless coded wire for large two-rank all-reduces, hc_read's 48-row decode tile and its
prefill up product, a packed MoE prefill map, and a single routed pass over a spanned prefill; and
hc_read's decode forms restored for ROCm 7.2 by mici81 (#472). Cold prefill is 2-3% faster than in
the previous build.
Speculative decoding, all opt-in: block and traversal verification of the coupled MTP chain
(`draft-verify`), a chain that stops inside the step (`draft-depth: adaptive`) and its load-aware
rule (`draft-depth-load`), and SuffixDecoding as a step selector (`draft-suffix`), by Code000
(#500-#502, #514).
Fleets. `models.NAME.cards` places a model on chosen cards (#458), `memory.card-headroom-mib` gives
one card its own reserve (#460), and a served LoRA adapter is listed as its model's child in
/admin/fleet. Runtime LoRA on a rotated int8 trunk by dowjames (#479; the `plugin/lora_plain`
library is built by hand). A control-vector variant, `MODEL:NAME`, by keptn42 (#461).
`prefill-room-gate: on` admits a prompt only when the whole of it fits, by baKon (#548, #550).
Deployment pixel and reference limits for Qwen-Image 2.1, Krea 2 and MiniMax-H3, video jobs held
through a model's drain, and fleet host room reserved atomically, by rkcth (#508-#533).
Fixed. MiniMax-H3's reference and keyframe encoder crash (#456, by farcryjohn, #482). A second
compute lane on a kept queue slowing decode by half (#478, diagnosed by eddie168 and keptn42): kept
queues are handed out oldest first. The expert prefetch stream's argument ring (#491, #494). The
build break of #503 (reported by DokterSmol). A tool-call delimiter that ended the turn, by Itoash
(#476). Gemma 4's sliding-window attention, by jintakhan (#446). The dashboard behind a reverse proxy
at a relative path, by forestjohnson (#492). Hardening from fl0l0u's security review of 2.0 and 2.1
(#464, #465). A failed declare names where it stopped and the op forms no loaded library serves
(#462, #471, #473); the guide has a section on moving a 1.x deployment (#463).
Plugin ABI 43: out-of-tree plugins need to be rebuilt.
Thanks to @DokterSmol, @keptn42, @kaczy44, @gostar, @Code000, @mici81, @dowjames, @baKon, @rkcth,
@farcryjohn, @Itoash, @jintakhan, @forestjohnson, @fl0l0u, @davetha and @eddie168.
The shared expert's slice was cut in 128-column blocks. Its down projection reads that slice
along K, and an IQ8R trunk keeps one scale per 256 columns there. Bolt's 5376 is 42 blocks of 128
but 21 groups of 256: two ranks held 2688 columns each, 10.5 groups, and the down projection was
refused ("an int8 weight takes rows in 16s and K in whole 256-column scale groups"). At four ranks
slice_of's blocks gave ranks 0 and 1 1408 columns, also not whole groups.
The slice is now cut in the trunk's own scale group, asked after the trunk probe: 128 for block
fp8 and 128-group int8 as before, 256 for IQ8R, so two ranks hold 11 and 10 groups and four hold
6, 5, 5 and 5. A shared expert that is not whole groups is refused by name.
an_iq8r_trunk_slices_the_shared_expert_in_whole_256_column_groups declares every rank at one, two
and four with IQ8R trunk linears, rotated int8 experts and drafter, checks each slice is whole
groups and the slices cover 5376 once, and steps both ranks of two lint-clean with the drafter.
It fails without the change. nemotronh_test: 18 of 18 pass.
Three cases were skipped while the trunk moved to int8 ("the case returns with an int8
container"). With the 2.0 encodings and the int8 backbone they declare and step again:
lilicorr_replicates_its_two_kv_heads_at_four_ranks,
nemotronh_tp4_steps_lint_clean_with_the_lilicorr_drafter and
nemotronh_sizing_declares_match_the_real_graph_at_every_arena_level.
nemotronh_test: 17 of 17 pass, none skipped. Without the backbone change these three and
a_rotated_int8_lilicorr_backbone_reads_int8_codes fail.
radiance 2.0 serves no block fp8, so a 2.0 container stores the drafter's backbone the way the
DFlash2 recipes do: rotated int8 with a bf16 scale per (row, 128 of K). declare_lilicorr declared
the backbone's activation pairs as E4M3, and declare refused such a container: "'dflash.fc' is a
rotated int8 weight, which reads an int8 activation; this block quantises its activations to E4M3".
declare_lilicorr now asks Dflash2::probe_i8 first, as gemma4_bf16 does, and declares the pairs
int8 at the probed group when fc is rotated int8, E4M3 at 128 otherwise. A width that is not a
whole number of groups is refused by name.
The Bolt test encodings move to the 2.0 recipe's forms: the drafter rotated int8 at 128, the trunk
int8 at 128, the experts w4nl64. a_rotated_int8_lilicorr_backbone_reads_int8_codes checks at one,
two and four ranks that the five pairs are int8, that every GEMM over a dflash weight runs at
i8a8h, and that no E4M3 quantiser writes a drafter buffer.
Nemotron-3.5-Bolt-74B-A9B w4a8 converted with it (int8 trunk, rotated int8 backbone, the experts
of the 1.x file reused), one R9700, expert_tiered, bf16 KV, against the bf16 HF reference on the
80 MT-Bench questions, 41,586 tokens: KL mean 0.00390, p99 0.0459, top-1 98.17 % (the 1.x file
with a block fp8 trunk and backbone: 0.00503, 0.0602, 97.9 %).
With an int8 trunk each block linear reads the int8 pair and quantises its input itself, but the
attention's out quantiser and the shared expert's relu^2 product still wrote E4M3 codes, lat_in did
so for rotated experts, which read their own rotated copy, and attn_out, ssm_out and shared_ff
declared E4M3 planes: no op read any of it. A step of Bolt's nine-block cut issued 9 quant_act_fp8.
AttnFP8 declares its out quantiser only where the activation carries a code pair its producer
writes, so an IQ8R trunk keeps the one that writes its rotated int8 codes, and llama_fp8 and dspark
are unchanged. The shared expert writes the relu^2 product alone where its down projection reads
the bf16 plane (GateQuantFP8::silu_only), lat_in runs only for experts that read E4M3 codes, and
the three activations declare no E4M3 pair on an int8 trunk. Not changed: the block norms still
write E4M3 codes (NormQuantFP8 has no unrotated int8 form), and the latent keeps its E4M3 plane,
unwritten, because MoeFP8 checks that its prepared input carries codes.
nemotronh_test: an_int8_trunk_quantises_nothing_to_e4m3_that_no_op_reads (Bolt's cut at one, two and
four ranks) fails without the change (9 quant_act_fp8 a step) and passes with it.
radiance 2.0 has no rotated E4M3 quantiser (had_quant_act_fp8), so the w4nl64 experts are served at
w4nl64a8i8h. For rotated experts the plugin declares the routed arm's two activations as rotated
int8 pairs with a scale per 128: the block input's rotated copy and the relu^2 product. Both are
written by had_quant_act_i8g.
When GateQuantFP8's relu^2 branch was fed int8, it wrote unrotated codes (quant_act_i8g). Fed
rotated int8, it now uses had_quant_act_i8g at the pair's group. Nemotron-H is the only user of
this branch.
A test checks the routed arm of Bolt's nine-block cut at one, two and four ranks: eight
had_quant_act_i8g, no had_quant_act_fp8, and every grouped GEMM at w4nl64a8i8h.
radiance 2.0 does not serve block fp8, so a quantised Nemotron-H trunk needs another form. The
plugin probes the first Mamba block's out projection before it declares the activations. When that
weight is int8 (i8 codes with a bf16 scale per [1 x 128], or IQ8R's 256), every activation a trunk
linear reads declares the int8 pair too: the normed hidden state, the gated norm's output, the
attention output, the latent and the shared expert's product. Each int8 linear quantises its own
input from the bf16 plane (quant_act_i8g). The routed experts keep their own path. A bf16 trunk
declares as before.
A new test checks that Bolt's nine-block cut, with int8 block linears and w4nl64 experts, runs its
block linears at i8a8 at one, two and four ranks, each behind its own quantiser, with no block-fp8
GEMM left.
The gate serialises long prompts: the next prompt must fit its whole prompt beside the runner whole prompt. Off is the old chunk-only admission; on is opt-in.
(cherry picked from commit cbeeda3c2219b94452ee4094445e48b46de6750c)
On Gemma 4, a picture whose placeholders start after the first prefill chunk was not read. The
plugin attends a run's rows a second time, both ways, only on its sliding layers: over the window
group's block table and the keys before RadBatch::bidi_used. The build staged bidi_used as the
absolute end of the run. After each chunk, trim_window recycles the window group's blocks below the
window, its table then starts at first_block_pos, and build_groups counts that group's seqused from
there. bidi_used did not, so the run's rows read keys first_block_pos positions too far, past the
keys the pass wrote. Gemma 4 31B at tp 2 (16-token blocks, 1024-token window, 2048-token chunks):
a picture in the first chunk was read, one from token 2150 came back as invented text, and one
from token 3900 as no picture at all.
BatchBuilder now keeps the trunk's window group (RAD_KV_WINDOW, not a drafter's) and subtracts its
first_block_pos for the sequence from the bidi_used of each run it stages, the same value
build_groups uses for that group's seqused. Without a window group, and before the window
recycles, the value is 0 and nothing changes. The ABI text of bidi_used now says how it counts; the
layout is unchanged.
sched_test: a_run_in_a_later_chunk_counts_its_keys_from_the_recycled_window (a full and a 64-token
window group, the picture at tokens 200..299 in the second chunk, the window recycled below 128):
bidi_used 300 on v2.1.0 (fails), 172 with this change (passes), equal to the window group's seqused
less the rows past the run. ctest -LE 'gpu|oot' on a host build without ROCm: 135 of 135 pass
(3 skipped), the same as on v2.1.0. On the Gemma 4 31B setup above, a picture after 800 to 90,000
tokens of text is now read at every length.
Fixes#547.
Admission reserved only the first chunk, so a long prompt could fill the
pool and be preempted back to zero at its first decode step. A fresh
prefill now starts only when its whole prompt plus one decode position
fits beside every runner (--prefill-room-gate, on by default).
A refusal on an empty engine used to return kAdmitWait. Nothing was
running, so the next step never freed a block and the queue stayed
Waiting with the GPU idle. Drop the kept hit once; if the prompt still
cannot start, fail that request and ask the next.
Under --prefix-resume nearest, tail_checkpoint drops a prompt's tail
snapshot when its last quantum boundary lies less than a quarter interval
(512 tokens at interval 2048) past the interval boundary below it. The
floor exists because the snapshot cuts the last chunk, and the cut leaves
the last tokens a step of their own. A prefill alone in its spanned step on
a plugin that snapshots inside a step (set_ckpt_inside, the default on
Flash-Next since 64bf299e) cuts nothing, but the same floor applied: such a
prompt kept its snapshot at the interval boundary and the next turn
re-prefilled up to a quarter interval (a 39097-token prompt resumed at 38912
instead of 39040).
tail_checkpoint takes `in_step`, which plan_chunk passes for that branch:
the tail is then the last quantum boundary wherever it lies past the first
interval (one on an interval boundary is that boundary's snapshot, as
before). Cut schedules, shared steps and --prefix-resume exact are
unchanged.
Flash-Next IQR-V4, TP2, live config, 10 code sessions of 6-39K tokens with
two follow-ups each (20 follow-ups): tokens the follow-ups re-prefilled
behind the previous prompt 1745 -> 722 (worst 495 -> 63); the three
follow-ups it moved: 527 -> 271, 584 -> 264, 726 -> 278 tokens, TTFT
200/144/160 -> 111/102/102 ms. Greedy check over 12 code prompts: where
the snapshot did not move (8), turn 1 and the cached follow-up are
bit-identical to 7b62092a; where it moved (4), the split of the last chunk
moves with it and both differ at tie level, the follow-up no farther from a
cold no-cache run than before.
sched_test: a case at interval 1024 for the in-step positions, the step
sequence of a 2200-token prompt (1024, then 1176 with the snapshot at
2176), and the cut and shared schedules keeping 2048.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A span was taken only by a single running request (or a single request in
an empty engine). Two to four prompts prefilling at once with nobody
decoding therefore ran every step at the shared budget (2048 tokens under
max-num-batched-tokens 8192, prefill-span 4), split between them in
unspanned chunks: about 6.5K tok/s against 8-10K tok/s for a spanned step.
Now a step is spanned whenever every running request still has prompt left
and no admission is possible. The one with the fewest prompt tokens left
takes the step alone (shortest remaining first); the others sit it out and
take no share reserve of it, so the step is planned exactly as a lone
prefill's. The running loop stops after that entry, which keeps the
RadBuildCtx::max_mixed_tok contract (a step wider than shared_tok is one
sequence). As soon as anyone decodes, or a request can be admitted, steps
are shared as before.
Spanned steps are several times as long as shared ones, and a request that
arrives while one runs waits for it. A conversation's next turn arrives a
few milliseconds after its previous reply finished, just after the next
step was planned: with the remaining prefills now spanned, follow-ups beside
them waited up to a whole spanned step (pfx4 mix: 0.68 -> 0.86 s mean
follow-up TTFT). So the one step after a request finished while others still
run (finished_beside_) is planned at the shared budget; the follow-up waits
for that step and is admitted in the next. This also covers the existing
case of one prefill left alone by a finished request.
Flash-Next IQR-V4, TP2, live config, code prompts, installed 7b62092a
against this, 2 runs each (mean TTFT, s):
4x16K concurrent 8.77 -> 6.30 (last 11.15 -> 9.96)
2x16K concurrent 4.50 -> 3.42
single 16K 1.98 -> 1.95
pfx4 turn 0 / follow 10.07/0.68 -> 10.37/0.48
pfx2 turn 0 / follow 8.35/0.36 -> 6.55/0.30
pfx4b turn 0 / follow 10.31/0.63 -> 9.93/0.46
pfx2b turn 0 / follow 8.47/0.61 -> 6.67/0.28
sched_test: a new case for the step sequence (both admitted at the shared
budget, then the shorter alone in spanned steps up to its first token, then
shared steps beside its decode row; no wide step with more than one entry
over three prompts arriving together; one shared step after a finish beside
a prefill, then spans again). a_shared_step_under_a_span_is_planned_as_without_one
now compares the shared steps beside a decoding request, the regime that
stays shared.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
issue_body lets an issue leave out trailing optional operands (a null tensor stands for each), but
the recorded-pass hazard note still required the schema's full count and made such an issue opaque.
Since the routed MoE GEMMs gained their optional `split` operand, every decode, verify and draft
pass issues them one operand short, so both went opaque and ordered their neighbours behind them
(the shared-expert arm no longer ran beside gate_up). The note now accepts any count between the
last required operand and the schema's; the absent operands were already skipped.
Flash-Next IQR-V4, TP2, MTP 5 + coupling + traversal + adaptive depth: the 4-row main pass goes
from 253 to 353 of 1044 dispatches unordered (each draft-head pass +1), decode +1.6..+2.0 % on six
400-token code prompts (T 0 and T 1), output byte-identical. Host suites green.
Fixes a decode regression introduced by #519 (reported in its review).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use a history-only declaration at depth zero. Do not load the U2 projection, reserve proposal rows or advance a draft chain. Reject an MTP-only calibration request from KL recording instead of completing without its Gram.
Front::resolve already answers base:adapter on every route, but history_loop
sampled per-model series only under real model names, so a child listed by
status() had no series and its charts said No data yet while the parent served.
Sample the child under its own name with the parent body: same tokens, queue and
seconds, because the parent is what serves them.
The fleet view knew nothing about adapters, so the built-in dashboard showed only
the base model while /v1/models answered the adapter too. Fleet::status() now
appends one child entry per loaded adapter of each resident model -- id
base:adapter, parent set, adapter true -- taking state and counters from the
parent, because the parent is what serves it. Adapters own no cards and no bytes.
A lone spanned prefill now runs to the prompt's end and takes the prefix-resume snapshot mid-step
at the same position, instead of ending its last chunk at the snapshot and running the last few
dozen tokens as a step of their own (on Flash-Next that step reads nearly every routed expert for
those rows). Every stateful part (delta-net recurrence + conv slot, QSA key ring, PLE windows)
computes the rows before and after the cut as two pieces, each what a chunk of those rows
computes; rad_ckpt_snap copies each layer's state to a stage on the card between them (57.1 MiB a
rank on Flash-Next at TP2, carved from the KV pool only where prefill-span > 1 and the prefix cache
is on), then one contiguous copy goes to the host slot. The connection reads and the routed
passes restart at the cut, and moe_gemm_q gains an optional `split` operand so a step-wide routed
pass gives each expert's rows before the cut a run of their own (the 1-2-row dot-path remainder
depends on the run length). ABI 43: RadBatch::ckpt_cut/ckpt_cu (appended), RadArchProbe::
ckpt_snap_ok (in the tail padding). Snapshots and follow-up turns are bit-identical to the cut
schedule's (24 checkpoints of 9 prompts, 3.9-30.6K tokens; resumed turns identical). TTFT of 11
documentation prompts (4.3-21K tokens, span 4 at 8192, span-first on): -22.8%..+2.4% a prompt,
-2.3% in total; BetterBench filler (narrow routing, a cheap tail step) -0.5%; decode unchanged.
Off: RADIANCE_CKPT_INSIDE=0 (keeps the cut) / RADIANCE_CKPT_STAGE=0 (no stage either);
RADIANCE_CKPT_HASH=1 logs a digest of every snapshot for byte comparisons.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prefill-span-first on: a spanned prefill may start at the prompt's first token (the first
interval's rows read the QSA selection instead of the dense path; below the exact bound the same
keys, summed differently: deterministic, not bit-identical). Real-text prompts: 6.7K 1002 -> 857 ms,
14K 2137 -> 1905 ms, 24K -2.7%. prefill-tail-snapshot off: the last chunk runs to the prompt's end
instead of cutting a separate tail-snapshot step at the last 64-token / interval boundary (that
step touches nearly all experts: 66 ms for 51 rows); loses the follow-up-turn snapshot (turn B on a
16K prefix 49 -> 781 ms), so meant for single-shot loads only. Defaults leave the schedule and
outputs byte-identical. With span 8192 + both: BetterBench prefill ~7500-7670 tok/s from 8K tokens
(prefix cache on); decode within +-1-3%.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The coded write (and its gather form) at two ranks pushes its whole range, then folds it: the
link's time plus the card memory's time. The staged form cuts each block's range into S parts
with their own handshake (flag, sequence counter, push-check word) and folds part j - 1 while
part j crosses the link, so the two phases overlap. The arithmetic, the coded words and the fold
order of every value are the coded kernel's: y and h are the same bytes.
Rule (from sweeps on 2x R9700): the write S = 8 from 4 MiB, the gather form S = 6 from 6 MiB;
decode and verify messages stay far below. R4D_AR_CODED_STAGES / R4D_AR_CODED_STAGES_G set the
parts (0: the single-phase coded kernel), R4D_AR_CODED_STAGES_MIN_KB / _G_MIN_KB the floors.
r4d_ar_coded_stages_pin is the test hook; the coded-form selftest gains three arms (single-phase
pinned, 3 parts, 16 parts) compared byte for byte with the plain kernels.
8192 rows of 2560: write 2017 -> 1623 us, gather 2231 -> 1978 us.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prefill-span-pass: piece|step (default piece) and prefill-span-min: auto|N (both need prefill-span
> 1): with step, qwen4exp_fp8 runs the routed MoE of a spanned step in one pass instead of
2048-row pieces (serial step at TP1/TP2; declined with a startup note when pipelined at TP>=3 and
in calibration). New RadBuildCtx::span_pass_step appended past the struct's end (200 -> 208 bytes, so
RAD_ABI_VERSION is 42: rebuild all plugins). Defaults leave the schedule and
the output unchanged. Not bit-identical to 2048-row passes (a run of one or two rows takes the
grouped trellis GEMM's dot path, a longer one its tiles), deterministic. Measured BetterBench
prefill with max-num-batched-tokens 4096, prefill-span 2, step, span-min 0: +1.4% (1.6K) .. +6.7%
(47K) without prefix cache; costs: arena 621 MiB -> 1.17 GiB a rank, KV pool 4.58 -> 4.02 GiB a
card, no checkpoints inside a span.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moe_gemm_iqr: from 32 routed rows an expert on average, a packed run map with 128 rows an entry and
8 token tiles a trellis decode (instead of 64 rows / 4 tiles); the 1-2-row remainder modulo 64
keeps its own entry, so the dot-path entries and the per-element summation order are those of
the run map (byte-identical). moe_gemm_w4a8i8 (w4nl64, int8 activations): a 64-row block (MT 4,
WGM 2, 16 waves) instead of 32. At 4096/8192 tokens gate_up is ALU-bound on the trellis decode per
map entry, not on bandwidth. Engine stamps: gate_up -4.5..-11.2%, down -8.5..-19.3% a layer
(20480..81920 rows). BetterBench prefill +0.9..1.9% (2048 chunks), +2.5..3.4% (span 4096),
+2.1..3.6% (span 8192) from 8K tokens. Decode code paths unchanged. New byte-identity selftest
cases moe_iqr_pack_case / moe_down_mt_case; RADIANCE_MOE_IQR_MAP_TILES=4|8, RADIANCE_MOE_DOWN_MT=2|4
to cross-check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--draft-depth-load on (default off; needs --draft-depth adaptive with --draft-depth-stat top):
a step that drafts for --draft-depth-load-from sequences or more (default 5) runs round j only
for the rows whose expected accepted drafts pay their verify rows, the kernel tile they open
(past 16/32/48/64 query rows) and the round, at the measured tokens a millisecond;
--draft-depth-load-min rounds (default 2) always run. With --draft-depth-load-late on (default)
each row's verified prefix is chosen again when the next verify is issued, from the laws read
by then. Fewer drafting sequences keep the stop rule, bit for bit.
Calibration (--draft-depth-load-calib online, default): acceptance per confidence knot from the
server's own verified chains, the rate as a moving average of pure decode steps, row/round/tile
prices by ridge regression of step times, all starting from built-in tables measured on
Qwen3.8-Flash-Next at T 1.0 (or the --draft-depth-load-*-ms lists); static serves the tables as
given. Exact: within a step the rule reads draft-side laws only, the tables change between steps
from verifies that are over (mtp_rrs_test chi-square under both verifies, with tables that follow
the run, and negative controls that fail as they should).
Diagnostics: RADIANCE_DEPTH_CTL=<file> (load=0|1 late=0|1, switch the rule in a running server
for A/Bs), RADIANCE_CONC_LOG=<file> (a line a decode step), a summary line at shutdown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At a prefill chunk the sparse launch is 2048 q_len-1 rows, each gathering its
own 2051 keys from the paged cache: 4.3 GB of K and V a layer and rank, about
3 ms, 12% of a Qwen3.8-Flash-Next prefill chunk past the exactness bound. The
rows of a chunk are consecutive queries over one history and their lists
overlap (neighbours share 53-73% of their pages).
With R4D_ATTN_USEL=1 in the environment, a launch of 256 or more q_len-1 rows
(lists up to 520 pages, bf16 cache, twelve queries a KV head: the model at two
ranks) runs as tiles of eight rows over the union of their page lists
(libr4d/r4d_attn_usel.h): a builder kernel for the unions, a tiled attention
kernel that stages K and V once a tile and masks each row to its own keys, the
decode kernel itself for tiles that share too little, and the decode launch's
merge unchanged. No operand, schema or graph changes. Default off: the form is
exact to rounding, not bit for bit (scores are bit-identical, the softmax sums
the same keys in another order; about 12-13% of bf16 outputs differ by one
ulp, as accurate as the decode kernel against f64 and libref), and a served
model's greedy text can part from the decode launch's at near-ties.
Slots past a row's context end are loaded as zeros: inf or NaN behind the end
of the context poisoned a tile (new r4d_selftest case with inf/NaN there).
Chunk at 10-35K tokens, r4d_selftest --perfusel: 2.8 -> 1.5-2.0 ms. docs/QSA.md
has the design, the exactness argument and the measurements.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hc_up_mix_pf3_kernel is the up product of hc_read's PF2 prefill path with
32-wide K slices, the N operand without LDS (transposed loads) and 27 KiB of
LDS, so two workgroups fit a CU. The sigmoid quotient 1 / (1 + e^-v) is taken
with v_rcp_f32, and with the exact division where the reciprocal is within one
unit in the last place of a bf16 rounding tie, or d is 2^120 or more or a NaN;
the rule is checked
exhaustively over every float it can meet (1 + e^-v lies in [1, inf]):
0 of 1082130433 differ, and every positive NaN keeps the division's result
(r4d_hc_rcp_check, called from r4d_selftest).
Byte-identical to the decode tiles and the wide kernels at M=65..4096
(r4d_selftest hc_read_e4m3 / hc_read_bf16 compare the bytes; r4d_hc_read_pin_prefill
form 4 is the rule, 3 the PF2 kernels with the wide up product). hc_read at
M=2048: 579 -> 532 us a call. On by default wherever the rule runs the PF2
form (from 512 rows); R4D_HC_PF3=0 keeps the wide kernel as the up product, for a
comparison in a running engine.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hc_read's decode forms ran 33 to 48 rows (eight sequences at depth 3 to 5)
on the 64-row tile. What that costs is not the rows but the wave map: 4 m-tiles
x 4 n-tiles over eight waves are two 16x16 WMMA tiles a wave, so every staged K
pass is a chain of eight multiplies where the 32-row tile's is four. A 48-row
tile at 32 columns a workgroup is 3 x 2 tiles, one a wave again, on twice the
workgroups.
The K split is still counted at 64 columns (hc_down_kchunk), and there is one
row tile either way, so every element is summed in the same order: the output
is byte-identical to the 64-row tile. r4d_selftest compares the two at
M=33/40/47/48 (E4M3 and int8 codes); r4d_hc_read_pin_decode(2) keeps the 64-row
tile and (3) the 48-row tile at 64 columns, for the comparison and the timing.
r4d_selftest --perfhc at 33..48 rows: 57.7-61.1 -> 49.4-53.5 us a call (32
rows: 37.5 us, unchanged).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A routed GEMM names four to eight weight tables (a class of experts each, weights and scales),
and in a pass the stager armed for each of them changes a few entries at every issue. Each
table patched on its own: one dispatch a table, four to eight ordered launches in front of
every routed GEMM of a prefill chunk (420 a chunk on Flash-Next at two ranks). issue_body now
gathers the changed entries of all of an op's tables into one WtabPatch (Ctx::wtab_flush),
dispatched on the current stream before the op launches, and kWtabPatch goes from 24 to 40
entries (the argument block is 648 of the AQL backend's 768 bytes, within the kernel's one
64-thread workgroup): 246 dispatches a chunk. A refusal on the way (abort_step, abort_step_msg,
a table that cannot be resolved) still dispatches what was gathered, so the device arrays hold
what the host tables say. Not while recording a pass: there a refresh is host work the tape
names and replays per table.
Bit-identical: the writes and their order against every reader are the same, and no two name
one entry. New runtime_test case an_ops_weight_tables_are_patched_in_one_dispatch (5 moved
entries of two tables go out in one dispatch; more than a block's worth in ceil(n/40)); texts
identical to main's (24 of 24, greedy and sampled, prompts up to 21.7K tokens). Measured on
Flash-Next IQR-V4, TP2, 2x R9700, BetterBench prefill: +0.4 to +0.6% at 12K..47K tokens
(+0.5 to +1.5% below, noisier).
runtime_test: the repeat-mode case started its output at whatever the heap held, and a freed
arena of an earlier case held exactly the first launch's result; the output now starts at -1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ar_hc_write and ar_gather_hc_write (2 ranks, one-shot P2P) push their bf16 partials in the
4-rank two-shot's lossless coded form (shared r4d_ar_arc.h): 8-value chunks, a base exponent per
64 values, sign + 7 mantissa bits + 4-bit exponent offset = 12.125 bits/value; groups with a
subnormal, inf/nan or an exponent span over 14 go raw (0.02-0.8% in practice). New slot layout
[packed][bases][spill], 1/128 more VRAM. Used from 512 KiB a message (crossover ~280 KiB; below
it the plain and register forms stay), override R4D_AR_CODED_MIN_KB. The peer decodes the bf16
words the plain push would have carried and folds them in the same order, so y and h are the
plain kernels' bytes. Host-mailbox twins and messages that are not whole 256-value waves stay
plain.
Bit-identical: r4d_selftest compares every shape against the plain kernels in four arms (104
coded-form cases each for ar_hc_write and ar_gather_hc_write), and the server's generated texts
are identical to main's (24 of 24, greedy and sampled, prompts up to 21.7K tokens, also with
every message coded). Measured on Flash-Next IQR-V4, TP2, 2x R9700, BetterBench prefill: +2.1 to
+4.1% over 1.5K..47K tokens against main; decode (messages under the floor) unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After each commit the scheduler looks in the sequence's own prompt and output
for the latest earlier occurrence of its last --draft-suffix-min-match tokens;
the next step then verifies what followed it (up to --draft-suffix-max rows,
cut where the product of the follower frequencies falls under
--draft-suffix-min-score) in place of the head's draft. The verify window
becomes the larger of the two while the head keeps its own rounds. A sequence
whose history ended in a recurring pattern is not issued ahead, since the step
is built after the commit where the lookup can read the committed end.
It works with the fixed MTP chain, with --draft-depth adaptive and with
--draft-verify traversal. A suffix chain carries no coupled row
(Request::draft_suffix): the sampler binds none of the head's staged states to
its rows, so each row is the target's plain draw and the rows are leaves of the
traversal walk; mtp_rrs_test checks the law with a negative control that fails.
--draft-verify block is refused. The window is at most 7 rows on Flash-Next (the
delta-net fold's register window).
On Flash-Next IQR-V4 (TP2) on our branch, window 7 on chain 3 with coupling:
+1.4% overall, +2.9% on repetitive tasks, +11% on quoting, free chat unchanged;
beside adaptive depth +0.2% [-1.0, +1.5] overall, code +1.0%. Off by default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A coupled serial chain stops as soon as the product of the head's own
probabilities along it falls under --draft-depth-stop (default 0.85; top or
path statistic, at most --draft-depth-max rounds, at least --draft-depth-min),
and the next verify carries exactly the drafts made. The decision trails the
chain by --draft-depth-lag rounds (default 1), so the host's readback of one
state row and its issue of the next round hide behind the running round.
The rule reads the draft's laws and the tokens drawn before the one a decision
admits, never the target and never the admitted token, so the row-wise and the
traversal verify stay exact; mtp_rrs_test checks it by chi-square with two rules
that must fail (one reads the admitted draft's own mass, one the target).
It excludes --draft-window adaptive, which picks the next step's window from
earlier acceptance and step cost and so is a second controller on the same chain.
The recorded-pass cache holds 48 passes instead of 24: every row count is its
own pass shape and the adaptive chain makes more of them than 24 hold.
On Flash-Next IQR-V4 (TP2) on our branch, against chain 3 with coupling and
traversal: +3.0% tok/s [+1.0, +5.0] over 117 paired requests; the 48-entry cache
is +1.7% [+1.1, +2.3] of that for this mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--draft-coupling verifies each row of the chain on its own. Two lossless
sequence-level verifiers accept more drafts from the same chain: Block
Verification (arXiv 2403.10444) decides the whole chain at once, Traversal
Verification (arXiv 2505.12398) walks a path from its last draft back to its
first. --draft-verify token (default) is the engine as it was; block switches
the coupling on; traversal needs it and is refused otherwise.
Block: the sampler marks the consecutive bound rows of a request with the
block's length (RadMtpCoupleState::blk) and mtp_couple_verify decides the block
on the workgroup of its round-1 row, every FP64 sum a fixed lane tree so the
result is the host reference's bit for bit. The wide-plane serial helper is a
kernel of its own, which leaves couple_verify without scratch.
Traversal: a new op mtp_trav_verify takes the step's topology (parent row, draft
token per row) and decides a request on one workgroup, 0 bytes of scratch: the
target's law as integer masses of a fixed-point exponential, the walk in FP64.
Its header and kernel also handle nodes with several children (Gumbel-top-k and
RheoSampling siblings); the serial head here drafts one, so that part has no
producer yet and is covered by the tests only.
RadMtpCoupleState grows from 152 to 168 bytes (nkids, scheme, blk), so
RAD_ABI_VERSION is 41.
Exactness: mtp_block_test enumerates the draft tree of a toy model and runs
chi-square over the real verify code; mtp_rrs_test runs chi-square and an
exhaustive enumeration of the walk (worst |joint - P| 7e-14) with negative
controls that fail; spechub_device_test compares the device rows with the host
rows. Measured on Qwen3.8-Flash-Next IQR-V4 (TP2, MTP chain 3, coupling) on our
branch: about +1% tok/s with traversal, +4.6% at T 1.0 top_k 0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The W6NL change renamed down_w5_fp8 to down_codebook_fp8, and the Ling-3.0-flash change, merged
after it, still read the old name, so no target that includes rad_block_moe_fp8.h built. A W6NL
down projection takes the W5NL route (rotated E4M3 codes), which no clamp writes, so a clamped
layer is refused before either.
Reported by DokterSmol.
r4d_chain_wait() ends in r4d_chain_acquire(): the agent-scope fence for the
vector caches and s_dcache_inv for the scalar data cache. The latter is needed
only by a kernel that reads, behind the wait, something an earlier launch of the
chain wrote through a scalar load (a value all lanes share). s_dcache_inv also
costs the refetch of every kernel argument afterwards, on every wave.
New r4d_chain_wait_vec() waits with the fence alone. It is used at 41 wait
sites in 20 units (the IQR m16/m64, w2a8/w4a8/w8a8/bf16/i8_kpar and fp8a8
GEMMs, the activation quantisers, the attention decode and paged-window
kernels, hc_*, the norm and activation kernels of r4d_model_bf16, rowtopk,
ple_gate, prefetch, dflash_conv, the all-reduce). A wait site keeps the full
flush when any instantiation of its kernel has a scalar load after the acquire.
-DR4D_CHAIN_SCINV_ALWAYS puts the instruction behind every wait again.
tests/chain_scalar_audit.py (ctest chain_scalar_audit, label slow, no card)
keeps this honest: it compiles every chained HIP unit to gfx1201 assembly with
the flags of compile_commands.json and fails when a chained kernel without
s_dcache_inv has a scalar load, from a base other than the kernarg segment
s[0:1], behind its global_inv. Building the audit with
-DR4D_CHAIN_SURVEY_NO_SCALAR (every wait skips the flush) flags 1123 kernels,
so the check does detect the real cases; as committed it reports 0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lossless (no kernel arithmetic or operand change): the router weight is read beside the mixer
all-reduce; k/v projections before q|gate; the indexer's keys behind the attention launches within
the exact bound; verify-height prefetch at 32 workgroups (`prefetch` takes an optional `blocks`
param) and the shared down arm before the routed down from 2 rows (kVerifyRows); chain waits poll by
grid size (R4D_CHAIN_TINY/SMALL/MID); the mover's kept-free turnover slots follow the swaps the
engine asked for (MoverConfig::turnover_adaptive) instead of a fixed 640.
arch_test: new a_flash_next_decode_step_orders_its_small_launches; the pinned graph fingerprints and
step hashes of qwen4exp_fp8 move (re-pinned). place_test: the adaptive turnover. r4d_selftest: the
`blocks` param of prefetch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The expert-prefetch stream (rad_xp_stream_create, agent_only) downgraded every system-scope
acquire to agent scope because it reads no host-written data. Its kernel arguments are
host-written into its own ring, though: after a wrap, an agent-scope acquire leaves the slot's
old line in the L2 and the launch runs with the previous lap's arguments. Keep the exemption
for host writes and epochs; take the system acquire on the ring's half lap (one in 2048
prefetch launches). New device test: launches on a prefetch stream across three ring laps read
their own arguments -- 8709 of 12805 stale without the fix, 0 with it.
Fixes#491
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A chained kernel that has lost its barrier bit is launched ahead of the kernels
it depends on and reads nothing until its prologue wait has passed, where it
acquires itself (and, since the previous change, empties the scalar cache). The
acquire in its packet header runs when the packet processor launches the kernel,
before the launches in front have written, so it guards nothing the kernel
reads and only holds the packet processor: on an R9700, 2.1 us per launch with
the agent-scope acquire against 1.2 us without.
rad_kernel_chain may now answer 2 (libr4d's rows do): the chained forms' acquire
covers everything they read. The loader records it (KernelRow::chain_fenced);
the engine asks rad_dev_chain_infer(2) when chaining pays and every row that can
chain, from every loaded library, says 2 (one row answering 1 keeps the acquire
on all chained packets). The backend then issues a chained dispatch without its
barrier bit with no header acquire, live and in played passes, unless the ring,
the host epoch or a copy asks for one; releases, barrier packets, plain kernels
and the prefetch stream are untouched, and a card with its arguments in VRAM
and no HDP flush register keeps the acquire. RADIANCE_AQL_CHAIN_FENCE=1 puts it
back on every chained launch.
Qwen3.8-Flash-Next IQR-V4, TP2, MTP chain 3 with coupling, ABBA over 2 pairs:
+0.75% tok/s [0.73, 0.78], all 156 texts identical. The three device tests
added before now also run with the packets unacquired, and a shipped-plugins
test requires libr4d's chained rows to answer 2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ar_hc_write / ar_gather_hc_write get a register form when every thread owns at most one
16-byte word (up to 12 rows of 2560, P2P instances): y, inj and h are loaded into registers
before the first atomic and not re-read after the handshake; LDS-only barriers instead of
__syncthreads; the flag poll is a relaxed system-scope load (the push check with retry behind
a system acquire stays). Before waiting on its chain turn each block stores one word into the
peer's memory: the P2P path between the cards goes idle after ~20 us, and the next store then
becomes visible ~4 us later; the wake store hides that. Wire format, flags, counters, check word
and arithmetic unchanged, mixable with the plain kernels on one instance; host-mailbox twins
keep the plain kernels. The chained wait the forms sit behind ends in r4d_chain_acquire (the
previous commit's s_dcache_inv). 63 new r4d_selftest cases: register form against plain form,
byte-identical, M = 1..8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Architecture-only (no kernel, op schema or graph change). The attention block tells the indexer
whether it reads the selection (AttnGatedFP8::qsa_use): dense steps (<= 1024 tokens of context)
issue no query norm, qsa_score or qsa_select; single-row-per-sequence steps under the exact bound
read the block table; multi-row steps under the bound select once per pass (the selection is
layer-invariant there, every complete block in block order) and the other QSA layers reuse it.
Block keys and tail run every step. The exact host bound (RadBatch::kv_used_max_h) decides which
side of the bound a step is on and keys the pass. RADIANCE_DEBUG_QSA_EAGER=1 restores the old
issue pattern.
arch_test: the pinned step hashes of qwen4exp_fp8 move (graphs unchanged) and two tests pin the
new issue pattern; ref_test pins the equalities it rests on (qsa_select below the bound).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The recipe of Ling-3.0-flash and its fine-tunes on an IQ8R trunk: the trunk lines of
ling-3.0-tiny-iq8r.recipe, the 512 routed experts of a layer as rotated four-bit codes into the w4nl
codebook at an E4M3 scale a (row, 64 of K). An empty CALIB directory rounds the experts to nearest
with a scale search.
Ling-3.0-flash-Sante converted with it (experts rounded to nearest) on four R9700 against the bf16
original, 80 MT-Bench questions, 42,767 tokens: mean KL 0.00461, 99th percentile 0.0494, top token
the same 98.0 %.
the_ling_flash_iq8r_w4nl64_recipe_decides_the_model_it_was_written_for reads the recipe as it ships
over the plugin's names: the IQ8R trunk, the w4nl64 experts, the shared down projection, the f32
casts and the weights kept bf16. recipe_test: 14 of 14 cases; ctest -LE 'gpu|oot': 181 of 181 (3
skipped).
Flash clamps its SwiGLU in its last layers (routed 35-41, shared 34-41). The plugin and MoeFP8's
check for int8 activations refused a rotated int8 trunk over them, since the int8 gated products
had no clamped form. With the previous commit they have one, so both refusals go. MoeFP8
keeps the refusal for a W5NL down projection: no clamp writes its rotated E4M3 codes.
flash_iq8r_clamps_its_gated_products_then_quantises_them_rotated declares flash's IQ8R container
at one, two and four ranks, every rank: 15 swiglu_step, each followed by had_quant_act_i8g reading
its plane at group 128; against the same container without the clamp lists 15 ops more and 15
gated_had_quant_i8g fewer, and no unrotated int8 or E4M3 quantiser. The steps run lint-clean. It
fails without the previous commit. The graph hashes of the bf16 and four-bit containers stay the
same. bailing_hybrid_arch_test: 9 of 9 pass; ctest -LE 'gpu|oot': 181 of 181 (3 skipped).
GateQuantFP8's clamped branch (swiglu_clamped, swiglu_step) refused an output of rotated int8
codes, since its quantiser was the unrotated quant_act_i8g. A down projection stored at i8a8h reads
rotated codes, so a model that clamps its SwiGLU had no form with int8 activations.
The branch now picks had_quant_act_i8g for rotated int8 codes, at the consumer's group (128, or 256
through had_quant_act_iq8r for IQ8R), the quantiser the rotated trunk's other inputs use. The clamp
still writes the bf16 plane first: one launch more than the unclamped gated_had_quant_i8g, in the
clamped layers only. E4M3 and plain int8 outputs are unchanged.
With --mm-max-patches auto, a container that carries a vision tower gets 16384
patches and the tower on the card. A build without a media decoder
(RAD_WITH_FFMPEG off: mm::decoder_available() is false) refuses every media
part -- MultimodalBridge::accepts() says no -- so the tower can never run a
pass; it only holds card memory the routed experts are short of. On
Qwen3.8-Flash-Next at tp 2 on two R9700 that is 857 MiB a rank, about 800
expert units a rank, which the routed GEMMs then read from the pinned pool over
the link instead of from the card.
The automatic choice is now 0 in such a build, with an info line and a
decision-table entry that say why; the audio encoder's automatic size already
follows --mm-max-patches 0. An explicit --mm-max-patches N still loads the
tower. The flag's help and the GUIDE row say so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Once a kernel with a private segment has been dispatched (rad_step_advance has
544 bytes a lane), the HSA runtime hands its queue scratch memory and keeps it:
about +114 MiB on a card after the first speculative step, +150 MiB with a
larger segment, with or without HSA_NO_SCRATCH_RECLAIM. The VRAM budget does
not count it, so a serving process was left with only 27-65 MiB free after its
first speculative steps -- a thin margin for any kernel that later takes a
bigger private segment (the runtime then faults the queue with OUT_OF_RESOURCES
instead of failing the load).
The backend now reports rad_dev_resident_scratch_bytes(): 5 MiB per CU (160 MiB
on an R9700, which reports 32), over the measured 114-150 MiB, and 0 on the
host backend and on unified memory. The engine puts it into VramFacts::
queue_scratch, and the budget charges it with the hardware queues (the
resolver, vram_budget_need, and the report line).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A speculative step makes four builds (history pass, draft rounds 2-3, the
next verify). With room for three, the next verify's reserve() waited in
retire_oldest() on one of the current step's draft-pass uploads, so
issue-ahead returned only ~0.1-0.5 ms before the card needed the step and
every host hiccup became card idle.
The ring now holds kRingBuilds = 16 worst-case builds (it must stay below
kFlights). On Qwen3.8-Flash-Next IQR-V4 (MTP chain 3) step_next returns
11-13 ms ahead, and the card's idle time before the verify drops from 317 to
74 us (from 1243 to 470 us mean under host load). The pinned host ring grows
from 753 KiB to 3.9 MiB; the device slab is unchanged. Outputs are identical.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pin_hot() set the pin threshold to the share at the cut minus 1.0, which
assumes integer gaps between shares. A profile's per-layer shares are
fractions in [0, 1] (xs_profile_load divides by the layer's total), so the
threshold went negative and every resident expert counted as pinned at any
--expert-pin-top, leaving the heat engine no slab slots (decode -4..9% on
Qwen3.8-Flash-Next IQR-V4 against the same run without pinning).
The threshold is now the share just below the hot set (-1 when the hot set
is every expert, so everything pins). A test with fractional shares pins the
hottest quarter and fails without the change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two latent bugs that the packet processor's acquire (about 0.9 us a launch) has
been hiding by timing.
1. Kernel arguments and the chain record are written into VRAM through the BAR,
and the card's host data path keeps such a write until it is flushed. Nothing
ordered that against the doorbell (the sfence only orders the CPU's own
buffers). A kernel the card starts a microsecond or two after its doorbell
reads the slot as the launch one lap of the ring before left it: old
arguments, or no chain record, in which case the launch counts nothing and
the chained launch behind it waits for good. The backend now stores to the
card's HDP flush register (HSA_AMD_AGENT_INFO_HDP_FLUSH) in front of every
doorbell, in publish() and in a played pass's ring(). Without a register
(the argument ring in host memory, or a driver that gives none) nothing
changes, and a warning says so at startup.
2. rad_chain_wait()/r4d_chain_wait() end in an agent-scope acquire fence, which
invalidates the vector caches. A load whose address every lane shares is a
scalar load, served from the scalar data cache, and nothing but the packet
processor's acquire (which runs when the kernel is launched, before the
launch in front has written) empties that. A chained kernel can therefore
read a stale scale, count or activation from the arena address an earlier
launch read. The waits now issue s_dcache_inv behind the fence
(r4d_chain_acquire in libr4d, chain_kernel.h in the core's blit kernels).
Evidence on an R9700 with the packet acquire left as it is: a probe of
1024-block readers behind a chained wait saw a stale shared value in 1 launch
of 1800 without the s_dcache_inv and in none with it; card-side copies issued
one by one with 50 us between them stalled the queue in its first lap, four
runs in four, and six runs in nine of 300000 back to back ended with a unit
moved by another launch's arguments, when the packets went without their
acquire and without the flush, and in none with the flush.
New device tests: a chained reader sees a shared value the launch in front
wrote, a chained launch reads its own arguments after the ring has lapped, and
a copy issued after a pause finds the record written for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Declare and step of the IQ8R container, the plain int8 trunk beside the
bf16 one, the trunks the plugin refuses, and the shipped recipe's
container against the bf16 container of the same tiny checkpoint.
LFM3-1.7B with every trunk linear but the attention gate as IQ8R (rotated
int8, a u8 scale per 256 of K under a bf16 scale a row), round to nearest.
The gate, the short convolution, the norms, the embedding and the tied
lm_head stay bf16.
The trunk's format is read off layer 0's first linear, as lfm2_bf16 reads it:
plain bf16 runs as before; an int8 weight (i8a8, or IQ8R at i8a8h) gives the
four activations int8 code pairs at the weights' scale group and each linear
quantises its input. Every linear of the trunk must have that format; the gate
stays bf16 in every container; a block-fp8 or narrower trunk is refused by
name. The lm_head is declared at its stored codes.
Every linear but the attention gate is declared and issued through the shared
LinearFP8 (arch/common/rad_fp8.h), as lfm2_bf16's are, over four ActFP8
activations whose bf16 planes are the buffers the graph already had. A bf16
container declares the same weights and the same gemm_nt ops as before; the
name maps move into LinearFP8::declare. The gate keeps its own declaration:
its weight is gate_proj's rows repeated (RAD_MAP_ROWS). No change in what a
bf16 model computes.
The README's table gains a row for LFM3-1.7B (bf16, converted from the checkpoint as it ships).
libr4d's README said of head_dim 128 at 4 queries a KV head that there is no prefill row; the
window rows added for LFM3 serve that geometry past the decode band, and the line now says so.
The checkpoint's tokenizer adds no BOS to a raw prompt, and without it some first tokens put
the model where bf16 departs from float32. Say so among the traps, with the two ways round it.
The rotary per attention class with the full layers' partial factor, the
window, the layer list and the booleans arrive as the keys the plugin reads;
the typed rope_theta is the default, which the plugin does not read.
A layer's post norm, residual add and feed-forward norm are one launch, and so
are its feed-forward's post norm, add and the next layer's input norm: 50
launches for the chain's 144 at 24 layers. The op is asked for with
rad_op_declared, as gemma4 does; libref and libavx do not carry it and run the
rmsnorm / add / rmsnorm chain, as does the last layer's feed-forward. The arm's
output has its own buffer, since a join reads it beside x and writes h.
At LFM3's shapes: the per-head norm over head_dim-wide rows, and the full
layers' partial rotary (64 of 128 at theta 1e6 on the head ladder) with
positions past 250000.
What LFM3 needs on gfx1151 beyond the rows libhalo has. The window kernel is
instantiated at (128, 4) as in libr4d: the decode leg keeps q_len <= 16 and
every longer q_len, windowed or not, lands on the new pair. rope_rows and
rmsnorm_rows are registered under their row-form names and launched as rope
and rmsnorm, as libavx and libref register them, so a plugin written for
libr4d's row forms resolves on this part instead of falling to the host.
Emulator cases as libr4d's (split verify, ragged window, fp8, non-causal with
a missing block, WMMA prefill with and without the window) and selftest
launches.
The full-attention layers resume from cached blocks, the sliding layers from a
window snapshot and the convolutions from the same checkpoint slot; under
--prefix-resume exact and nearest the reply and its probabilities equal a cold
run's.
Geometry, the traps (the gate is one sigmoid, two rotaries, the window on the
sliding layers only, four norms a layer), what is refused, and which kernels
serve it.
A tiny LFM3 (conv, full attention, conv, sliding attention; window 8, conv
width 7) joins the engine tests every family runs: the golden against the
reference implementation, chunking and batching, libavx against libref,
decode against prefill, concurrent requests and speculation by prompt lookup.
Its golden is made by mklfm3golden.py from the modelling code LiquidAI ships
with the checkpoint, since transformers has no LFM3 class.
arch_test covers what the plugin declares for each layer kind, what it
refuses, and a step through both attention groups.
LFM2's hybrid with sliding-window attention layers as a third kind,
sandwich norms, a partial rotary on the head ladder for the full layers
and a sigmoid gate per query head on the attention output. The gate is
computed at the output's width (gate_proj's rows repeated by the name
map), so it needs no op beyond gemm_nt, sigmoid and mul. One rank, bf16
linears; everything else is refused by name.
LFM3's attention: 16 query heads over 4 kv heads at head_dim 128, in full
layers and in sliding layers with a 256-token window. The decode leg
(r4d_attn_paged_h128_gqa4.hip) serves q_len <= 16 and ranks above; every
longer q_len had no row at this geometry. A row pair (bf16 and int8
cache), its constraints, selftest launches and emulator cases (split
verify, ragged window, int8 cache, non-causal with a missing block, WMMA
prefill with and without the window).
A converted checkpoint can name a token end-of-generation that the chat format
itself writes as one of its call delimiters -- Qwen3.8-Flash-Next's
`</tool_call>` is a single added token, and a container that lists it in
generation_config's eos list stops every tool-calling turn the moment the call
closes. The damage is worse than a late stop: a second call is never written,
finish_reason says "stop" on a tool-calling turn, and a reply that quotes the
tag as that token is cut mid-sentence (seen in a coding session where the model
wrote about the template and the turn ended between two tokens).
The bridge already derives the format, so it knows what the model writes as a
call boundary. It now reports the end-of-generation ids whose spelling is one
of those markers, leaves them out of the reply parser's terminators, and the
engine demotes them in the decoder's stop predicate with a warning. The
template's real terminator (<|im_end|>) is untouched, and a model without
tools, or a container that names nothing extra, is unchanged.
Ling-3.0-flash's template writes a call as the opener, the function name, a
newline, and only then the argument tags:
<tool_call>read
<arg_key>path</arg_key>
<arg_value>/a</arg_value>
</tool_call>
The differential analysis names the function between the opener and the first
argument tag, so its end is the bare newline and name_suffix comes out as
whitespace alone. chat_format_check refused that, so every request carrying
tools answered 501 with "this model's tool calls cannot be read back:
name_suffix must end the function name with something besides whitespace" --
the whole tool-calling surface, for every Ling-3.0 checkpoint.
A suffix with no core of its own is the suffixless ending written out: the
name stops at the whitespace. The reader now takes it that way (name_open keys
on the trimmed core, so the name runs to the first arg_prefix or call_end,
whitespace trimmed), while the grammar still writes the template's newline.
The object family has no such terminator -- its brace ends the name -- and
keeps the refusal, as does the wrapped format whose bare name_prefix would
otherwise read as a call.
Adds the real template as a fixture and a regression test that derives the
format, builds the grammar, and reads a two-call reply built from the derived
fields; a second test pins the object family's refusal.
2.0.0 dropped #396's hc_read decode forms. With ROCm 7.2.1 (clang 22) they gave NaN logits (#413's report);
ROCm 10.1 was fine. The cause is kernel B3 alone: clang 22's backend sinks its WMMA up product into the
lane-divergent `if (col < RG && col < rows)` around the store of x, so the WMMA runs with part of EXEC off
(an s_and_saveexec right before the first v_wmma). In the IR the WMMA is convergent and outside the branch.
At 16 rows every lane passes the test, which is why form S at 16 rows was right.
- Forms G (1..8 rows) and S (9..16) and kernel B3 at Flash-Next's shape, the bodies of #396, chained in
2.1's style (r4dchain / R4dUnchained), hc_rot_group<I8>. They take these rows from the fused grid and the
tiled read; from 17 rows nothing changes.
- B3: a lane past the step's rows takes the last row and every lane stores, bit for bit what that row's own
lane stores, so there is no branch after the WMMA.
- hc_decode_forms is #396's again (d against fp64, x within rounding up to 16 rows), with 2.1's rq dtype, a
count of non-finite outputs (the error sums went through std::max and >, which pass NaN) and rows 9 and 12.
r4d_selftest --case hc_read_e4m3: 66 passed with ROCm 7.2.1 and with 10.1; 27 failed with 7.2.1 without
B3's change. Flash-Next on 2x R9700, ABBA, ms per decode step at 1/2/4/8/16 streams: 15.72/20.62/26.83/
37.37/51.89 -> 14.92/18.61/26.67/37.15/50.83; prefill unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A speculative verify issues several rows where a plain decode issues one.
Two IQR kernels accumulated those rows differently, so the same weights and
activations could round to different bf16 outputs. A greedy choice near a
tie could therefore diverge even though every draft was accepted.
gemm_iqr_nt_m64: a U5 row-scale trellis (computed trellis, 5-bit, one f32
scale a row) already folds one to four rows as a GEMV in the single-token
order. Above that, through the GEMV's eight-row limit, the multi-row fold
differs. Those rows now run as independent single-row GEMV blocks on
grid.y, including a chained launch. Gated GEMMs and every other form keep
their dispatch.
moe_gemm_iqr: a short token-order gate/up batch (more than one token, at
most eight times top_k, top_k below the one-wave threshold, K at least
eight 128-blocks, and a one-token step inside the decode band) used the
run grid. Several tokens on one expert then took the WMMA tile instead of
the one-row dot. Those batches now give each sorted slot its own block and
the same wide-K dot reduction as a one-token gate/up. Sorted down
projections, longer batches and the prefill map are unchanged.
r4d_selftest checks both against independent single-row launches, bit for
bit, including an untouched output tail on the dense row. The existing
grouped numerical suite still passes.
Measured on an R9700, the dense U5 path at N=8192 K=2560 is 26.5 us at
M=1, 51.2 at M=4 and 105.2 at M=7. A 512-expert Qwen3.8-Flash-Next gate/up
(768:512 x 2560, 5-bit, ten slots a token) is 28.9 us at one token, 52.4
at four and 82.2 at seven. Prefill remains the old kernel.
On the isolated build, Qwen3.8-Flash-Next U5-gate/W5-down matched its
non-speculative token ids at MTP 3 and 6 on arithmetic, writing, code,
explanation and JSON. StillDeadcode's IQR-V4 control matched on the
arithmetic and writing prompts at MTP 3. A layer trace of the previously
divergent writing token was bit-identical between the two schedules.
A request turns the control vector on with the `control_vector` body field, or the deployment's
default applies. A client that can only choose a model cannot send the field, and a gateway can
allow or refuse a model by its name but not a field. --control-vector-variant NAME lists
MODEL:NAME as a child of the model, the way an adapter is listed, and a request naming it runs
with the vector on whatever the default; the model's own name keeps the default. Unset, the
default, lists nothing.
The key needs --control-vector off or on. NAME keeps the rule model names keep (no ':' or
whitespace), and may not be a --lora adapter's name or the served model's own. The variant's
name with "control_vector": false is refused, since the request asks for both. With adapters
enabled the variant takes no adapter lookup, and /v1/load_lora_adapter refuses its name.
config_test 68, fleet_config_test 18 and server_test 191 cases pass, and the host suite
(ctest -LE 'gpu|oot') passes. On two R9700s at TP2 (Qwen3.8-Flash-Next IQR-V4 with the shipped
vector), through the front: /v1/models lists MODEL:uncensored and GET /v1/models/MODEL:uncensored
answers; a policy prompt to the variant is answered and to the model's own name refused; the
variant with "control_vector": false is a 400.
Router::dispatch put a route's captures into the request with std::map::insert, which keeps a key
the request already has. The front matches /v1/models/ID itself and hands the request to the
model's router with the path rewritten, an alias as the model's name and base:adapter as the
adapter's, so the model read the front's id: through the front, GET /v1/models/ALIAS and
GET /v1/models/base:adapter answered 404. The captures of the route that matched now replace those
of the same name; nothing sets a request's params before a dispatch otherwise.
server_test: a_request_handed_on_reads_the_capture_of_the_route_that_matched_it fails without the
change and passes with it.
chat.h sat in arch/museglimmer/ while the ct plugin and chatparse_test
included it across the directory boundary -- a shared reply-format
table, and the house answer for that already exists twice over:
rad_gemma4_chat.h and rad_deepseek41_chat.h in arch/common. Moved to
rad_museglimmer_chat.h beside them; the three consumers take the same
<arch/...> include the other two already use.
Standards axis of the 2.1.0 review pass, finding 9.
"The trunk is rotated int8 (linear_is_w8h or linear_is_wnh), its
activation codes one scale a trunk_g8 columns: 256 for IQ8R, 128 for
the other rotated forms" was written twice, verbatim, in flint's and
bailing_hybrid's field declarations, and the probe that answers it --
weight_enc, the two predicates, linear_w8h_group -- was re-typed at
both arches' layer-0 sites. museglimmer_ct carries the near-variant;
its question is narrower (exactly-IQ8R, not rotated-at-all), so it
keeps its own predicate.
rad_fp8.h now answers it once: trunk_rotation(enc, &g8), beside the
predicates it is made of, so the group-width semantics travel with the
forms that define them instead of with three copies of a comment. The
two call sites shrink to the probe and the named question.
Standards axis of the 2.1.0 review pass, finding 4.
cfg_f/cfg_i/cfg_s -- the "text_config.<key>, else <key>" fallback that a
multimodal config's language half needs -- exist in rad_arch.h as
meta_text_getf/geti/gets, and have since 1.7.0. Both muse plugins grew
a byte-identical private copy in the same commit, the two copies
identical to each other. Deleted; the call sites name the common
helpers. museglimmer_test drives every one of the replaced reads.
Standards axis of the 2.1.0 review pass, finding 2.
The ATEM handoff's think_out called touch(0) twice on the hold branch
(harmless -- touch is edge-triggered -- but a merge artifact in an
otherwise surgical state machine); processor.cpp grew a second,
byte-identical Python-rounding helper 700 lines below the one it
already has, renamed only by an underscore; and the rewritten
RAD_TESTS_NO_CORE comment hand-enumerated eight tests while the set
below it names nine -- the comment now points at the set instead of
drifting from it again.
Standards axis of the 2.1.0 review pass, findings 6, 7 and 10.
artifact_sums and vendor_sums each set TIMEOUT 120 outright, where the
tests around them use ${RAD_TEST_TIMEOUT}. In the fast (Release) gate
the variable is 120, so the fast suite is unchanged -- but under ASAN,
TSAN or a Debug build it rises to 600 for every sibling, and these two
shelled-out hash sweeps over the vendor and artifact trees stayed pinned
at 120 there, the one config where a filesystem walk can be slowest.
Same idiom as the neighbours now: one knob, no per-test literal to
forget when the budget moves.
The front kept its own list of which routes answer the local operator
keyless -- guarded_route spelled out the same eight (method, path)
pairs Server::register_routes registers with a local_operator handler,
and its comment admitted the copy ("Kept in step with Server::register
routes"). A new guarded route meant editing the registration AND the
front's list AND the test that pins the list against drift; miss one and
the front wakes a parked model for a stranger who is then refused -- the
exact A-05 bug class -- silently.
Router::add now takes a `guarded` flag, set on the six registrations
that guard (and their DELETE siblings). Router::guarded(method, path)
asks the matcher -- the same split_path + :label match that reaches the
handler -- and the front copies the flag as it mirrors each model route,
so guarded_route is one line reading the front's own copied marks. One
declaration per guarded route, at its registration; the matcher that
decides the wake is the matcher that dispatches, so slash and :label
forms cannot disagree with the handler and the drift risk is gone.
front_test still pins every shape (guarded: slashes, /sessions/:label,
the trailing-slash collapse; not: GET /sessions, /stats, inference,
/sessions/a/b) and transport_test exercises real dispatch through them.
Behaviour unchanged -- the same eight routes wake nothing for a stranger.
add_routes' guard and the front's operator rule computed the same
expression byte for byte -- !c.api_key.empty() || server::local_operator(
q, c.host, c.allow_hosts) -- once to answer a fleet admin route with a
403 and once to decide whether a guarded route may wake a model. The
second-pass audit had to touch both to move them together, which is the
telling.
Fleet::operator_ok(q) owns it now; both callers call it. The two must
agree or the front lets through a request the handler then refuses (or
wakes a model the guard would not have admitted), so a single source is
the point -- keyed deployments pass, keyless ones answer the three-leg
local-operator rule exactly as before. No behaviour change.
Three sites -- the kvstream clamp (L-02), the batch overlap guard and
the bidi-plane belt -- each open-coded the same four lines: a function-
local static atomic<bool>, a bool expected, and a compare_exchange to
decide which of the many steps gets to print. The pattern is the point,
not the flag name (said, said2), so it moved to rad_internal.h as
log_once(flag): true on the first call, false after.
No behaviour change -- same first-of-many warnings, same compare-exchange
thread-safety, exactly one winner per flag -- only the idiom is now named
instead of re-typed where a fourth once-warning is ever needed.
The refuse sites that read a container file all re-typed the same
two-branch message -- over ? "carries far too many values"
: "nests far too deep" -- six times, and the copies had already
drifted: gen_config said "carries far too many JSON values", xstats
"far too many values", tokenizer_config "it does not parse" for the
discarded case. The bounds themselves (2^24, 256) were also spelled
as literals in tokenizer_json's refusal, so a bound change there
would make its message a lie.
Json::bound_why(over, deep) is the phrase, owned beside the read that
sets the flags, and the two bounds are exported as kContainerBudget /
kContainerDepth so the one message that states them reads them from
the constants. Every refuse site now calls it; the wording is one, the
numbers cannot drift. No behaviour change -- the same flags map to the
same failure paths, only the text they print is unified.
The layer-count cap made the walk safe; the arithmetic was still open.
The rebuild multiplies container-supplied widths in int64 -- heads *
(nope + rope) rows for the q_b split, heads * 256 * latent for the
fused kv -- and hands the products to sized allocations and a
comparison. A wrapped q_b product that coincidentally equalled the
tensor's rows would run the split at a wrong per-head boundary (the
bytes stayed the file's own, but the weights went to the wrong names);
on the 32-bit tier, an overflowed element count truncates through
size_t to a small allocation the copy then overruns.
The family gate now caps what these products are built from -- heads
and the MLA rank at 4096, rope at 256 dimensions, the full query width
at 65536, the layer group within the stack; the shipped geometry is
128/64/512 with tens of heads -- and the q_b row product is computed
with overflow checks instead of trusted. checkpoint_test pins the wide
heads and rank against the honest small stack.
Found by the 2.1.0 review pass (axis: hostile model files); widened
past the reported site to the fused-kv product the same axes cleared
only as file-bounded.
diagnose wrote diagnose.json and diagnose.md with plain ofstreams into
the configured report dir. That dir is a shared place in practice -- a
/srv/reports, a fleet peer's mount -- and a local user who can write it
can pre-create DIR/diagnose.json as a symlink: the serving-user process
then truncates and overwrites whatever the link names, with report text
whose category strings a corpus file partly shapes. A reader polling the
dir also sees a half-written report.
This is the hazard xs_write_atomic exists for -- xstats' comment
describes exactly this pre-created-symlink story -- and xstats.h is
what xstats uses to write the very same kind of file. Both report
writes go through it now: temp file, no follow, rename.
Found by the 2.1.0 review pass (axis: hostile sockets / runtime).
Both files diagnose consumes are written by other runs and pasted
between people: --diagnose-baseline is an earlier report, the corpus a
forwarded file. Neither was read like a supplied file. The baseline got
the unbounded Json::parse, and compare_outputs then walked it with
throwing accessors -- a member it does not expect throws, and nothing
between run_diagnose and main catches -- so a crafted "earlier report"
aborted a run with std::terminate after hours of benchmarking work. The
corpus got a hand-rolled unbounded fread loop and a raw parser per
line: a deep line recursed the parse to a stack overflow before the
fingerprint check could ever run.
Now: capped read and parse_container on both (the corpus's size refusal
lands before the bytes are read), a per-line over/deep refusal that
names the line, and one try around the comparison so any structure the
comparison does not expect is the refusal it should be -- "the baseline
is not shaped like a report", parity not compared, the run keeps its
own results. diagnose_test pins the deep line.
Found by the 2.1.0 review pass (both security axes, independently).
scheduler.stuck-exit (2.1.0, 60 s by default everywhere) turns the stall
verdict into a process exit so a restart policy can act on a hung card.
The verdict watches queue read-indices and the direct-IO counter -- and
a cold load moves neither: a mapped tier faulting its tables through the
page cache is not counted, a barrier-waiting rank parks its index, and
"zero progress for 60 s" is then a description of a big model starting,
not of a hang. Under a restart policy that misfire is a crash loop with
a captive audience: the same load runs on every restart, and the exit
was armed from process start.
The watchdog now reads dev_engine_ready: set when an Engine::start()
completed once, never unset, and the exit fires only after it. A hang
during the very first bringup is what it always was -- dumps, the log
line, /health 503; the supervisor's hammer hits a process that has not
started serving, which is exactly the case the exemption keeps it off.
The verdict's own log line says which of the two futures it has, per
this file's rule that a report never states less than it will do.
No fast-suite test reaches the backend watchdog thread (the exit path
kills the process and the watch ticks in wall-clock seconds); the
config parse stays pinned by fleet_config_test and the exemption is one
flag read at the fatal's gate. Found by the 2.1.0 review pass
(axis: hostile sockets / runtime; the load-phase scenario is the
mapped-tier fault storm the release itself describes).
bad_arguments names the offending tool_calls[].function.arguments when a
refused conversation reaches it -- and it probed each string with the
plain Json::parse. The HTTP edge depth-caps these strings (its comment
is explicit that the strings could otherwise overflow a worker's stack),
but nothing capped the VALUE COUNT: a client whose conversation had
already failed the template -- exactly the path this refusal exists on
-- could hand the probe a few million flat values, and the probe grew a
DOM no one would ever read, once per request, inside the body's 512 MiB.
Offline callers (fleet, diagnose) reach the same path with no edge at
all.
The probe is parse_bounded now, at the same depth the edge enforces and
a values budget a tool call cannot approach; over, too deep, and not
JSON each name themselves in the refusal, and the honest case still
refuses in the template's own words. chat_test pins all three bounds.
Found by the 2.1.0 review pass (axis: hostile sockets).
MuseTower::declare read vision_config.num_hidden_layers and the position
grid with only a positive check, then handed them to host vectors --
full.assign(depth), L.assign(depth) -- before any weight was consulted.
A container stating 2^62 layers threw std::length_error (or bad_alloc
just below max_size) out of the declare phase, and nothing between there
and main catches: the process died with a SIGABRT and no report, where
every other bad config in this file says what it dislikes on stderr and
refuses with RAD_E_INVAL. The grid sides were the same story multiplied:
pos_emb_height x pos_emb_width is a signed product of container values
that can overflow before any comparison could see it.
The gate now refuses depth past 128 and a grid side past 512, against
published maxima rather than round numbers: the deepest vision encoder
ever shipped is 48 layers (ViT-22B, InternViT-6B -- this family's towers
are SigLIP-class, tens), and the largest stored position table a side of
92 (SigLIP at 1292 px over patch 14; CLIP 16, SAM 64; native-resolution
towers store no side x side table). The caps sit ~2.6x and ~5.5x past
those, so they never bite an honest container, and at the cap itself the
guarded shapes are harmless: the depth vectors cost KiB and the grid
products top out at 2^18, too small to wrap signed 64 before a
comparison sees them. museglimmer_test pins both caps at their boundary
and far past it -- the grid at both sides together, since one side
alone the height==width rule refuses before the cap is consulted.
Found by the 2.1.0 review pass (axis: hostile model files); caps
sourced against published encoders and tightened at the operator's
request, from the first pass's wide 512/4096 margins.
bailingmoe3_layouts rebuilds the release GGUF's layouts by walking every
layer the container claims -- and it runs on the open path, before any
plugin gets a vote. Its gate checked the counts were positive and nothing
more: a GGUF naming 2^62 blocks sends the name-probe loops over centuries
of iterations. The process never listens, never refuses; StallWatch notes
the silence after two minutes and stops there. A negative
first_k_dense_replace opens a second loop of the same order, starting
below zero. This is a hostile container's permanent hang, the same
supply-chain class as the round-two finding on the shard index: the
refusal must land before the walk.
The gate now caps n_layers at 4096 (the family's real models are an order
of magnitude below; 4096 layers is not a slow load either) and requires
the dense prefix to lie inside the stack. checkpoint_test pins all three
shapes -- 2^62 layers refused, negative prefix refused, a small honest
stack opens as before -- and the test GGUF writer gains the INT64 KV type
they are spelled in, which the u32 field could not carry.
Found by the 2.1.0 review pass (axis: hostile model files).
The scheduler caps one request's scored candidate list at 4096 ids;
nothing bounded the step's UNION. A step packed with maxed scored
requests unions toward the whole vocabulary, the pinned readback
buffer is sized from that union, and its size was discovered by
ATTEMPTING it: a gigabyte-scale page-locked allocation whose only
check was whether the box survived it. Survive it and the bytes stay
pinned forever -- the buffer is grow-only. This was L-04: the
round-one cancel-path invariant held (the engine never died on it),
but the residual was an attacker-sized lever on page-locked memory.
The cap is the step-wide sibling of the per-request one: 65536 unique
candidate rows, sixteen maximally-loaded requests, while real scored
questions name a few dozen ids each. A step past it takes the refusal
the allocation failure already took -- the scored requests cancel,
the engine and every other request on the step keep running -- except
before the box is asked to pin anything to find out. The logits-row
mode needs no sibling cap: its rows are one per scored request,
bounded by the batch's max_seqs by construction.
The table still listed vendor/nlohmann as "lifted, unmodified": the
directory is gone, displaced by core/util/json.{h,cpp} on the yyjson
reader, and vendor/UPSTREAM has recorded the removal since (audit
I-04). And no cell said cpp-httplib carries a local patch -- it has
for as long as 0022 has existed, so "unmodified" sat next to a
directory that is not.
The row now names both facts at the place a reader looks up what is
lifted and what is ours: httplib lifted with the one patch, the DOM
rewritten into core/.
0.64.0's ThreadPool spawns a dynamic worker inside the accept loop with
no guard: when the process runs out of threads, std::thread's
std::system_error escapes the loop and std::terminate takes the whole
server down. A client that opens enough connections makes thread
exhaustion a scheduled event; radiance's socket gate and drain budget
narrowed that window but never closed it. 0.66.0 wraps the spawn in
try/catch and keeps the job queued for an existing worker -- the abort
becomes a queue.
The pair moves to what llama.cpp carries at b8abe41a5 ("vendor: update
cpp-httplib to 0.66.0 (#32049)"), byte for byte; the LICENSE was already
byte-identical. Patch 0022 re-verified, not rewritten: the same hunk at
a +26-line offset with no fuzz, upstream still bounds the keep-alive
drain only by the connection's timeout, so the 5 s budget still stands.
The six CPPHTTPLIB_* defines vendor/CMakeLists.txt passes were each
re-checked as live knobs in the new pair. UPSTREAM carries the new
record and the audit note; the manifest re-hashes in this commit.
The gate that admits a preempted request back subtracted the raw
attention prefix hit from every paged group's need. Admission does not
adopt that deep: under checkpoints the linear layers replay from the
last checkpoint whatever the attention matched, so the adopted prefix is
clamped to the linear hit, exact mode floors it to its chunk grid, and
one token always stays outside for the logits. Every block of that
difference was a block the recompute would really need and the gate
pretended was free: the request is admitted against a loan it cannot
repay, the next ensure preempts it again -- the exact loop the gate's
own comment describes.
The gate now runs the plain count first, which passes without touching
the cache at all when the pools plainly hold the recompute, and consults
the hash-chain lookup -- request-length CPU, under mu_, per waiting slot
per round -- only when the credit decides, crediting the clamped,
floored, capped depth admission actually adopts. Under-crediting delays
a re-admission by a round; over-crediting, which is what this was,
loops.
The five files under vendor/shim/ are hashed by the manifest and
tamper-visible, but LIFTED FILES named only one of them
(ryml_impl.cpp, beside the rapidyaml entry). The other four carry
upstream's shape or text -- common.h transcribes llama.cpp's string
helpers unchanged, MIT, at the recorded commit; ggml.h, llama.h and
log.h declare the macros, types and log surface the byte-for-byte lifts
reach for -- and "the manifest hashes it" is tamper detection, not
provenance. A refresh could meet those files with no note of what they
mirror.
They are recorded now, beside the lifts they exist for, with what each
is, what it mirrors, and why it exists rather than the upstream file it
stands in for. The manifest re-hashes with the record, in this commit.
h_bidi carries one slot per run that intersects the chunk, over a plane
four times the step's token capacity wide -- sound only because
RopeLayout::runs is documented ascending and pairwise disjoint, so every
accepted run can bill at least one real token of the step. Until 2.0 the
layout was built solely from the tokenizer's own placeholder scan;
request-side placement writes it now, and a layout with overlapping runs
would bill one token twice, run n_bidi past the plane, and hand the card
an index plane its shape validation waved through.
The build now checks the promise where it consumes it: a run starting
before the last accepted one's end is dropped -- those media rows simply
lose bidirectionality for the step, which is an ordinary miss -- and a
hard stop guards the plane width itself, unreachable unless the check is
wrong. Both events speak once per process, not per step.
--expert-profile read its file with no size cap -- any file, gigabytes,
appended into memory before a single check -- parsed the text with the
unbounded parser, and took n_trunk_layers through int32. That last one
is the quiet one: the loader refuses "this profile is for another
model" by comparing the file's layer count with the live model's, and a
value that wraps past 2^32 lands on exactly the number the comparison
asks for.
The read now caps at 64 MiB while appending -- past it, nothing further
is grown and the file is refused by name -- the parse is the container
helper (parse_container) like every other file input, and n_trunk_layers
is read as int64 and range-checked before it reaches the comparison. An
xstats_test case pins the loader's three refusals -- wrapped trunk
count, negative count, oversized contract -- and the tmp-symlink
refusal of the previous commit: the planted symlink survives untouched
and the profile file still lands.
The stats file is written as "<path>.tmp.<pid>" and renamed, so a
reader never sees half a file. But the name is built from the PID --
public -- and fopen("w") happily follows a symlink planted at that name
and truncates whatever it points at. A local user who guessed the next
PID had the serving process overwrite any file that user could name,
as the serving user.
The tmp file is now opened O_CREAT|O_EXCL|O_NOFOLLOW: no symlink, no
reuse of an existing name. A stale tmp of a crashed run -- whose PID a
reboot can reuse -- is unlinked and the create retried once, exclusive
again; whoever else planted the name wins exactly a refusal.
The stage copies pool ranges of one layer into the mirror row, clamping
each run to min(pool bytes, host_layer_stride) -- the clamp is what makes
the copy memory-safe. But a silent clamp is a wrong answer given quietly:
if pool and host layer ever disagree on the layout, a run naming a block
past the row's end stages nothing there, attention reads stale bytes at
those positions, and the text comes out fluent and wrong with no fault
and no line to point at.
stage_src now notices when it clamps or drops a run and warns once per
process -- the hot path is not the place for a per-step print -- naming
the group, the row's end and the stride. The behaviour is unchanged; what
is new is that it is never silent.
A listing entry named "weights.bin#x" downloaded cleanly, checked clean,
and was the wrong object. curl ends a URL path at '#' and '?': it
requested "weights.bin" while hfget recorded the entry as
"weights.bin#x". An attacker who lists the truncated object's real size
and oid under a decorated name passes the size check, the oid check and
the manifest -- the bytes arrive under a name nobody asked for, and the
directory reads complete. hfget's name screen checked traversal, control
characters and its own manifest, but not curl's path terminators.
The jq screen now refuses any entry whose name carries # or ?. The child
that writes each file re-screens its name too, and its old case missed a
name ending in "a/.." (the parent's regex caught those, the child's did
not) as well as the terminators -- both arms added, the `?` quoted so it
stays literal and not the single-character wildcard. Two hfget tests: a
listing carrying "model.bin#x" is refused whole, and a child handed
model.bin#x, model.bin?y or sub/.. refuses before any request or write.
Give --model org/repo and the engine picks what to serve from the fetched
directory: one .rad on the top level won outright, whatever else was
there -- and .rad was not in the skip list a safetensors set imposes on
.bin/.pth/.gguf, so hfget fetched the rival too. A repository that ships
a real safetensors set beside one decoy .rad chose for the operator: the
container wins, the engine loads and serves it in place of the model the
operator named.
hf_served_path no longer resolves that tie by rank -- a container among
safetensors or gguf weights is refused by name and the operator passes the
file they mean -- and hfget skips .rad when a safetensors set is present,
as it skips every other rival. A repo holding only a container still
serves it: the fix is against the silent tie-break, not against .rad.
dashboard_page.h is the Node build of dashboard/, committed because the
engine's build has no Node. The ctest dashboard_page compares dashboard/'s
sources against the digest recorded INSIDE that header -- which proves the
sources and the header's own claim agree, nothing more. Rewrite the header
and its embedded digest together and the check passes while the engine
serves a page nobody built from these sources.
artifact_sums.sh hashes the artifact itself from outside, the mechanical
half vendor/SHA256SUMS is to vendor/UPSTREAM: tests/ARTIFACTS names every
committed built artifact and its hash, and a lone tamper of a served byte
now fails. A rebuild re-records the manifest in the same commit. The
residual gap -- a single commit rewriting an artifact AND the manifest --
is exactly the vendor-tree gap, and documented as such.
The stats file a colleague hands over is data, not the operator's own:
its model, arch and map strings are printed straight to the terminal, and
a ESC in one starts an OSC sequence that retitles the window, moves the
cursor, or worse in terminals that honour it. Malformed numbers beneath a
well-formed format header crashed the report with a raw Python traceback
the operator has to read past.
Strings for display now pass through safe(), which turns every control
character -- C0, DEL, and the C1 range -- into '?', on model, arch and
the map list alike. The whole run is wrapped so a file that passes the
format check but is malformed underneath exits with one line naming the
fault instead of a stack. --json output is untouched: it is data, not a
terminal.
vq= is the one codebook path that reads a file; table= caps its values
at 4096 but vq= appended every line to a growing vector and checked the
count only after reading the whole file, so a 10 GB codebook grew 10 GB
of vector before anything said no. And its "# unit X" line parsed X with
sscanf %lf -- which accepts "inf" -- while the fallback guard was
!(unit > 0.0), an infinity passes. A "# unit inf" file set every decoded
value to infinity.
The count is now checked as rows append, at 4096: the widest code the
grid emits is u12, so past 4096 codewords could not be indexed even with
the memory read, and the old code silently mis-indexed the over-4095 case
itself. And only a finite positive names a unit -- "inf" and "nan" fall
back to the entries' own rms, as a malformed value already did. A
quant_test case pins the 4096/4097 boundary and that "# unit inf" now
decodes finite.
grammar.cpp guarded the json-schema-to-grammar converter with a depth
check -- kMaxSchemaDepth, added because a deeply nested schema crashes
the converter -- but it built the tree to measure with Json::parse, the
unbounded read. A schema nested past the guard's own reach was already a
stack overflow by the time json_depth ran: the check sat after the thing
it was written against.
The schema is now read with parse_bounded at exactly the depth the check
promises, plus a 2^20 value cap, so the refusal fires during the read,
before any nested tree exists to be walked, dumped or destroyed. Every
current caller already hands over a bounded body, but this entry point
does not know that -- it takes a string.
A failed authentication answered 401 and kept the connection alive, so a
client guessing credentials over one keep-alive paid for the socket once
and then streamed a thousand tries down it. The gate can refuse the
request; it was not refusing the session.
The 401 now carries Connection: close. A guessing client pays a fresh
connect -- and on TLS, a fresh handshake -- per guess, while every
correctly-keyed request keeps its warm connection untouched.
The HTTP pool's start() caught std::system_error and printed e.what()
raw. An OS message carries no socket bytes, but every other catch in the
transport reads it through log_sanitize, and consistency is the cheap
half of the guarantee: a message that ever carried a token or a control
character would print straight into the operator's log.
One call to log_sanitize, and every line this transport writes from a
caught exception now says so through the same filter.
One member of the card's capabilities object -- expert_stats.file -- is
a path on this machine, the --expert-stats file the engine reports. The
card's `root` field already answers to the operator keyless and rides
with the key to everyone else; this one member skipped that rule and
leaked the deployment's file layout to any client that asked /v1/models.
handle_models now strips expert_stats.file from the capabilities dump
for a request that is neither keyless-local-operator nor api-keyed,
matching `root` exactly. The rest of the object -- counts, tiers, the
planner's shape -- is not a path and still ships.
log_admitted printed the request's model name and last user text through
%s, unsanitized -- the one entry point that skipped the log_sanitize
every other request-side field passes through. Both come straight from a
client's JSON; control characters in a model field or the tail of a
message let a client forge log lines, inject terminal escapes, or make
the log read as if the operator said something the server never saw.
The two strings now pass through log_sanitize at the print, exactly as
the peer address already does, so the admission line carries the same
guarantee the rest of the log does.
The llama-server compatibility payload carries model_path -- a path on
this machine -- to whoever asked, keyless included. It travels the same
class of information /v1/models already gates its `root` field with, and
that gate exists: a stranger enumerating models should learn the model's
name, not where its file lives.
The field now answers for an api-keyed request or a local operator and
comes back empty otherwise -- which is also what it already was for a
--model stdin read, so no client finds the member missing, only the
strangers learn nothing new.
LiLiCorr's correlator gathers each sequence's context state by the row
the advance pass wrote into h_arow (RadBatch::anchor_rows), and the
gather validates the index plane in shape, not values: an index of -1
reaches one int32 before the context buffer and reads off the end of a
device allocation. The reset that opens a build filled the plane with
-1 -- honest for a host reader, poison for an index -- so a row that
reached the query pass without advancing, in any path that skips the
advance, gathered out of bounds instead of gathering a wrong row.
The sentinel becomes row 0: always in range, and a row that really did
skip its advance reads an anchor that fails acceptance and is discarded,
which is the same outcome with no fault and no neighbour's state read.
A plugin that declared plugin_words gets a fixed carrier in the batch --
[max_seqs * plugin_words] rows, carved only because the program said how
many words a sequence may carry. The build stage already refuses a
sequence past that bound, but nothing at admission did, and a refused
build restages its step forever: one request carrying more words than the
plugin declared stalls every queue behind it, permanently.
add_locked now reads the same bound the batch carves by (BatchBuilder::
plugin_words_cap, the program's declaration) and refuses an over-cap
request with RAD_E_INVAL, where the server turns it into a clean 400.
The current route caps its own words already; this is the promise no
future route can miss, checked once at the gate every request passes.
hfget screens the names a repository LISTING carries, but the shard
index is one of those listed files, and nothing screened what its
weight_map names. An index of "../../etc/passwd" led the loader to open
that path -- outside the model directory, as the serving user -- and a
directory merging two checkpoints has every reason to hold a real index.
shard_name_ok now reads every weight_map value before the first open:
no absolute name, no empty, "." or ".." component; relative subdirs,
which real repos do use, still pass. The refusal names the index and
the offending shard. A checkpoint_test case opens a poisoned index in
six shapes and the honest one once, and only the honest one reads.
The expert-profile loader summed whatever JSON numbers it found and the
planner's arithmetic read them as unsigned. A negative count read as
uint64_t wraps to a value near 2^64, which reads back as a ~100% share:
whoever wrote the file could point the pinning at any expert they named.
Under the old JSON library a negative threw its way out of here; the
facade's arithmetic read does not, so the file is now refused by name.
Every entry of a decode row must now be a non-negative JSON integer;
the offender's layer and expert are printed, and RAD_E_INVAL comes back
before a single wrapped share reaches the planner.
tokenizer.json, gen_config.json, an adapter's adapter_config.json and
the container's generation.* whitelist are all container-supplied, and
all read through the unbounded parser: a hostile file was refused only
by running out of stack -- the tree it grows is walked, dumped and
destroyed recursively on the way.
Json::parse_container is the wire's bounded read sized for files
instead: 2^24 values, because a tokenizer's vocabulary legitimately
carries a million flat strings, and 256 levels, because nothing
legitimate nests deeper. A file past either bound comes back discarded,
like a syntax error, and the four readers map that onto the failure
paths they already had -- ignore with a warning, refuse the adapter,
refuse the vocab. The bound fires during the read; no hostile tree
exists to be walked.
yy_convert enforced its value budget and depth bound in a second pass
that ran only after every frame of the document had been collected into
a scratch vector. The bound that promises a refused body has not grown
memory grew its scratch with the body: a 200k-empty-array swarm counts
no scalar at all, and the old code refused it after the whole swarm sat
in the frame list.
Both bounds are now enforced where a value is DISCOVERED -- every value
counted, containers included, which is what the pre-migration parser
callback counted and what the tests already pinned -- so a body past
either bound ends the walk while the scratch is still budget-sized. What
stays proportional to the body is yyjson's own read arena, capped by the
byte bound at its open, and oai.cpp's comment now says exactly that. A
json_test case carries the swarm.
A container's chat template is server-side attacker data the engine
parses and runs without any budget. The parser recursed once per nesting
block or paren: tens of KB of "{{ (((" or "{% if %}" in one
tokenizer.chat_template stack-overflowed whoever read it -- the
capability probe or the first render -- past every catch, and errors-
as-values cannot hold a stack overflow. And range() materialised one
array element per step: {{ range(4000000000) }} was an OOM per render.
Both entry points now share one 128-level guard whose throw is the same
exception class a malformed template already raises, and range() refuses
above 65536 values -- far past any template that exists, small enough
that the whole range stays transient. The refusals cross the ChatTemplate
seam as the error values the seam promises (a chat_test case pins that
both shapes refuse and that real nesting still renders). UPSTREAM keeps
the addition under the chat lift's record; the manifest re-hashes.
A tool schema's `pattern` reaches the grammar converter as client data,
and the group scanner recursed once per nested '(': a few tens of KB of
brackets inside one JSON string was an uncatchable stack overflow of the
request worker. The body's depth and value bounds never saw it -- the
brackets are string content, not JSON nesting -- and 0003, the patch that
made this same function survive a hostile pattern, hardened the empty and
the looping cases but never the recursing one. It is the one remote crash
in the audit, and one request is the whole attack.
transform() now counts its nesting and records the refusal once, where
every unwinding frame met the same '(' and repeated it; check_errors turns
it into the clean throw the server already answers with a 400. Proven on
the compile host against the real converter: the 20000-group pattern is
refused by name, a 40-group pattern -- far past anything a real schema
nests -- still compiles. The record keeps the addition under 0003's name,
whose footing it stands on.
Every forwarded request leased its model, and the lease fired demand for a
cold or parked one before any handler ran. On the guarded routes -- the lora
admin, /diagnostics, /reset_prefix_cache, DELETE /sessions, the control
vector -- the handler then answered 403 keyless: the wake had already asked
the scheduler for a real load, which can fetch the repository and evict
residents to make room. Loop one cheap GET over an enumerated model name and
the fleet churns for an audience that never gets an answer.
The front already knows reads that report on a model are no reason to bring
one back; the same courtesy is now owed to a request the guard will refuse.
The fleet hands the front its operator rule -- the very predicate its admin
guard reads -- and a guarded route from anyone else reads the not-open state
and stops. Open models still dispatch, keyed boxes still wake everything,
and the operator keeps the diagnostics that bring a parked model forward.
The fleet front guarded its admin routes with the loopback socket alone.
The socket is the one leg that forges: a DNS-rebinding page is same-origin
with its victim's browser and dials through loopback, and a localhost proxy
delivers remote clients on loopback sockets carrying the public Host. With
CORS open by default, a web page in the operator's browser could unload and
park any model, reload the fleet, and read the topology -- disk paths in
the body -- from outside the machine.
The three-leg rule (loopback socket, no foreign Origin, a Host that names
this box) was Server::local_operator's, locked inside Server. Hoist it to
server::local_operator(request, bind_host, local_hosts) beside the request
whose fields it reads, keep the member as the delegate it now is, and let
the fleet's guard call the very same predicate with its own config's host
and --allow-host names. One rule, two callers, no forked wording.
New models. Recursive Flint (39.8B, about 2.5B active) by everplays (#422): `arch/flint`, as an
IQ8R container with rotated int8 experts or a four-bit one, with a sink-aware WMMA prefill
attention and the fused attention prologue at `rotary_dim` 0. Meta Muse Glimmer 30B by
launch80_assets (#423): bf16, an int4 trunk or IQ8R, its windowed vision tower, its DFlash
drafter, the ATEM tool dialect and context extension. Ling-3.0-tiny by RikshaDriver (#441):
served from its GGUF releases or as IQ8R on `bailing_hybrid`, with six more libr3d kernels. Block
FP8, MXFP4 and NVFP4 conversions of the three are not served. IQ8R containers of all three
(round to nearest, no calibration) are on Hugging Face under StillDeadcode: flint-iq8r,
muse-glimmer-30b-iq8r-dflash and ling-3.0-tiny-iq8r. They were checked for sane answers on two
R9700; nothing was benchmarked, and Muse Glimmer's pictures, video and tool calls were not tried.
Speech. Breeze-TTS-2 clones a voice from a reference recording and its transcript, with an
optional delivery direction, by farcryjohn (#436). The published Breeze container needs
converting again with the updated recipe before it can.
Tools. A model entry with `diagnose: DIR` runs a fixed workload on the engine instead of serving
and writes a report: step times, tokens a step, draft acceptance, TTFT and prefill rates by
category, concurrency and prompt length, and with `diagnose-baseline` a token-for-token comparison
against an earlier report (docs/DIAGNOSE.md), by Code000 (#418).
Scheduler. `mixed-step-target-ms` holds a mixed prefill and decode step to a service time, off by
default, by tnhnyzc (#413). `scheduler.stuck-exit` (60s by default, 0 never) ends the process when
the device has advanced nothing for that long, so a restart policy brings a hung server back
(#409, #415, #428).
Fixed. Draft trees with the int8 KV cache, which stopped Gemma 4 31B with DFlash2 on its first
request (#454, diagnosed by aelfwyne). The expert loan held at zero by a few leftover cache blocks
after long sessions (#455, diagnosed by thekk1). The mapped tier's pages kept in the page cache
across a load and a restore, by C_Tamas (#421). Replayed tool calls with blank arguments, and
arguments that are not JSON refused naming the call, by dschmitz (#444). The dashboard's card
temperature reads the junction sensor, by dschmitz (#453). The VRAM shortfall report says what the
KL mode needs, by baKon (#448). The out-of-tree plugin test builds its plugins in parallel and
takes its toolchain from the tree.
Plugin ABI 40: out-of-tree plugins need to be rebuilt.
Thanks to @everplays, @launch80_assets, @RikshaDriver, @farcryjohn, @Code000, @tnhnyzc, @C_Tamas, @dschmitz, @baKon, @aelfwyne and @thekk1.
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.
gemm_w4a8i8_tiled / gemm_w5a8i8_tiled ran one 256 x 64 tile, built for
2048-row prefill chunks. At decode row counts its time is the weight's
trip through the block and is flat in M (N=5120 K=17408: 272 us at
M=32, 284 at M=256): a 128-row step computes half padding, and N/64
blocks (80 at N=5120) leave most of an R9700 idle.
The kernel is now templated on its tile (TM x TN fragments a wave,
WM x WN waves a block), with the body unchanged, and the rows gain one
tunable axis, `arm`: 0 is the prefill tile (the old constants, so an
untuned install runs the same kernel), 1-8 are 128-, 64- and 32-row
tiles. tools/opshapes.cpp describes the int8-activation operands so
rad-tune can walk the axis, and r4d_selftest checks every arm against
the host reference for int4 and int5, with ragged M and a partitioned
weight; --perfwpa takes R4D_PERF_ARM.
Tuned on an R9700 at the trunk shapes of Qwen3.8-27B ParoQuant int5
(rad-tune, us, arm 0 -> the tuned arm):
shape M=32 M=64 M=128
N=16384 K=5120 258 -> 72 229 -> 97 233 -> 151
N=5120 K=6144 101 -> 38 101 -> 42 101 -> 62
N=34816 K=5120 497 -> 217 494 -> 234 504 -> 309
N=5120 K=17408 273 -> 89 275 -> 103 277 -> 168
N=12288 K=5120 167 -> 52 167 -> 72 168 -> 112
N=1024 K=5120 36 -> 21 36 -> 22 37 -> 24
The prefill band (M=2048) keeps arm 0. Which rows reach this kernel is
unchanged: the qwen35 plugin still hands the rotated int4/int5 linears
to it above 64 rows, so the M=32/64 columns only bound what a lower
handover could gain.
The int4 rows share the kernel and gain alike (int4 x int8 at M=128,
arm 0 -> best: N=5120 K=17408 267 -> 150 us, N=34816 K=5120 444 -> 248,
N=16384 K=5120 211 -> 118, N=12288 K=5120 160 -> 91).
End to end, Qwen3.8-27B ParoQuant int5 + DFlash2 on one R9700 (k6_v4
cache, f16 state, depth 3, 32 sequences of ~3k shared + ~2.5k unique
prompt, 3000 tokens out, so 128-row verify steps), against origin/main
on the same boot and tune cache: mean decode step 111.0 -> 93.8 ms,
decode 467 -> 614 tok/s, wall 345 -> 418, no preemptions. Decode at up
to 64 rows (one to eight sequences at depth 7) and prefill (arm 0) run
the same kernels as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019BxxGmKGSAyx2h88G3sEGp
--expert-stats (merged) writes per-layer expert selection counts. Reading
them one number at a time hides the thing that decides where bits go: a
layer's total is the same at every layer, because top-k routing spends
the same number of selections whatever it picks, so the totals rank
nothing. What differs is the concentration inside a layer and whether
decode and prefill disagree about which experts matter.
Prints per routed layer the top-5/10/20% share, the Gini coefficient, the
experts never selected, and decode against prefill (each one's top-20%
share, the share of decode landing on prefill's top-20%, Jaccard and TVD),
then a skew verdict. The self-check line compares each layer's selections
with its observed tokens x top_k, exact unless the drain lost histograms.
No argument about which layer deserves more bits is made here; the report
is the evidence a person (or a search) spends them against.
Nanbeige4.3-33B is 56 query heads over 8 KV heads at head_dim 128: seven queries a KV head, the
same ratio at one rank and at two. The gqa-8 unit cannot express it -- its decode body holds 64
rows of q_len * gqa, and 64 is not a multiple of 7 -- so instantiate the shared body at 21
warps: 336 rows, the same 48 query positions a block as gqa 8, and a 63-row decode cap (nine
query positions). Four rows: prefill and decode over bf16 and fp8-e4m3 KV.
The gqa-8 defaults stay as they were. G8_MAX_DECODE_ROWS, G8_P_NWARPS and G8_P_TILE become
#ifndef guards the including unit can win; nothing changes for gqa 8, which is the only other
unit including this file today. The rows state the ratio and both bounds, so a verify wider than
nine query positions takes the prefill kernel.
Without this no checkpoint with that geometry serves at all: declare names no row for it, and the
server stops in startup with nothing selected for attn_paged.
Tested against the model's own releases, which need no change to the engine. llama.cpp 0.9.0-dev
on the same two Radeon AI PRO R9700 measures 1192 tok/s prefill and 23.1 tok/s decode:
official FP8, TP=2 34 GiB 4014 tok/s prefill 33.3 tok/s decode
official INT4, TP=2 20 GiB 3677 tok/s prefill 53.2 tok/s decode
official INT4, TP=1 20 GiB 2355 tok/s prefill 29.6 tok/s decode
On the FP8 release (compressed-tensors FP8_BLOCK, imported as it ships), 17 * 23 -> 391, 9.11
against 9.8 -> 9.8, 100 - 9 -> 91, every one ending on eos, matching llama.cpp.
The INT4 release does not import as it stands: it carries u4*bf16[1x32]-u4[1x32] while these
linears read u4*f16[1x128]-u4[1x128], so a recipe re-blocks it onto the served grid, which
measures 9.5e-02 relative Frobenius (both grids are four bits, so the bytes are the same and only
the scales move). The answers stay right at that error, and moving about half the bytes a token
it decodes faster on the coarser codes than fp8 does. At 20 GiB it also fits one card.
A Q5_K_M GGUF of this model is no use as a way in: it wants an arch plugin and a conversion of
values that are already quantised, and even then the same questions come out 7 * 3, 9.1 against
9.1 and 10 - 9. The two releases above are the way in; nothing here depends on the GGUF.
Also: the gqa 7 rows against libref on the real 33B weights, 216/216 cases, and rad-kbench -m
with every fusion byte-identical (worst rel-L2 2.08e-3).
The old decode looped over a subnormal's shift, so every fp8 staging loop diverged on gfx11. Normals
re-bias the exponent (+120), a subnormal m is exactly m * 2^-9, S1111111 is the NaN: bit-identical on all
256 codes (the old form is kept as e4m3_to_f32_ref for the check). W7900: the fp8-KV prefill attention
tile 71.6 -> 67.3 ms at 30K keys, output unchanged.
e8_scan_once used hipHostGetDevicePointer to decide whether the host can read the e8 plane. It succeeds
for device memory on a large-BAR discrete GPU, so the host byte-scanned VRAM over PCIe (~12 MB/s measured
on a Radeon Pro W7900: 8 s for a 34816 x 5120 plane), and the 16-entry cache was smaller than a DFlash2
drafter's ~36 MXFP4 planes, so every issued pass rescanned most of them -- 70-120 s first requests and
~1 tok/s decode at long context. Scan only host memory (hipPointerGetAttributes), unbounded seen-set; the
kernel's e8 guard already gives reserved values the scale zero in device planes.
The served default --prefill-interleave auto:1 (previous commit) follows measured step times, so the
four sequences of preemption_by_recompute_continues_each_stream_exactly sometimes never overlapped
enough to preempt and the test's CHECK(n > 0) failed in about half the runs under a loaded host
(plain main: 6/6 pass). The cases are sized for the fixed schedule they were written against;
small_pool_args() now pins it. Nothing they check is loosened: the streams must still match and
preemption still happen. With the flag: 6/6 alone and 3/3 beside 40 busy threads, and the case
takes 3 s again instead of 5-12 s.
Cause: with --prefill-interleave 0 every step carries a chunk while a prompt prefills, so a
sequence already decoding gets one token group per chunk step. On Qwen3.8-Flash-Next fp8 (TP2,
MTP 3 drafts) with 8 sessions decoding while 64K-token prompts prefill, that is 12.3 tokens/s a
session against ~83 alone; with 4 such prompts at once, 5.4.
Change: not given, engine bring-up now serves --prefill-interleave auto:1: after a prefill chunk
that ran beside decoding sequences, decode-only steps follow for as long as the chunk step took.
--deterministic keeps 0 (a schedule that follows timing is not reproducible), as do KL mode and
generators (nothing decodes beside a prefill there); an explicit --prefill-interleave N|auto[:SHARE]
wins. Startup names the decision with its reason. The Config default stays 0, so a Scheduler built
directly (tests) keeps today's schedule; Config::prefill_interleave_set records the flag.
Evidence (decode tokens/s a decoding session / aggregate prefill tokens/s / TTFT), 8 sessions
decoding beside 64K prompts:
--prefill-interleave 0 12.3 / 3,664 / 17.3 s
auto (0.25) 23 / 3,181 / 20 s
auto:1 40.9 / 1,823 / 35.5 s
auto:2 50 / 1,166 / 56 s
with 4 concurrent 64K prefills: 0 5.4 / 2,934 / 64 s; auto 14.8 / 2,545 / 74 s; auto:1 33 / 1,395 /
137 s. auto:1 roughly triples a decoding session's rate for twice the prompt's time to first token.
BetterBench quick (short prompts, concurrency 1/2/4/8) shows no reliable difference between 0 and
auto: a short prompt is one chunk, after which nothing is held. config_test: the flag records that
it was given.
Cause: the device measurements of --prefill-interleave were taken with sessions already decoding
when the long prompts arrive (8 decoders beside 64K prompts); the simulation only had the burst's
own prompts, which decode after their first token, and could not set auto's share.
Change: SIM_DECODERS sequences of 64-token prompts (SIM_DEC_OUT tokens each, default 4096) decode
for 16 steps before the burst arrives and count as decoders while it prefills; the run ends with
the burst's last prompt. SIM_SHARE is auto's share (SIM_IL=-1 SIM_SHARE=1 is auto:1). The summary
adds the decoders, the steps that carried a chunk per checkpoint interval prefilled, and prints
the interleave as given (N or auto:SHARE).
Evidence: RAD_SCHED_SIM=1 SIM_N=1 SIM_LEN=65536 SIM_DECODERS=8 SIM_SEQS=16, SIM_IL 0 / auto /
auto:1 / auto:2: TTFT 17 / 20 / 33 / 51 s, decode while the prompt waits 9.7 / 17.0 / 37.0 / 47.1
tokens/s a sequence, against the device's 17.3 / 20 / 35.5 / 56 s and 12.3 / 23 / 40.9 / 50
(Qwen3.8-Flash-Next fp8, TP2, MTP 3). SIM_N=4: TTFT max 56 / 67 / 109 s at 0 / auto / auto:1,
decode 6.7 / 15.6 / 34.5, against the device's 64 / 74 / 137 s and 5.4 / 14.8 / 33.
auto gave decode-only steps a fixed quarter of a chunk step's time. On the device (8 decoding
sessions beside 64K prefills, MTP on) that left decode at 23 tokens/s a session against 83 alone,
with 0.45 s gaps: two or three decode steps of ~40 ms per 0.45 s chunk. auto:SHARE makes the share a
choice (0 < SHARE <= 4); auto stays 0.25. The cap on decode-only steps rises from 16 to 64 so a
larger share is not cut off. config_test parses it, sched_test checks auto:1.
Cause: scheduling policy for many long prompts arriving at once (how chunks share steps,
admission, decode rows beside chunks, interleaving) was judged on the device only, where a
run of 32 x 128K prompts takes 40 minutes and the device is shared.
Change: sim_burst_of_long_prompts drives the real Scheduler through such a burst (prompts,
decode with three drafts a step, the stager floor, --prefix-resume exact) and times each
step with a cost model whose defaults are fitted to Flash-Next at TP2 (a lone prefill and
decode alone). It checks nothing and returns at once unless RAD_SCHED_SIM is set; the
workload, the flags and the model's terms come from SIM_* variables (see the comment).
Evidence (defaults, 128K prompts, 512 tokens out): the schedule keeps ~1984-2048 prefill
tokens in nearly every step at 4, 16 and 32 prompts (two prompts share a step at 1024 each
until the first decodes, then a chunk of 2048 less the decode rows with the next prompt
filling the rest), so the model predicts ~5.1K tokens/s aggregate at every burst size:
TTFT p95 100 / 412 / 814 s at 4 / 16 / 32 prompts against the device's 158 / 966 / 2456 s.
The gap grows with the burst size, so it is the device's cost of the steps a burst runs
(two-sequence and mixed steps), not the number of tokens the scheduler plans per step.
Cause: while prompts prefill, a sequence that is already decoding gets one token group per
step that carries a chunk. On Qwen3.8-Flash-Next at TP2 such a step takes a 2048-token
chunk's time (~0.4 s, more on the device under load), so decoders crawl at a few tokens/s
until the queue of prompts drains. --prefill-interleave N inserts N decode-only steps after
each chunk, but a fixed N costs the prefill whatever N decode steps cost, which grows with
the number of decoders, and is too few where decode steps are cheap.
Change: --prefill-interleave auto (default stays 0). After a chunk that ran beside decoding
sequences with its prompt continuing, as many decode-only steps follow as fit in a quarter
of a chunk step's time at a decode step's (running means of both, fed by step_finished from
the step wall times; at most 16; 1 until a decode step has been timed; 0 where a decode step
costs more than that quarter). The prefill gives up at most a fifth of its rate however
many sequences decode. The hold mechanics (no admission while held, steps issued ahead
count, the stager not armed for a held chunk) are --prefill-interleave N's, unchanged.
Under auto which steps carry a chunk follows the device's timing; a number keeps a
reproducible schedule. A chunk's cut and every row's computation are unchanged.
Evidence: sched_test interleave_auto_* (the count from given costs, the step shapes it
produces, nothing held for a lone prefill or when decode steps are too dear); config_test
parses auto. Host simulation of the scheduler (next commit), 32 x 128K prompts sent at
once, 512 tokens each, MTP 3, step costs fitted to a lone 2048-token prefill and to decode
alone: decode of the sequences decoding while prompts wait 6.5 -> 31 tokens/s each, last
first token 826 -> 875 s (+6 %), TTFT p50 453 -> 480 s; fixed N=2 gives 18 tokens/s at
the same cost. Device numbers: the commit that makes auto:1 the served default.
The layout rule chose the width split at four ranks and up before it knew the
weights' format. MoeFP8 refuses to slice a plain bf16 expert, so a container
of bf16 experts, or of MXFP4 with protected bf16 ones, that main serves at TP4
was refused unless --weights-disk-tier was set.
Read the container's encodings first, on every rank alike, and take the width
split only when every routed expert is MXFP4. The check declares no name map,
so no pinned graph moves.
Whole experts on their rank let the routed weights live on the drive, which
a two-card host needs, but at four and eight ranks they leave the shapes the
MXFP4 kernels are tuned for: glm_prefill wants 288 experts an op and finds 72.
On 4 x R9700 that cost prefill two thirds and four-stream throughput 37%.
Keep the width split at four ranks and up, as the kernels expect, and take
whole experts at two ranks or when --weights-disk-tier needs them (ABI 37,
RadBuildCtx::expert_file_tier). The file tier's graph at eight ranks keeps
main's pin, and the route-count fix that came with expert parallelism stays.
At TP4 the launcher fell back to the expert-major form for every decode step. The small-M form
now takes gate_up from 9 to 384 routed rows (past one token's 8, where it reads 5 % slower) and
down up to 384 at the K256 x4 tiles. perfmx --perfmx-tp 4, cold, gfx1201, output byte-identical:
gate_up 3 to 18 % faster from 2 to 48 tokens, down 37 % at one token and 4 % at 48.
Served at TP4 with --vision-tower-placement ram, BetterBench against the same tree without it:
decode 52.3 -> 55.7 tok/s, 1/2/3/4 conversations 49.8/73.5/85.6/91.1 -> 52.7/76.5/90.0/96.4,
prefill unchanged. Temp-0 replies identical, needles 8/8 at 4 x 119k.
r4d_moe_mxfp4_pin_small takes the small-M form where the rule does not (any GLM slice up to
384 routed rows, at either tiling) or keeps it off. r4d_selftest --perfmx-tp 4 times GLM's TP4
slices, gate_up 1024 x 4096 and down 4096 x 512, the rule's form beside the pinned ones, and
fails if their outputs differ by a byte. The rule itself is unchanged.
A prefill chunk past the row threshold split the indexer over the ranks
even when every row's history fit the selection, so it scored rows whose
selection was already decided and gathered the result. Such a step now
takes the unsplit take-all path on every rank: zeros into a plane of its
own, [max_tok, topk + 1] (the score plane holds only a run of rows where
a step may split), and a selection over the whole step, with no query
side, scorer or gathers.
Temp-0 replies byte-identical to the scoring path; 114/114 tests.
The fixtures' sixteen- and eight-column tables reach fewer blocks than the
selection, so their steps now take all (DsaCache::takes_all). Where a test is
about the scored path, its batch carries enough history to score; the steps
that take all assert that no query side or scorer runs and that the selection
reads the fill. The pinned graph adds the fill.
With topk or fewer live blocks a row, qsa_select takes every live block in
block order whatever the finite scores, so the query projection, its copy,
the head gates, dsa_query and dsa_score decide nothing. Such a step fills the
score columns with zeros instead; the key side still runs, so the index cache
stays current. The decision reads the host bound splits() reads, so every rank
and every recorded pass agrees. Split steps keep scoring, since their
selection's rebased bounds come off the scorer.
dma_read takes the end of the last finished list from ends[k % kDmaEnds]. The lane can have
more than kDmaEnds lists behind the engine (the prefill stager and the mover queue far more
than the prefetch's three), and once a later list has taken list k's slot that value would
overstate what the engine has read, letting the host write over a part of the ring not yet
read. The slot is now used only while fewer than kDmaEnds lists are behind it.
The check also keeps the most it has known read, so a list number it can no longer use does
not send it back to a stale written-back read pointer and wedge a ring that has room.
GUIDE.md no longer says glm5next refuses --kv-cache-dtype fp8: it narrows the latent-attention
cache alone. ARCHITECTURES.md's KV group table gives kv_latent's E4M3 form and its host-tier size.
The plugin refused fp8. It now takes bf16 or fp8 and applies it to kv_latent alone: Geom::kv_dtype
is the configured cache dtype, kv_latent is declared in it, and GlmMla's kv_store and
kv_store_streamed name it, as does every mla_attn over the latent (head form, row form and the
MTP layer's), which then resolves to the fp8kv rows. The store keeps kv_store's default descale of
1, which the attention reads, as vLLM's fp8 cache does. kv_index_tail, kv_dsa_index and the KDA
groups keep their dtypes; the indexer reads only the latent group's tables. Host-tier, streamed
and replicated sizing follow the group dtype already. Under bf16 the attention states no
kv_dtype and the graph is the one declared before.
At 4 x 262144 tokens the latent cache is 12 layers of 512 bytes a token instead of 1024.
glm5next_test: fp8 declares the latent group E4M3 and the other four unchanged, every latent store
and attention names fp8_e4m3, and bf16 (stated or default) leaves the attention without kv_dtype;
the refusal test now refuses f16.
mla_check states kv_dtype fp8_e4m3 for an *_fp8kv row and fills the cache with E4M3 codes over most
exponents, subnormals included; libref reads the same codes. Cases per twin cover its kernel forms:
the wave row, the matrix row's pairings (union, positional, element-wise load) and the rows row's
forms (rule, pinned rows kernel, element-wise load, 32 heads a workgroup).
Both schemas take `kv_dtype` beside `dtype`; libref's shape gives the cache operand that dtype when
it is named, the query's otherwise. The kernels already read the cache through ldt, so an E4M3
cache is read as its codes' values. ref_test covers an E4M3 cache under a bf16 query.
mla_attn takes an optional `kv_dtype`; at fp8_e4m3 the cache is E4M3 as kv_store_fp8 writes it at its
default descale of 1. mla_attn_fp8kv, mla_attn_matrix_fp8kv and mla_attn_rows_fp8kv are the bf16
rows' kernels with the cache element as a template parameter: the key load decodes E4M3 to bf16
(v_cvt_pk_f32_fp8, then the high half), which is exact since every E4M3 value is a bf16, so the
tiles and all arithmetic past the load are the bf16 instance's. The twins carry the bf16 rows'
constraints plus kv_dtype fp8_e4m3 and rank above all three bf16 rows, in their order. At uint16_t
the loads are the plain loads the bf16 kernels made; their launchers still refuse any cache that
is not bf16.
r4d_emu test_mla runs every kernel form (wave, matrix and its element load, rows forms 0-3) on E4M3
codes against its bf16 instance on the decoded cache: bit-identical on all 23 form/case pairs, and
each launcher refuses the other cache dtype.
A preempted request waiting for its whole-recompute gate (kAdmitWait) let the admission walk ask the
next request in the queue. For an overdue one that undoes the overdue path: the room it made in this
step went to a request queued behind it. With preempted prompts published, the victim forced off for
it needs almost nothing to come back, so it was re-admitted at once and forced off again on the next
step. Under KV pressure the same victim was forced off and re-admitted 26 times in 16 s while the
overdue request waited. An overdue preempted request that is still refused now stops the walk, as a
refused fresh request already does.
2x R9700, Qwen3.8-Flash-Next TP2, production flags with the KV cache cut to 6.45 GiB a card
(--gpu-headroom-mib 3072), 16 concurrent 58.6k-token prompts with 4000-token answers:
- without publishing preempted prompts: wall 390.6 s, mean 338.5 s, 9 preemptions, 1 forced
- publishing them: wall 346.4 / 344.1 s, mean 306.6 / 299.8 s, 36 / 32 preemptions, 28 / 26 forced
- publishing them, with this change: wall 331.0 / 324.4 s, mean 289.4 / 284.0 s, 8 / 9 preemptions, 1 / 1 forced
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On an idle engine the overdue path failed a preempted prefill on any refusal. A restore waiting a step
for a deferred release is a wait, and so is a refusal behind requests this step already admitted (the
budget or a card went to them); both clear by the next step. With preempted prompts published, the
restore path is common: under KV pressure two of ten preempted requests failed with "overdue
preempted prefill could not be admitted with nothing running", the debug log showing "the restore
waits a step for 1 deferred release(s)" right before. The path now fails only when nothing was
admitted this step and the refusal is not such a wait.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scheduler::preempt_back dropped everything a request had computed: unlike
close_request it published nothing, so a preempted 96.6k-token prompt was
computed again from its first token. The publish block of close_request is
now Scheduler::publish_prefix, called by both. Its blocks stay in the cache,
so a preemption that published gives eviction its rounds back (the decode
ensure loop and the overdue path) and the cache gives them back, the newest
last, before another request is preempted. preempted_can_prefill counts the
blocks the recompute adopts from the cache (pc_->lookup), so a preempted
request is not held back for room its own cached prompt already covers.
Shared KV with RADIANCE_KV_GUARANTEE=1 (nine Qwen requests preempted for
TranslateGemma's start pool): Qwen 587 -> 458 s, TranslateGemma 139 -> 80 s;
without the guarantee unchanged (340 / 58 vs 339 / 56). Test:
a_preempted_request_publishes_its_prefix; sched 187, engine_e2e and the
related suites pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The launcher passed a->stride[0] straight as the byte pitch, but strides are
in elements (abi/rad_types.h): an int4 row of K nibbles is K/2 bytes. The
kernel read row 2*src instead of row src (row 0 correct, every other row from
the wrong source, and past the plane for larger M). The weight side already
converts (r3d_tab_of's s0 = stride*bits/8, the kernel uses w_ld/2); the
activation now does too. The libref reference had the same bug and is fixed on
the w4a4-libref-wip branch, so the two now agree on the correct row.
Missed because r3d_selftest checks finiteness only and ref_test checks status
only on the libref sweep geometries.
Two layout bugs found in pre-PR review:
1. ref_moe_gemm_w4a4 treated A->stride[0] as a byte pitch. Strides are in
elements (abi/rad_types.h), and an int4 row of K nibbles is K/2 bytes, so
the reference read row 2*src instead of row src (and ran past the plane
for M > ~4). The weight side already converts (w_ld / 2); the activation
now does too. The kernel has the same bug (separate libr3d fix).
2. ref_dequant_w4_shape declared wq as {N*K/8} I4 elements = N*K/16 bytes,
but the packed plane is N*K nibbles = N*K/2 bytes (the kernel and the
reference both read N*K/8 dwords). Declared extent is now {N*K}.
Both were invisible to the harness: ref_test checks status only, and the
64-byte poison margin absorbed the over-read at sweep sizes.
Four moe_gemm_q geometries (dtype w4a8 and w4a4, token- and sorted-order a) so the
w4a8/w4a4 reference GEMMs run against the kernels, and a dequant_w4 geometry at
K=128/group=128 with twos=0 for the zero-point decode arm.
libref side of the w4a4 work; the libr3d kernels ship separately (submitted as PR 403).
- ref_moe_gemm_w4a4_shape; ref_moe_gemm_w4a8_shape now N_odd/K_odd-aware (ref_shapes.cpp)
- dequant_w4 schema with pDequantW4/oDequantW4 (ref_registry.cpp)
- ref_dequant_w4 zero-row guard (ref_quant.cpp)
- w4a4 reference GEMM and op declarations (ref_moe.cpp, ref_ops.h)
- dequant_w4 in kOps plus sweep geometry (tests/ref_test.cpp)
The canonical sample_logprobs schema declares params optional (an absent
optional operand arrives as null data, rad_abi.h), and libr4d's kernel
already honours that (no params = every row). libr3d's launcher refused a
null params and its kernel dereferenced it unconditionally, so since the
canonical schema went optional (3b278dc) the engine refuses the whole
libr3d plugin at load: op 'sample_logprobs' has two different schemas.
Mirror libr4d: the kernel's flag test gains a null guard (no params:
every row runs), the launcher no longer refuses null, and the row's spec
marks the operand optional.
pass_key() answered 0 for every draft and verify pass, and with a callback present the core neither
records such a pass nor gives its launches the keyed context bound, so with the MTP drafter nearly
every decode pass was issued op by op (1.17.0: 206 passes played and 508,236 issued unkeyed, where
1.15.1 played 492,894). Dropping the export would record them with the cores bucketed bound, which
The kernel and launcher (libhalo's, r3dh_gdn_recurrent_update.hip) have
been in the tree since 1.16.0, but no row referenced them, so the op
always landed on libavx's CPU row. Register them:
- the op's schema (12 params, 18 operands: the convolution's inputs,
then the recurrence's minus q, k and v, which the fused kernel never
materialises), identical to libavx's and libref's;
- the constraint set: q_len >= 1, head_k 128, head_v 128, conv width 4;
- the row at R3D_PRIO_ONLY, NOTUNE (one kernel configuration), no
layout hooks;
- the selftest case (hand-built, as the sibling GDN rows): T=4, Hg=2,
H=4, K=V=128, window 4, state f32; o_q and o_scale absent;
- the README row, the table count (111 rows over 72 schemas) and the
decode-path prose.
rad-schemas over the four libs: 244 shared ops, 0 disagree (the new
schema matches the canonical registries). gfx1102 (RX 7600):
r3d_selftest 118 rows / 0 failed, the new row runs with 8 output
planes finite; ref_test 153,146 checks / 294 cases / 0 failures.
moe_gemm_q w4a8: the 2-class MoE GEMM with bf16 weight scale and bf16
output. E4M3 activation codes, bf16 weight scale (not f32), single
16x128-block i32 wave-matrix config. The w4a8 dtype row is folded into
the existing moe_gemm_q op as a dtype variant, not a separate op.
moe_gemm_w4a4: the 2-class MoE GEMM with int4 activation codes and
int4 weight codes. i32 wave-matrix core (no E4M3 decode table),
symmetric int4 x int4 multiply-accumulate. Single fixed 16x128-block
config.
moe_gemm_q_mod4: the 4-class MoE GEMM. Experts route to class e%4
(entry e/4 within the class). Same E4M3 wave-matrix core as
moe_gemm_q_e4m3, with 8 individual R3dTab parameters (4 weight + 4
scale tables) to stay within the gfx1102 kernel parameter limit.
dequant_w4: packed int4 weight to row-major bf16. Each 32-bit word
holds 8 int4 codes; the scale is f16 in the low 16 bits, the zero
point is -(1024+zero) as f16 in the high 16 bits. One warp per 32
output elements.
row_topk_merge: top-R of gathered per-rank candidate sets. Each rank
contributes a sorted candidate list; the merge selects the top-R
global candidates by score. int32 ids are bit patterns in an f32
plane (memcpy, not cast).
ngram_ids: hashed n-gram row ids for PLE (Per-Layer Embedding).
Computes the row index for each n-gram in the sequence using a
FNV-1a hash folded into the embedding table size.
gemm_nt_q_bias: narrow fp8 GEMM (M <= 16) with per-column bf16 bias
fused into the epilogue. The bias is added to the f32 accumulator
before the single bf16 narrowing at the store. Extends
r3d_gemm_nt_q_fp8_ex with a bias parameter.
gemm_nt_q_short: narrow fp8 GEMM (M <= 16) for short-prompt decode,
unsplit K. Forces sk=1 (no K-split) in r3d_gemm_nt_q_fp8_ex. The
short-prompt path avoids the K-split overhead when K is small.
The two narrow fp8 rows carry the tGemmM16 tune matrix (sk 0/1/2/4/8/16,
wv 1/2/4/8, nt, the two E4M3 decode impls, 16-row tiles) like the other
gemm_nt_q rows, measured per card by rad-tune.
The six new ops adopt the canonical op schemas. The engine enforces
schema identity across kernel libraries: the first library to declare
an op fixes its schema, and a disagreeing plugin is refused whole at
load. libavx loads first, so the specs match the canonical registries:
- moe_gemm_q_mod4: 15 params / 13 operands (the eight weight tables at
the RAD_OPD_WTAB role); the launcher reads a_order (token/sorted),
requires group = 128, checks the activation's row count against the
output, and refuses unequal class shapes (N_1..K_3 differ from N/K)
as moe_gemm_q does with N_odd/K_odd.
- ngram_ids: 4 params / 11 operands under the canonical names; state
required; per, W and the ids pitch derive from the operand shapes.
- row_topk_merge: 4 params (+dtype) / 3 operands.
- gemm_nt_q_short: the family's four optional params (pb1, pb2,
split_n, w_rb) and two optional operands (a_sum, b_ref).
- gemm_nt_q_bias: a_scale required, not optional.
- dequant_w4: the dtype param, twos required, the scale operand named
ws; the launcher refuses zero rows with RAD_E_SHAPE like every
other op.
A kernel audit found five launcher param reads the engine can never
populate (the spec's params plus the row's tune axes are the only
sources): pb1/pb2 in the gemm_nt_q_bias launcher, splits in the decode
attention path, and nt/kb/sk in the tiled rows that tune only impl.
Each always took its default; the reads are deleted, behavior-
identical.
All 8 verified bit-exact on gfx1102 (RX 7600, box card 2).
Selftest: 117 rows clean, 0 failed. rad-schemas over libavx, libr3d,
libr4d and libref: 244 shared ops, 0 disagree.
The emulator test reads the plain launch's kernel name (tests/r4d_emu/test_qsa.cpp), and one launch
choosing between the two kernels spelled the choice instead; r4d_emu_qsa and r4d_emu_qsa_sweep
failed on it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The probe sets chain_pays, as the Gemma 4 DFlash drafter does, so the engine chains the
speculative step's launches on the AQL backend (the chained forms of the previous commit).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every kernel of Flash-Next's speculative decode step gets a chained form (r4d_chain.h), so the
step's small launches wait on their predecessor on the card instead of behind a queue barrier:
the router and the fp8 and four-bit expert GEMMs, the gated quantisers, the delta-net recurrence
and conv, the hyper-connection write and its all-reduce gather, the attention layer's indexer,
norm/rope/gate, quantiser and gqa6 decode rows, and the tiled and fused hc_read kernels. A
chained form is taken only at steps of up to 32 token rows (kR4dChainMaxRows); above that the
waiting blocks hold room a wide predecessor needs.
hc_read at one to sixteen decode rows (hc 4, n 2560, E4M3 mixing matrices, inject gains), the
shape Flash-Next calls 97 times a pass:
- form G (1..8 rows): kernel A' as (16-column tile, stream) blocks, so a block reads its W_down
slice once for every row of the step; the slice and the norm gain load before the chain wait,
the dots are bf16 WMMA, and the last of a tile's blocks sums the streams in ascending order.
- form S (9..16 rows): as G, but the norm's scale is applied after the dot, so N never sits in
LDS and one block holds every row.
- kernel B3 (both forms, lr 320): the up product as WMMA over d with W_up's exact quarter
scales, and the mix in each lane; W_up loads before the chain wait.
From 17 rows the tiled path (now chained) stays faster.
The new forms are not byte-identical to the kernels they replace: the bf16 WMMA dots sum in
another order and S scales after the dot. Against an fp64 host reference, d is as close as the
per-row kernels' at 1..7 rows and closer than the tiled path's at 8..16 (mean error 0.13-0.14 %
of the row's RMS against 0.17 %, max 1.2-1.4 % against 1.3-2.0 %). The selftest's decode-forms
case now holds d to that reference (no further from it than the two-grid form) and x to the
two-grid form within rounding up to 16 rows, and stays byte for byte above.
Flash-Next on 2x R9700, sampled at temperature 1, 25k prompt, 500 tokens, two rounds of
1/2/4/8/16 streams: MTP depth 3 174/291/458/657/851 -> 207/339/493/647/843 tok/s; with depth 5
and the adaptive window 191/331/493/661/897 -> 218/355/494/662/893.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
attn_verify_bits_case ran three contexts. The sweep runs every context from 40 to 300, then the
page edges up to 2048, at 2, 3, 4, 5 and 8 verify rows, for the gqa16 (bf16 and fp8 KV) and gqa8
rows. One line a verify width; a failing context counts. It found the merge difference fixed by
the previous commit. Past 2048 keys a verify of more than 32 rows is cut differently from a decode
by design (r4d_decode_splits), so the sweep stops there.
The decode kernel cuts the tiles of the launch's context into segments, and the merge read all of
them for every row of a verify. A row that ends in an earlier tile than the last row therefore
merged a different number of segments than its single-row decode, and the merge's chains take the
tail differently (the last u mod 4 segments go to chain 0), so the sums associate differently. At
contexts of 16k+1 keys the two-row verify differed from its two decodes in the last bit; with
eight rows 75 of 867 contexts between 40 and 2100 did (gqa 16, bf16 KV), and the same at gqa 8 and
for the fp8 KV. Greedy text with the drafter left the text without it from such a step on.
The merge counts a row's segments from the row's own causal context. Windowed rows, non-causal
rows and tree verifies keep the launch's count, and a plain decode is its own row, so nothing but
the verify rows of causal rows changes.
The chain acceptance checks hrow = rtok + accepted; the tree acceptance checks the row of the last
node on the accepted path (rows are nodes, in order; the root when nothing is accepted), over the
same random trees and end-of-generation cuts.
data/kernels_nemotronh.rkb holds 1009 cases recorded from the 74B skeleton (host only). With
kernels.rkb the report reaches 188 of 1031 rows (134 before), among them the gqa16 attention
rows, and 5226 cases pass.
The per-library header "N row(s) not reached" was matched as lib\w+. A plugin library such as
spechub has a table of its own; its rows were counted into the library above it, and the headline
sum came out six short. The pattern is \w+ now. docs/KERNELS.md lists spechub from this run.
The h128/gqa16 decode row stopped at q_len 4 (64 query-head rows a workgroup), so LiLiCorr's
verify of 7 drafts and the anchor (q_len 8) ran the query-tiled prefill kernel while a plain decode
runs the split-KV one: no verify row was the single-row decode at its position, and greedy text
with the drafter left the text without it within a few hundred characters at one and two ranks.
The gqa16 unit raises G8_MAX_DECODE_ROWS to 128, which compiles an eight-wave arm into the gqa8
body's decode launch; gqa8 and every other unit compile as before. The rows take q_len <= 8.
Selftest: the numeric cases at q_len 8, and attn_verify_bits_case, eight verify rows against eight
single decodes bit for bit at 120, 700 and 2048 keys (gqa 16, and gqa 8 for four ranks).
docs/ARCHITECTURES.md: past 2048 keys the split law partitions a verify and a decode differently,
so a near-tie can still flip greedy text.
nemotron-3.5-bolt-74b-w4a8.yaml (--tp 2) and nemotron-3.5-bolt-74b-fp8.yaml (--tp 4): 8 sequences
of 65536 tokens, LiLiCorr at 7 drafts, a bf16 KV cache, as the containers were measured. The
README's model table and docs/DOCKER.md list them.
Every block linear and routed expert as block FP8; or the routed experts at w4nl64a8h (GPTQ
against $CALIB, rounded to nearest without it) and the rest block FP8. Both carry the LiLiCorr
drafter's linears when it is merged.
NVIDIA's Nemotron-H hybrid from its bf16 checkpoint: 40 Mamba-2, 40 latent-MoE and 8 NoPE attention
blocks, the LiLiCorr drafter (7 drafts a step) and the C-RADIO tower with its projector, at one, two
or four ranks. docs/ARCHITECTURES.md describes the model. nemotronh_test: the drafter's KV heads at
two and four ranks, a speculative step at four, and the arena's sizing declares.
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.
Config::lili runs DFlash2's backbone with attention sinks and leaves the head to the plugin;
rad_block_lilicorr.h is the correlator over the draft rows (lili_cand, lili_attn, lili_factor,
lili_walk), conditioned on the context state at the anchor (RadBatch::anchor_rows). At four ranks
drafter_geom replicates the drafter's two KV heads as geom_from does the target's (kv_repl_ok), and
Dflash2 reads k and v at kv_off (DenseFP8::span).
Nemotron-3.5-Bolt's per-expert Hessians take 169 GiB at once. RADIANCE_CALIB_LAYERS names the
layers a run taps, so several runs over disjoint ranges share one directory, and a layer's host
sums are released once written.
For a latent MoE: ungated experts, down(relu(up(x))^2), through GateQuantFP8's relu2; a router that
reads another width than the experts (Config::router_k, Wire::route); and Config::no_reduce, which
leaves the routed sum unreduced for a caller that reduces it with its shared expert.
rotary_dim 0 is attention without positions (NoPE): no rope is declared. Above the KV head count
the fused q | k | v takes a span per part, q this rank's heads and k and v the head at kv_off, as
gemma4's q | k | v does.
attn_dense at head_dim 80 without GQA (C-RADIO's ViT heads), and grid_embed_cpe, RADIO's cropped
position embedding: the table resampled half-pixel bilinear onto a square and cropped to the
grid, with the class and register rows ahead of each segment. libref, libavx and libr4d; ref_test,
avx_check_hand and selftest cases; docs/OPS.md.
act_mul's `act` takes "relu": with one tensor in both operands it is relu(x)^2, Nemotron-H's
ungated expert activation and its vision projector's. libref, libavx and libr4d.
ssd_update is Mamba-2's selective state update, a token at a time, with kda_update's rollback
contract: per_candidate, or the anchor form (one committed state and a scratch of per-token
records). libref, libavx and a libr4d kernel at a 128-wide state (r4d_ssd.hip, r4d_kda.hip's
register layout). ple_conv_bias is ple_conv with a per-channel bias inside the silu, Mamba-2's
conv1d, an op of its own so ple_conv's callers keep their operand list.
ref_test, avx_check_hand and selftest cases; docs/OPS.md.
For NVIDIA's LiLiCorr drafter:
- attn_paged_sink: attn_paged with a learned logit a query head beside the keys, in libref,
libavx and libr4d (the windowed kernels at h128, gqa 8 and 16)
- sample_logprobs without params writes every row (a drafter's candidate logprobs)
- lili_cand, lili_attn, lili_factor, lili_walk: the correlator's candidates and features, its
attention over the candidate lattice, the factor input and the greedy walk
ref_test, avx_check_hand and r4d_emu cases; docs/OPS.md.
Nemotron-H's attention layers have 32 query heads over 2 KV heads, gqa 16 at one and two ranks.
r4d_attn_paged_h128_gqa16.hip is the gqa8 body at that ratio: prefill blocks of 24 query
positions, decode q_len <= 4. Selftest cases at one rank.
A block drafter's query pass gets, for each drafting sequence, the row of its last committed
position in the context pass just run (StepSlot::hrow, written by the advance on the card).
LiLiCorr's correlator reads the context state there. Appended after bidi_used; main ships
ABI 35 and an appended field is read past the end of an older engine's copy, so the version is
36 and the layout table follows. The pass key reads the pointer.
Nemotron-3.5-Bolt's config nests its language model under llm_config, which is now read as
text_config is; arrays of objects (Puzzle's block_configs) become flat keys,
block_configs.<i>.<field>; a checkpoint without num_hidden_layers counts layers_block_type; and a
drafter merged from its own checkpoint keeps its own quantisation (Checkpoint::imports_at).
Mamba-2's conv1d bias is x | B | C, 8192 | 1024 | 1024 wide. The share of a vector stacked from
parts was cut only when the parts were equally wide; the reader already lays the parts end to end,
so a vector's parts now add their widths. share_test: a stacked vector with parts of different
widths.
A weight table reached every kernel as the tensor its planes decode to. libr4d's 4-bit grouped GEMMs
read each expert through their layout hooks (the w4 codes as R4D_DT_MOEW4, the E4M3 scales of
w4nl64a8h), so moe_gemm_w4a8 refused every case with "dtype this kernel does not serve", which
counts as a failure. Each expert is now laid out from its planes (the container's or
kf_draw_table's) and the entries are stacked one laid expert apart, while the oracle still reads
the decoded table. The container pass and the replay both do it, and a table counts as laid out
where the replay decides whether to compare exactly.
kfixture: kf_table_entry, kf_draw_entry_planes (kf_draw_table's per-expert draw, the same bytes)
and kf_lay_table. fixture_test: a table's experts are each laid out by the kernel.
The context pass's all_gather declared numel as a fixed crows * n_embd. crows is max_tok, so every
sizing declare (RadBuildCtx::shape_probe) changed a fixed parameter and was refused: with a
block-fp8 fc at TP > 1 no arena level was planned and nothing was lent to the expert slab. numel
is now a range with the trunk all-reduce's bound, issued at T * n_embd, as the reference reads it
(band_rows).
arch_test: the fc split's gather is the trunk's bound, as a range.
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.
generation_config.json's suppress_tokens (Gemma 4: the end-of-image and
end-of-audio markers, ids 258883 and 258882) are never sampled. The ids
reach the sampler as SamplingParams::suppress_tokens and leave the row
the way a grammar's mask does. A container carries them already, as the
space-separated generation.suppress_tokens.
A run of more rows than `sliding_window` (1120 soft tokens against 1024)
is attended again with attn_paged_ahead, where the window bounds the keys
behind a row, as transformers' mask does. A shorter run keeps the
two-sided window, which is the same mask for it. Where no kernel serves
the ahead form, the two-sided one stays.
attn_paged_ahead and attn_paged_qrow_ahead are attn_paged at causal 0
where `window` limits the keys behind a row and every later key of the
sequence is visible. The windowed kernels take it as a launch flag (h256,
1 to 8 queries per kv head). Gemma 4's sliding layers read a picture's
rows with transformers' mask, the window AND (causal OR the same
picture), which this is for a picture longer than the window. Emulator
cases for the scalar, split and WMMA kernels.
use_bidirectional_attention "vision" (the 12B and the 31B): each
sliding layer attends a run's rows again over the cache up to the
run's end without the causal bound, over their causal result. The
global layers stay causal, as transformers' Gemma 4 masks, KerasHub
and vLLM have it. RADIANCE_MEDIA_BIDI=0 keeps every layer causal.
An encoder states that the language model reads a picture's or video
frame's placeholders both ways (RadEncoderDecl::bidirectional). The
scheduler then ends no prefill chunk inside such a run, and a trunk
pass names its runs and the keys their rows see (RadBatch::n_bidi).
Fields appended; such a pass is not recorded.
rad_block_gemma4_unified.h: LayerNorm, the dense with its bias,
LayerNorm, the column's and the row's position rows, LayerNorm (eps
1e-5), the weightless RMS norm and the projection; for audio the norm
and the projection. The position table is read as its two taps of
dimension 1, which a recipe stores (gemma4-12b-bf16, -i8g).
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.
They are not written. A tower or head the plugin does not recognise was
left out without a word. A tensor beside one that is read (its scale)
counts as read.
Gemma 4 12B's full layers at one rank: 16 query heads over one kv head,
in the trunk and in its assistant head. A row pair, its constraints and
emulator cases (scalar, split decode, verify, WMMA prefill, fp8).
The 12B's head is Gemma4UnifiedAssistantForCausalLM, the same head under
another name. It was not declared, so rad-convert left its weights out
without a word. The check that the head fits the trunk compared the
head's kv heads with a rank's times the world; the 12B's one global kv
head is replicated at two and four ranks, one on every rank, so the head
was refused. It compares with the model's count now.
rmsnorm, sigmoid, and scale_rows declare __restrict__ input and output.
Give those stages separate graph buffers and check the declared graph
does not pass the same allocation to both.
Score the walk on F32 head logits, reject non-I32 anchors in libref, and
assert the real proposal path. Near-tie policy vs the reference is still
open.
Spark's standalone DSpark is five sliding-window layers over a seven-token
block, taps on the trunk residual, sigmoid headwise gates, exact GELU, and
a rank-256 Markov head over the tied table. Own block vs MiniCPM5 DSpark.
The graph follows the pinned reference: shared-anchor window and
full-vocabulary greedy Markov walk. Tensor names are the ones the container
holds; the walk scores at the width it reads. TP>1 drafting is refused.
Hash architecture and quantizer inventories as well as kernels. Bind reusable references to model bytes, corpus, runtime, settings and data. Bind tail replay to scored reports and launch the verified candidate privately. Reject incomplete forced-length QoS responses. Add CPU-only positive and negative attribution tests; no GPU certification is implied.
Serve the Spark X2.6 trunk on IQ8R's rotated int8 grid. Six projection types a layer carry
fwht128-rotated int8 weights with a bf16 scale per 128 columns; activations are quantised into
the same 128-column groups and feed the `i8a8h` rows, exact GELU runs before the down
projection's own Hadamard quantiser, and the embedding, the two norms a layer, the head's norm
and the 16-row attention gate stay as they are. The descriptor is `w8a8_fwht128`, and the
container says `quantization_config.quant_method=w8a8`, `fmt=fwht128`.
`data/recipes/spark-x26-4b-iq8r.recipe` fits those weights by GPTQ against the model's own
calibration Hessians, which the BF16 plugin writes as RADGRAM2 files under `RADIANCE_CALIB_DIR`;
each layer's f32 [K,K] accumulators are 533 MB, so `RADIANCE_SPARK_CALIB_LAYERS=lo:hi` calibrates
a slice at a time into one directory. The output head is RTN. Column-sharded inputs and their
offsets must land on whole scale groups, so a rank with an unaligned span is refused rather than
served with misaligned scales: TP 1, 2, 4 and 8 align for these shapes, TP 3 does not for the
FFN-down shard. Calibration asks for TP=1, because the off-diagonal cross-rank terms only exist
on one card.
`tests/spark25_iq8r.py` compares a deterministic quantised fixture against the Transformers
reference, top-10 probabilities included, across cached decoding; `--tp 2` checks two fake host
ranks and `--wide-tp --tp N` the group-aligned attention and FFN shards for N from 1 to 8. Run it
under a GPU-denying device cgroup, as with the BF16 fixture.
Against this checkpoint's own BF16 container, 32 held-out chat, math, code and tool-call samples
and 31,391 positions, greedy with prefix caching off: 98.60% of positions keep their top token,
mean KL 0.00408, median 6.5e-5, p99 0.0496, p99.9 0.348, worst 11.88. The tail is the honest
part -- 13 positions above one nat -- and leaving the first twelve layers in BF16 takes the worst
to 0.247 with nothing above one nat, for about 12% of prefill and 17% of decode. One R9700, zero
cached prompt tokens: 11.8k, 11.8k and 11.3k tok/s of prefill at 1.1k, 4.4k and 9.9k-token
prompts, 93.7 tok/s of decode from a short prompt and 88.9 with a 4.4k-token context. 8.29 GiB of
BF16 weights become 4.52 GiB.
That comparison is distribution agreement against BF16, not a task benchmark, and the corpus the
Grams came from is public text held disjoint from the holdout by hash; no MMLU or GSM8K-class
number is claimed here. The numbers need the prefill softmax scaling per row rather than per
wave: while a row's rounding depended on its wave-mates, the quantised container was worse off
against BF16 than its own error explains.
Reduce attention-output and FFN-down shards in exact BF16, then widen the merged result for the FP32 residual. Keep the disjoint embedding reduction unchanged. Declare the reductions before the casts as well as issuing them in that order so buffer liveness follows the fixed graph. Clarify that TP can still differ from one card through sharded dot-product rounding.
Capture the BF16 midpoint case and require each projection reduction to round before widening into the FP32 residual. This regression precedes the production fix and is expected to fail on the current graph.
The loader test fixes the (architecture id, quantisation descriptor) pairs a shipped plugin may
claim; the Spark plugin was not in it, so the set comparison failed once every architecture plugin
was built.
Attention takes whole GQA groups, so a world that does not divide the KV head count still gets a
clean cut; above it the KV heads are replicated and a group splits between the ranks sharing its
KV head. Gate/up, down and the tied vocabulary take matching spans, and every query head, FFN
channel and vocabulary row belongs to exactly one rank at every world from 1 to 8.
The projection outputs are partial sums, so each block widens to f32 and issues an exact f32
all_reduce before the residual add, which keeps the single-card accumulation order.
tests/spark25_reference.py --tp N holds the sharded graph against the HF reference on N fake host
devices; the tiny fixture has 8 heads over 4 KV heads and 3584 vocabulary rows so worlds 1-8 all
get a nonempty shard.
The history split was sized by rows * heads and clamped by the step's longest table: at eight heads
one and two rows split 16 ways and three rows 11, so the k + 1 rows of a speculative verify summed
their partials in another order than the single-row decodes at the same positions, and Ling-3.0's
greedy text left the run without speculation from MTP depth 2 on. The count now comes from the
head count only; a scratch hook sizes the partials for up to 32 rows a launch, and a larger batch
takes as many splits as its scratch holds. r4d_emu's mla test holds verify launches of 2 to 32
rows to their single-row decodes bit for bit.
The routed experts as int4 codes with a bf16 scale per 128 of K, everything else as the checkpoint
holds it: rounded to nearest, or chosen by GPTQ against a calibration run of the first container.
One format, so the same kernels serve both.
Every row of every step after each layer's attention and feed-forward, one bf16 file per site and
rank, for a layer-by-layer comparison against a reference model. It synchronises the stream.
The GPTQ tap writes each expert's down Hessian over its whole width, and a slice of a bf16 expert
is not one container run. Either way rank r owns experts [r E/W, (r+1) E/W) whole, as qwen4exp
does; served to calibrate and compare, not for decode speed.
Checkpoint layer 42 behind GlmMtp at 2560, model.layers.42 and final_layernorm.weight: an MLA layer
with the full routed feed-forward, its weights named as a trunk layer's, so a recipe's expert rule
covers them. Declared when the deployment speculates; a draft pass runs as GLM-5.3's.
GlmMtp keeps GLM-5.3's layout as its defaults (4096, model.language_model.layers.45, 45,
shared_head.norm.weight), so that graph is unchanged. Another DeepSeek-style draft head sets them
before declare_inputs.
Ling-3.0-flash and its fine-tunes (`model_type: bailing_hybrid`) from the bf16 checkpoint: 42
layers in groups of five KDA layers and one dense MLA layer, two dense feed-forward layers, then
512 experts of 768 under group-limited sigmoid routing with an ungated shared expert. The KDA core
is GLM-5.3's (KdaState); the MLA attends in the latent through mla_project and mla_attn_paged, its
query served as two projections (the heads' rotary rows and their nope rows, each a plain 2-D
plane). One, two or four ranks; at four an expert's six blocks split 2, 2, 1, 1, rotated by the
expert's number mod 4 (moe_gemm_q_mod4). The latent and KDA caches are bf16.
GlmRouter takes `groups` and `topk_groups` and issues router_sigmoid_group_topk above one group.
MoeFP8 passes them on (a grouped router runs the separate selection, not the single-group fused
one), takes a clamp of its own for the shared arm, and with `swiglu_step` clips both arms after
the SiLU; GateQuantFP8 issues swiglu_step for that, without the fused clamp-and-quantise. Every
default is the existing behaviour, so no other graph changes.
mla_attn_paged is the wave-per-(row, head) latent attention of mla_attn with the rotary part in
the score, one page table a sequence, the causal bound from cu_seqlens and seqused, and the head
gate in its store; a short batch splits the history and merges f32 partials as mla_attn does.
router_sigmoid_group_topk is router_sigmoid_topk's wave with the groups ranked first, a lane a
group. mla_project takes the head width as a template parameter; at 256 it is the kernel it was.
r4d_selftest holds each new row and the 128-wide mla_project to libref.
Three ops Ling-3.0 needs, with their references, OPS.md entries and ref_test cases.
swiglu_step is the SwiGLU clipped after the SiLU, as vLLM and SGLang serve Ling-3.0.
router_sigmoid_group_topk is noaux_tc routing with groups: a group ranks by the sum of its two best
biased scores and only the best groups' experts are candidates. mla_attn_paged is dense causal
latent attention over a paged cache whose row is the latent then the rotated key part, with an
optional head-wise sigmoid gate; it refuses zero rows and reads a gate row at the gate's own pitch.
A possessive repetition of one class at the top level, whose tail in its concatenation is classes
that share no codepoint with it, gives the same matches read as greedy: a shorter run leaves the
tail facing a codepoint it cannot take. Ling-3.0's pre-tokeniser pattern has two such quantifiers.
Everything else stays refused by name.
The recorded-pass audit (Ctx::tapes_agree -> a_tape_diff) byte-compares the serialized
kernel arguments of a pass against its recording, and on the first disagreement it concludes
"the pass depends on something the recording's key does not carry" and stops the engine. On
gfx1102 with the dspark drafter that self-stop fired on the third request:
E rank 0: draft pass -1 at 23 tokens issued differently from its recording after 0 plays,
so the pass depends on something the recording's key does not carry:
record 1: kernel fp8a8_tiled_kernel: its arguments differ at byte 28
Byte 28 is not a pointer offset. With ActQ = 24 bytes (a pointer, a long long, an int, and a
4-byte trailing hole) and WQ = 64 bytes (with a 4-byte trailing hole), the argument block is
a[0,8) aq[8,32) b[32,40) h[40,104) ...; inside aq, gmode ends at 28 and bytes 28..32 are
padding. The audit found the first difference at 28, so every real field before it -- a,
aq.scale, aq.row, aq.gmode -- was identical: only the padding differed.
The launcher built those structs with aggregate-init (ActQ aq{ptr, ll, int};), which
initializes the three members and leaves the trailing padding indeterminate. HIP serializes
the whole struct, padding included, into the kernel-argument block, so the record and the
audit each captured whatever garbage was on the stack. Whether the two garbage patterns match
is a coin flip per run -- a Heisenbug that only surfaced once the stack states diverged.
Value-init the structs (ActQ aq{}; WQ h{}; MxWQ h{};) and assign the fields: value-init
zeroes the entire object including padding, aggregate-init does not. The kernel reads none of
the padding, so behaviour is unchanged -- only the serialized bytes become deterministic, and
the audit can no longer mistake a padding byte for a missing key. Applied to both the
fp8a8_tiled and mxfp4a8_tiled launchers, the only two libr3d kernels that pass a struct by
value.
Verified on the box (RX 7600, gfx1102): r3d_selftest 109 rows clean, 0 failed; the rig with
the dspark drafter armed (speculation at its auto depth) now serves back-to-back requests
past the point that self-stopped it before, with no schema or tape refusal.
Head-256 split-prefill launchers now declare that their grid depends on
live KV. Without an architecture geometry key, those passes stay live
instead of replaying a stale tape. Qwen keys only a proven one-sequence
prefill. Plugin ABI 34.
The 8-tile floor used max_ctx, so a 128-token chunk at --max-model-len
2048 became four splits of ~32 keys. The same prompt in one 977-token
launch stayed unsplit. Only the reduction order changed, and that
moved Spark BF16 first-token top-20 by 0.46 nats.
Occupancy still decides when a long-KV short-Q launch should split.
The floor now reads seqused_k (skipping the copy when occupancy is
already 1). A 128/128 case with declared max_ctx 2048 stays unsplit.
Review B of 54d4613 refuted the second clause of the separator sentence. The
population is 15 dots / 46 pipes, not the 11/15 enumerated before it: the history
line's own anchor dot is written as the escape form, so a glyph grep misses the
sentence's own subject. And triple()/acceptTriple() pipe-separate an extreme from
a window mean from a current value in the strip tiles, which is a plain field
join only by stretch. The clause corrected one overclaim by asserting its
negation; the real state is asymmetric, so only the line-local scoping stays.
history.test.js:
- add tpsF(9.994) == "9.99", which kills the sig3 9.995->9.994 mutant that
survived 09ac548. Measured: FAIL got "10.0" want "9.99", rc=1.
- the reviewer's other proposed closer, tpsF(99.951) == "100", is NOT added.
Against the tps 99.95->99.951 mutant it passes, and 2000 samples across
[99.94, 99.96) give shipped and mutant the same output set ["99.9","100"]:
cnt and sig3 agree throughout [99.95, 99.951). That mutant is behaviourally
equivalent and no literal can catch it, so the check would be a guard that
cannot fail.
- the n=25 floor/ceil check could never fail (mkRows is strictly increasing), so
it is now a fixture precondition that throws instead of a counted check.
Check count stays 63. Suites after: 27/35/63/34 JS, dashboard_test 241 over 8.
No shipped code touched.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The delta review recommended one sentence to close the ambiguity behind the three leftover pipes,
and this is that sentence -- but not the sentence it suggested, because the suggested one asserted a
page-wide rule that the code does not have.
The recommendation was to state that the rule is page-wide and that a trailing verdict takes a pipe.
Enumerating every separator site before writing it (11 dot sites, 15 pipe sites) showed the opposite:
the memory panel joins its sibling fields with dots (rest.join at :2692) and reserves the pipe for
the trailing verdict, while the KV sub-line joins its two fields with a pipe (:2531). Two different
idioms on adjacent panels. And most of the 15 pipe sites are ordinary field joins -- version | up,
N cards | M collectives, mean | worst L3 -- so the pipe is not reserved for verdicts at all.
So the rule is scoped rather than extended: the dot/pipe convention is a property of the history
line, and neither glyph means anything page-wide. That is the true statement and it closes the same
question -- the three pipes are not leftovers, they are plain separators in panels that never
adopted the history line's convention.
Two drafts were rejected on the way here, both for overclaiming: one said the KV, memory and kernel
panels "use them the same way" (they do not -- dots vs pipes), one said the pipe "introduces a
trailing verdict" as though that were its role (it is one of several uses). The delta review warned
that rewrites introduce new false claims; it was right about the risk and this is the third time on
this branch I have caught a doc sentence of my own saying more than the code does.
Docs only, no code touched. Within the section's 102-character maximum.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI
The delta review refuted guard 3 of 4dce97b, and it was right. Replacing the re-typed formatters
with a slice of the shipped ones removed one unfalsifiable shape and installed another: tpsF/cnt3F/
durF are called on BOTH sides of every comparison, so any formatter bug cancels out. Verified with
my own instrument before fixing -- shipped `tps = (v) => "X"` passed all 37 checks. The brief
warned about exactly this and I walked into it anyway.
Three sections added, each mutation-tested with rc captured on its own line:
Formatter literals (14 checks). The only place the formatters are pinned to something other than
themselves. tps -> "X" now fails 5 checks; the dur ms branch -> *100 + " s" fails 2. Band
boundaries are pinned at both edges (9.995 inclusive, 99.95 exclusive) because that is the rule F1
of the docs fix depends on. Values were derived from the shipped source rather than copied from
the review's draft, which caught a real error in it: DASH is U+2013, not a hyphen, so the drafted
`tpsF(NaN) === "-"` would have failed on correct code.
Median at an ODD row count (2 checks). M17 survived the previous fixture change because the median
was only ever asserted at n=24, where floor(12) and ceil(12) are the same row -- a non-uniform
fixture could never have caught it, so the earlier diagnosis named the right cause and the wrong
cure. n=25 makes the two candidates differ, and floor->ceil now fails with "1.80 s" want "1.70 s".
Threshold counts adjacent to the boundaries (8 cases, up from 3). M15 survived because no case sat
at 19, and a >=5 -> >=7 mutation survived because no case sat below 7. Counts now straddle both
thresholds: 4/5/6 pin the 5 boundary, 19/20 pin the 20.
history.test.js 37 -> 63 checks. Full suite: 27/35/63/34 JS, 241/8 and 62646/184 C++.
GAP D (the revoke delay argument) deliberately not pinned: the 1000 ms is a safety margin, not a
contract, and a guard that fails a reasonable 500 ms encodes an arbitrary constant.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI
The review ran 27 mutants and 6 survived. Each fix below was then mutation-tested against the
shipped source, with rc captured on its own line -- a piped `| tail` reports the tail's status and
would have hidden every one of these.
download.test.js 31 -> 34 checks:
The assertion at :64 could not fail. `ok(page.indexOf('<span class="cap">Requests</span>') < iBtn)`
compares against indexOf, which returns -1 when the caption is absent, and -1 < anything is always
true. Renaming the caption survived both suites. Now the index is captured and required to exist
before the order is compared.
The stubs recorded counts, not sequence: click() incremented a counter, appendChild pushed to a
separate array. So click-before-appendChild survived -- and Firefox ignores a click on an anchor
that is not yet in the DOM, so that ordering is a silently dead button in a real browser. One
shared seq[] log now makes the order assertable, and the mutant is caught by the new assertion
itself ("the anchor is in the DOM BEFORE it is clicked: ["click","append","remove"]"), not by a
crash. My first attempt at that mutant targeted el.body, which does not exist, and failed with a
TypeError -- proving only that the mutant was malformed, so I rebuilt it against the real line.
history.test.js 29 -> 37 checks:
The formatters were re-typed. The suite passed its own `(v) => v + " ms"` into the shipped
renderer, then asserted "value and unit are one string" against the unit the stub had
manufactured -- testing the fake, not the page. tps/cnt3/dur are now sliced from the shipped
source (DASH..dur is self-contained) and the guard compares against what the real dur() renders.
Presence assertions became value assertions. "last 20" appearing in the string survived
slice(-20) -> slice(-100), because the label was still there while the figure silently became the
last 100 -- a wrong number on a performance dashboard. Each figure is now compared to a mean
computed independently of the shipped group(). The fixture also had to change: the old cycling
values made mean(all) equal mean(last 20) by coincidence, so no window mutation could show up in
the output. Distinct values per row fix that.
Threshold fixtures at 7, 12 and 24 rows. 12 is the discriminating count -- it kills a threshold
lowered to <=12 as well as one raised.
The two .hsep padding regexes are unified. One was loose, one strict, and they disagreed about
whitespace: a reformat from `padding:0 9px` to `padding: 0 9px` passed the loose test and then
CRASHED the suite on `null[1]`. One regex, one match, checked before use.
Verified: slice(-100) caught (2 failures), threshold >=12 caught, ttft median->mean caught
("1.65 s" want "1.70 s"), padding reformat now passes cleanly. Full suite: 27/35/37/34 JS,
241/8 and 62646/184 C++.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI
The adversarial review's call was ship the code, fix the docs first. Every correction below was
re-verified against the shipped code before editing, not applied on the verdict's word -- the
review ran against e9f0622 and the tree is now rebased a559977, so all anchors were re-located by
content.
The blocking pair:
F2 was the worst: "Reloading the page resets these figures, a server restart does not" states the
opposite of the code. newEngineRun() deletes extAt/extAtS (dashboard.cpp:1735-1736), poll() calls
it when started_at changes (:3942), and this branch's own extremes.test.js:103 is titled "a
RESTART drops the extremes". Three independent instruments, one doc line saying the reverse. The
error was inherited from a stale comment at :1709-1710, so that comment is corrected too -- it is
the root cause, and it is comment-only: every changed line in dashboard.cpp starts with an
asterisk, verified by filtering the diff.
F1 is a worked example a reader copies: sig3 renders one decimal across [9.995, 99.95), so the
line prints "best 58.0 | recent 54.0", not "best 58 | recent 54".
The rest are one-liners: F3 claimed three categories carry windows when ttft is a median with
none (:2282); F4's rationale for the window rule fails at its own boundary -- at exactly 20 rows
last-20 repeats the overall mean, which is now stated rather than papered over; F5 put the poll
summary under the fields when #advsum sits in the panel header (:1404); F6 said figures hold
while reading another page without the 60 s limit that drops the windows (GAP_S = HIST_S = 60);
F7 showed a middle dot where :2530 ships a pipe. README:19 credited poll_spark.test.js with
poll()'s restart decision -- that file contains zero matches for poll(); the coverage is in
extremes.test.js.
The numbers the brief flagged as suspect (HMAX=200, RECENT_S=15, RECENT_PREFILL_S=5) were correct
and are untouched. The real errors were prose semantics and rendered formatting, which the
flagging did not anticipate.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI
Section 6.1 described the tiles, the extremes line, draft acceptance, Sessions, Model and
Advanced, and said nothing about the history table under the request list -- the panel this
branch changed twice. A reader could not learn from the docs that the rows are per-browser
localStorage rather than server state, that only the last 200 are kept, that a clear is a
timestamp every tab honours, or that the download icon exists and what it writes.
The summary line needed the same treatment: it now carries a rule a reader cannot infer from
the page, that a dot separates categories and a pipe separates the windows inside one. Stated
because it is a convention the page depends on and nothing else records.
Every number here was checked against the code rather than recalled: HMAX is 200, the file is
radiance-history.json, and the window rule is a flat threshold -- "last 20" appears at 20 rows
and "last 5" at 5, not once a window is wider than its neighbour. The first draft said the
latter; driving the shipped group() at 3, 7, 12, 20 and 25 rows showed 12 rows renders only
"last 5", which is what the paragraph now says.
Docs only, no code touched. Lines kept within the section's 102-character maximum.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The README still named only the two suites that came out of the 2011-01 review; history.test.js
and download.test.js shipped without a line, and render_align.js shipped without its invocation
or its puppeteer prerequisite. A reviewer opening tests/js/ could not tell what to run or what
each one guards.
The render check gets its own section because it is not a unit test and cannot be: it needs
Chrome, and it exists because three visual claims on this branch were made from the CSS and the
SVG viewBox and all three were wrong. That is the argument for measuring the rendered page, and
it belongs next to the tool that does it.
Docs only, no code touched.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The operator's intent, drawn rather than described: the bottom of the tray bar should sit on
the same line as the bottom of the letters in REQUESTS. The previous commit claimed the
viewBox-flush geometry achieved that. It did not.
Headless Chrome, screenshotting the real header at 4x and finding the lowest inked pixel row of
each: the caption's letters ended at device row 71 and the tray bar at 63 -- the icon floated
2.00 CSS px high. align-items:baseline puts the SVG's BOX on the text baseline, and the baseline
sits above the box bottom, so filling the box was necessary but nowhere near sufficient. A 2px
translateY on the glyph closes it; re-measured, both bottoms land on device row 63, gap 0.00.
tests/js/render_align.js is that measurement, kept in the repo so the claim can be re-checked
rather than trusted. It is manual and not wired into CMake -- it needs puppeteer and a Chrome
binary, which are not repo dependencies -- and exits nonzero when the two bottoms differ. It
fails on the pre-fix page (2.00px above, rc=1), which is the only reason to believe it.
download.test.js's guard was the thing that gave false confidence here: it asserted the glyph
"sits on the baseline" from the viewBox arithmetic alone, and passed while the icon floated. It
now pins both halves -- the glyph fills its box AND the 2px nudge is present -- and the comment
records that the earlier claim was wrong and why the test could not see it.
A unit test cannot catch either of this session's two visual errors: the collapsed whitespace
(zero width, not the 13px claimed) and this float. Neither is a property of the string the code
builds. Both are properties of the rendered page, and only the rendered page was checked here.
Suites: download 31, history 29, extremes 27, poll_spark 35, dashboard_test 241 over 8 cases,
sched_test 62646 over 184, no failures. Alignment mutations caught: removing the nudge, making
it 1px, re-insetting the bar in its box.
Not deployed. Goes to review with the separator and export commits.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The icon looked awkward next to REQUESTS: it floated a hair above the caps. The header aligns
its items on the text baseline, and an inline SVG's baseline is its box bottom, so the box
bottom was on the baseline -- but the tray bar was drawn at y 13.5 of a 16-unit viewBox,
leaving 1.7 units of empty space below it. The visible bar therefore sat above the baseline
while the letters sat on it.
Redrawn so the bar's stroke bottom lands exactly on the viewBox bottom (centreline 15.2 plus
half the 1.6 stroke = 16.0), which puts the bar on the baseline with no offset to tune. The
shaft and arrowhead moved up by the same amount to keep the proportions.
download.test.js gained a geometry guard that parses the viewBox, stroke width and bar
centreline out of the shipped markup and asserts the stroke bottom is flush with the box
bottom. Re-insetting the bar to the original 13.5 fails it with the measurement (14.3 want 16),
so a future edit that reintroduces the float is caught rather than eyeballed.
Verified: download 29 checks, history 29, extremes 27, poll_spark 35, dashboard_test 241 over
8 cases, sched_test 62646 over 184, no failures.
Not deployed. Goes to review with the separator and export commits.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The history summary row had grown crowded -- the figures, then a "json" button and a "clear"
button -- and the operator asked for the export to live in the Requests panel header instead,
top-left by the title, as a download icon with a "Download JSON file" tooltip. The Requests
header already carries running/waiting on the right, so the export sits opposite it on the
left rather than lumped in with the history figures.
The button is an inline SVG download glyph (a <button>, so it is keyboard-focusable and
announced), in a new .pleft group so the space-between header keeps it on the left with the
title. The handler now saves a file rather than copying to the clipboard: a Blob of the stored
rows, an anchor with a download name, clicked and removed, the object URL revoked after the
click. The old #hjson clipboard button is gone.
This also fixes a clipping bug the previous commit introduced. Making each category a nowrap
span and the separator a padded element removed every whitespace text node between categories,
so the summary line became one unbreakable run: a long line overflowed the row and clipped the
buttons after it -- the "json" the operator saw cut off at the panel edge. A zero-width space
between groups restores a break opportunity: the line can now wrap between categories, while
each category still stays atomic. The break point sits between groups, never inside one, where
nowrap would make it inert.
tests/js/download.test.js, 27 checks, drives the shipped handler against stubs: the button is
in the Requests header on the left of the aside, exactly one of them (a duplicate id would bind
only the first and leave a dead control), tooltip and aria-label present, an icon not a text
label; the handler builds one anchor, names it radiance-history.json, types the blob
application/json, clicks it, attaches it to the document (Firefox needs that), removes it, and
revokes the object URL only after the click. The payload round-trips through JSON.parse.
history.test.js gained the break-point checks: three zero-width spaces between four categories,
each immediately before its group, none buried inside a nowrap group.
Verified by mutation: dropping the download attribute, never clicking, never revoking, a wrong
blob type, changed tooltip text, and moving the button to the right of the aside each fail the
suite. extremes 27, poll_spark 35, history 29, download 27, dashboard_test 241 over 8 cases,
sched_test 62646 over 184, no failures.
Not deployed. Goes to review with the separator commits.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The summary line wrapped mid-figure: "ttft median 810" ended one line and "ms" started the
next. A category that cannot fit should move to the next line intact, not break wherever the
browser finds a space.
Each category becomes one span with white-space:nowrap, so it is atomic, and the dot between
categories becomes a padded element carried INSIDE the group it introduces -- as a sibling it
could be left stranded at the end of a line when the group wrapped, which is the same orphan
in a different place.
This also corrects a false premise in the two commits before it. HTML collapses runs of
whitespace, and .hsum sets no white-space, so the "wide" double-spaced separator those commits
introduced never rendered wide: it collapsed to a single space exactly like the tight one. The
spacing change was not subtle, it was zero -- which is why it looked identical. Width has to
come from a padded element, not from spaces in the string. The pipe-within-category and
dot-between-categories distinction is unaffected by this and stands.
tests/js/history.test.js, 24 checks, drives the shipped assembly against a DOM stub and reads
the shipped CSS: every category is a nowrap .hgrp, the break is a padded .hsep, the dot is the
first child of its own group rather than a sibling, a category's own figures carry pipes and no
dot, and the ttft category is a single text node so value and unit cannot split.
Verified by mutation: dropping nowrap, dropping the padding, moving the dot to a sibling,
turning the category break into a pipe, and splitting the value from its unit each fail the
suite -- the last being the exact 810 / ms orphan this fixes. extremes 27, poll_spark 35,
dashboard_test 241 over 8 cases, sched_test 62646 over 184, no failures.
Not deployed. Goes to review with the separator commits.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The pipe sweep converted both separator weights at once. That was too far: the wide separator
is the break between categories -- tok/s against prefill against ttft -- and it has been a dot
since the page was written. Reverting the wide tier to the dot keeps that precedent; the pipe
stays only on the tight tier, the fields inside one category (mean, last 20, last 5), which is
where the figures actually ran together.
So the history line now reads:
40 done · tok/s mean 100 t/s | last 20: 98 t/s | last 5: 105 t/s · prefill mean 1.2k | ...
The dot marks a category change; the pipe marks a different question about the same category.
Two weights, two meanings, one rule applied everywhere rather than dots in one panel and pipes
in another.
Thirteen wide separators reverted across the page (twelve lines; the layer-residency line carries
two), so the rule is global. The two dots that were never separators -- the CSS list bullet and
the browser tab title -- are untouched, as is the range dash in "layers 1-8".
Verified by rendering the shipped page bytes, not by the suite: the suite does not pin the wide
separator, so it is green whether the category break is a dot or a pipe. The render pulls the
join string and the group() body straight out of dashboard.cpp and shows the dot at the category
breaks and the pipe within them. All four suites still pass: extremes 27, poll_spark 35,
dashboard_test 241 over 8 cases, sched_test 62646 over 184.
Not deployed. This change and the pipe sweep go to the same code review before anything ships.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Every line that packs several distinct figures into one string used the middle dot, at two
weights -- a tight dot between sub-figures and a wide one between groups. At 11px the dot is
too short to read as a boundary, so lines like the history summary ran together: count, three
tok/s figures, three prefill figures and ttft all sat at one visual level. The operator's call
was to use the pipe wherever fields are meant to be distinct.
Fifty-eight separators converted across the page -- the history summary, the version line, the
KV and expert asides, the acceptance and step-time detail lines, the graph and model-view
metadata, the control-vector summary, the poll summary. The two weights are kept: a tight dot
becomes a tight pipe, a wide dot a wide pipe, so the group-versus-window hierarchy the wide
dot carried survives the glyph change.
Two dots stay, because they are not field separators: the CSS list-bullet marker
(.gmeta li::before content) and the browser tab title (file - radiance). The range dash in
"layers 1-8" and the DASH placeholder are likewise untouched. The two " + " the earlier
census turned up are inside pctn building "<0.1" and ">99.9" string literals, not separators.
The sweep missed eight separators at first: the age clause and several detail lines build
their separator as the escape "\u00b7" rather than a literal dot, and a literal replace
never sees those. Caught because the tests that pin the age clause went red on the literal
sites but the escaped ones did not -- a partial conversion that would have shipped a page
with pipes and dots mixed. Both forms are now converted.
Tests: the two regexes pinning the age clause and the one string pinning the poll summary
now expect the pipe. They failed when the code changed and pass now, which is the point --
a separator assertion that could not fail would not have caught the escaped-dot miss.
extremes.test.js 27, poll_spark.test.js 35, dashboard_test 241 over 8 cases, sched_test
62646 over 184, no failures.
GUIDE's two example triple lines, which mirror the page's separators, updated to match.
Verified the sweep by reading all 58 changed lines, not by trusting the count: no pipe landed
inside a regex literal (where it would mean alternation) or a prose tooltip. Both hazard
greps were positive-controlled against known-bad input before their empty result was trusted.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Section 6.1 opened "It has three tabs" and described Dashboard, Sessions and Model. The page has
four -- Advanced was added as a fourth nav view and the doc never heard about it, so a reader
comparing the page against the guide would find an unexplained view and a wrong count. Added the
paragraph: two editable intervals, idle and busy, clamped to 100-5000 ms, equal values give one
fixed rate, stored in the browser rather than on the server, and polling pauses on every view but
Dashboard so the figures hold while another view is open.
Two sentences described the windows as sample counts, which stopped being true when the rings
started pruning on elapsed time:
"the mean of its last 30 samples there (15 s at one poll every 500 ms; 5 s for prefill)"
"the tile's recent pools the last 30 polls that drafted"
Both now name the span. The first also assumed a 500 ms poll, which was a constant when it was
written and is now the default value of a field anyone can change -- so the sentence was wrong
twice over, in the mechanism and in the number it derived from it. Note the acceptance ring
prunes the same way (accPool, RECENT_S), which is why the second sentence moved too.
README needs nothing: it defers the dashboard to this section in one line and makes no claim about
tabs of its own.
Docs only, no code touched. Line lengths kept within the 102-character maximum the surrounding
section uses; the diff was read line by line rather than trusted to the anchor counts.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The summary line under the history table joined everything with the tight middle dot: the
count, three tok/s figures, three prefill figures, and ttft, eleven items at one visual level.
The groups ran together.
The page already has a two-tier convention -- a tight dot between sub-figures inside a group,
a wide dot (double-spaced) between major breaks, used that way on the KV lines and the
version line. The history line was the one place using the tight dot at both levels. It now
joins its groups with the wide dot, so a group edge reads heavier than a window edge, using
separation the page already speaks rather than new vocabulary.
Verified: dashboard_test 241 checks over 8 cases, extremes.test.js 27, poll_spark.test.js 35,
no failures; no test pins the separator.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
8ee893e added `up < lastUp` beside the started_at comparison, to catch a restart landing in
the same whole second as the one the page last read. It cannot catch that. uptime_s is
derived, not independent: unix_now() - started_at_, both whole seconds, so started_at +
uptime_s is exactly the wall clock at every poll. Two processes sharing a started_at are
therefore read at increasing wall times and report INCREASING uptimes, so the comparison
never fires in the case it was written for. It fires on genuine restarts, which started_at
already catches, and on a backward NTP step, which is not a restart at all. Net effect: dead
where it was needed, redundant elsewhere, and a false clear of the session extremes on every
clock correction.
The test that "proved" it worked was fed an impossible fixture: started_at 100 with uptime 40
implies the clock read 140, then started_at 100 with uptime 2 implies 102. Time running
backwards is the only way to reach that pair, which is the same mistake the finding it
answered was about -- reasoning from a state the instrument cannot produce. It now asserts
the reachable behaviour instead: a backward uptime with an unchanged started_at is a clock
step and must NOT clear the extremes, since they still belong to the running process.
The collision the comparison tried to close needs a replacement process stamped in the same
second as the one the page last read. The page can only learn started_at once /stats answers,
startup_s after the old process began -- 69 s on this engine -- so a replacement starting
after its predecessor stopped answering is stamped a later second. The bound is startup_s >=
1 s; a model that came up inside a second could collide, and would cost one stale extreme
carrying a true age. That is documented where the comparison used to be.
The acceptance window's use of the same signal is NOT redundant and is untouched: it has no
started_at comparison, so for a tab that stopped polling while a new process drafted past the
old totals, a falling uptime is the only thing that catches the restart.
Verified: dashboard_test 241 checks over 8 cases, extremes.test.js 27, poll_spark.test.js 35,
sched_test 62646 over 184, no failures. Mutation re-run after the revert: deleting poll()'s
detection line, stamping extAtS on every sample, and deadening acceptTriple's age clause each
fail the suite. Behavior is unchanged from the deployed build, which never had the
comparison, so no restart is needed for this.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
An adversarial pass mutated this leg of the dashboard and found three mutants that survived
every committed check. All three were real gaps in my verification, and the reason was the
same each time: the tests called the helper directly, so the code that DECIDES whether to call
it was never exercised, and two clauses sat behind a guard that no test ever opened.
Drive poll() itself. A scripted /stats sequence and a fixed clock, with resetWindows,
newEngineRun and update replaced by counters, so the assertions are about what poll() decided
rather than what the helper does once called. Three cases: the first poll is a baseline and
clears nothing, a changed started_at clears, and a long quiet span takes the gap path without
being read as a restart -- the distinction the previous commit exists to make.
Re-sample a key after its extreme is set. The stamp records when the extreme was set, so a
worse sample must not refresh it; nothing used to sample the same key twice, so moving the
stamp to every sample -- which makes every age read about zero, wrong output rather than
missing output -- passed unnoticed.
Exercise acceptTriple with a live extreme. Its only previous call came from the restart case,
which clears extAt first, so it returned at its guard before reaching the age clause: the
clause was asserted zero times while triple's was asserted seven.
Use the shipped pctn rather than a re-typed one. The copy diverged from the real formatter for
small and non-finite values; nothing asserted on that output today, so it was a latent trap
rather than a live error. Pass the sampled value as a parameter instead of interpolating it
into the function source, so the null case is a real null and not the string "null".
Verified by mutation, which is the only thing that makes a green suite mean anything here:
disabling poll()'s detection line fails the suite, as does moving the stamp to every sample,
as does deadening acceptTriple's clause, as does removing the uptime comparison added in the
previous commit. extremes.test.js 27 checks, poll_spark.test.js 35, dashboard_test 241 over 8
cases, sched_test 62646 over 184, no failures.
Found by an adversarial review pass on the author's own commits.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The poll compares started_at to decide whether the engine is a new process, and clears the
session extremes when it is. started_at is std::time(nullptr) -- whole unix seconds -- so a
restart landing in the same second as the previous start leaves it unchanged and the clear
never runs. The previous run's extremes then render with an age clause attached, and the age
is true: the figure really is that old. What is false is the provenance the age implies, that
it belongs to the process now running. A stale figure with an honest number on it is worse
than no number at all, because it invites the reader to trust it.
Also compare uptime_s, which resets to about zero on any new process. It is the same signal
the acceptance window already trusts for the same purpose, so this adds no new assumption:
it is wall-clock derived, and a backward NTP step reads as a restart and clears the extremes.
That false positive costs a cleared window on one poll, which is what the acceptance window
already accepts.
Found by an adversarial review pass that reproduced it as `highest 75% - 43.0 s ago` from a
dead process.
Verified: dashboard_test 241 checks over 8 cases, no failures. The case that holds this is
the poll() driver in tests/js/extremes.test.js, which fails if the uptime comparison is
removed; it lands in the next commit, so this one is not self-proving on its own.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
An independent review of 9cc237f rejected its verification claim: the commit said 18 checks
executed the shipped noteSample, triple, acceptTriple, resetWindows and newEngineRun, and the
tree contained none of them. The harness was real and passing, but it lived in /tmp, so nobody
else could re-run it and the claim was unfalsifiable from the repository. That is a fair
rejection regardless of whether the checks were right -- a verification nobody can repeat is a
claim about the author's machine.
Move both harnesses into tests/js/ and add the extractor they need. The page is one C++ raw
string, so a JS test has to pull the script out of the translation unit it ships in; page.js
does that, and each test slices the functions it exercises by line range and CALLS them. Both
details matter: a retyped copy tests the copy, and a sliced function that is defined but never
invoked passes without testing anything, which has already happened once in this code.
extremes.test.js, 17 checks: the age clause appears only when an extreme stands alone and is at
least a second old, tracks the newest extreme rather than the first, survives a gap with its age,
and is gone after a restart along with the extreme itself.
poll_spark.test.js, 35 checks: the clamp's floor, ceiling and fallbacks, the in-flight trigger,
the old storage key migrating to a flat rate, corrupt storage falling back, the summary label
matching what is set, the sparkline's x axis being time-proportional rather than sample index,
the right-edge fill at startup, a sample gap drawn as a gap in the line, and the prune loop
keeping samples by elapsed time rather than by count. The window expectations derive from the
shipped HIST_S, so changing the constant moves them instead of silently passing.
Verified: both pass, and both fail when the code is wrong -- setting the age gate to zero fails
extremes.test.js, and returning the sparkline to index spacing fails four checks in
poll_spark.test.js. dashboard.cpp is unchanged by this commit and dashboard_test still reports
241 checks over 8 cases.
Not wired into ctest: they need node, which is not a build dependency here and will not be on a
contributor's box or in the ROCm build image. Making a missing optional tool a red build is worse
than an opt-in test, so the README says how to run them and when to bother.
Found by an independent review pass on the author's own commits.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The tile detail lines keep the session's best figure when the window empties, which is
deliberate: a lane that goes quiet for a minute is the same lane, and blanking its best
would throw away the one figure still true. But an extreme with no window beside it is
indistinguishable from a fresh one, so a best from before a gap -- or from before an engine
restart -- reads as the lane's current best. A review flagged the label as honest but
undated; the age is what makes it honest.
Record when each extreme was set and, when it stands alone and is at least a second old,
name the span: "best 500 t/s - 5m 00s ago". Below a second the clause is noise, and a
figure set on this poll is current, so it stays silent.
A restart is a different discontinuity from a quiet minute and now gets its own path. The
previous process's requests are gone and its configuration may differ, so nothing from it
should carry over -- yet the extremes were the one figure that did, while every other
number on the page already refuses to pool across a restart: the acceptance window drops
its rings when the counters go backwards, and the history resets its base when request ids
restart. The poll now compares started_at, which is the process's identity, and clears the
extremes when it changes. A gap still keeps them.
Verified: dashboard_test 241 checks over 8 cases, no failures. 18 checks execute the
shipped noteSample, triple, acceptTriple, resetWindows and newEngineRun sliced out of the
page: the clause appears only when the extreme stands alone, tracks the newest extreme
rather than the first, stays silent under a second, survives a gap with its age, and is
gone after a restart along with the extreme itself. Not tested: the page in a real browser.
Found by an independent review pass on the previous changeset.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The case that guards the admitted_us reset read two timing inequalities and never checked
that the second request landed in the first request's slot. It rests on that: if the reap
defers, or the free list is pre-populated, the second request gets a fresh struct, the stale
stamp is absent by construction, and the invariant holds with the bug unpatched. A test whose
precondition is a property of the fixture rather than an assertion goes quiet without saying
so, which is worse than not having it.
Read the slot from the published row before the reap and assert it afterwards. This also
settles the one thing the review could not: whether the reap releases immediately or defers.
It releases, because the assertion holds -- proven by running it rather than by reading the
ahead-step planning that decides it.
Verified: the case passes, and removing the reset line still fails it, so the added assertion
did not blunt it. sched_test 62646 checks over 184 cases, no failures.
Found by an independent review pass on the fix itself.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Five changes to one leg, committed together because they are one claim: a number on the
dashboard should be readable as the thing it is named for. They were deployed as
1.15.1-histfix without being committed, so the running engine carried code no commit
described, and a review of the working tree could not see its own context.
History labels. "avg" becomes "mean", the window figures appear only once enough rows
exist to be the window they name, ttft says median, and every history column carries a
title= spelling out what it averages and over what. A legend that has to be inferred
from a column header gets inferred wrong.
The prefill instrument. The history computed prefill speed as prompt tokens over
time-to-first-token, which charges queue wait to prefill; GUIDE:2808 warns against
exactly that formula. The scheduler now stamps admission and reports prefill_s, so the
column measures admission to first token. The page falls back to ttft when an engine
reports no admission time, so it still works against a stock build.
Windows in seconds. Every displayed window was a sample count, so "60s" meant 60 samples
and its span drifted with the poll rate: 60s at 500 ms, 6s at 100 ms. The rings now prune
by accumulated time and the sparkline's x axis is time-proportional rather than sample
index, so a busy stretch gets the room its seconds deserve and a gap in the samples shows
as a gap in the line. This is the precondition for the interval control below; at a fixed
rate the two agree, so a full ring draws exactly as before.
The interval control. An Advanced view with two editable fields, idle and busy, held in
localStorage: the cadence belongs to whoever is reading, not to what is serving, and the
server has no writable config that would survive an image swap. Both are plain numbers
rather than a mode switch, because the point is that the reader sets the rate; equal
values are one fixed rate and the summary says so.
Wind-down. The tile detail lines now sample on every poll, so "recent" follows the
engine's own idle decay instead of holding the last figure it saw, and a window older than
its own span is cleared rather than drawn as if continuous.
Fixes from an independent review on qwen, which found the first two:
admitted_us was never reset when a slot was recycled. add_locked only allocates when the
slot's pointer is null, so the struct survives release_locked with every field it does not
list intact, and the first-admission guard then kept the previous request's stamp. The
interval spans two requests, the stale stamp is always older, so prefill tok/s reads low
rather than missing. It reaches every row once the slot pool turns over. It feeds only
this one dashboard column: the engine-wide prefill tile uses an independent windowed
counter, and no admission, eviction, preemption or KV path reads the field.
Two tooltips still said prefill includes queue wait after the instrument stopped charging
it. Both now say what the code does and disclose the fallback, since one window can mix
rows measured from admission with rows fallen back to ttft.
Verified: both targets build clean. dashboard_test 241 checks over 8 cases, sched_test
62644 over 184, no failures. The new sched_test case drives submit, finish, reap and a
second submit onto the recycled slot and asserts prefill_s never exceeds ttft_s, since
admission cannot precede arrival; it fails against the bug and passes after the fix, so it
can fail. The embedded page parses under node --check, and 30 checks now execute the
shipped spark(), the clamp and the cadence trigger sliced out of the page rather than
restated: time-proportional spacing, the right-edge fill at startup, a sample gap drawn as
a line gap, the 100 ms floor, and the old storage key migrating to a flat rate. Not
tested: the controls' behavior in a real browser, and how the session extreme should read
when it outlives a cleared window.
Found in review by an independent qwen workstream; the slot-reuse finding was confirmed
by a second adversarial pass and against the source independently.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
The memory panel rebuilds its per-card rows when the card count changes, but the
rebuild only appended: the previous set stayed in #mem. Every card-count change --
a TP flip, a card swap, a lane re-pin -- therefore grew the panel by the old count,
permanently, until the page was reloaded. On a box that flips TP2 and TP4 by hand
the section becomes unusable within a day: eighteen rows of identical cards after
three flips, and the panel's own header (KV cache, prefix hits) scrolls away.
Remove the old rows before rebuilding, the same shape the request rows already use
above. Per-row removal rather than the sibling guards' container-clear because #mem
is shared with the KV and prefix meters, which are built once and must survive.
Verified: the embedded page parses (node --check on the extracted script), the
translation unit compiles, dashboard_test passes. The behavior itself -- rows gone
after a count change -- needs a live card-count change to prove; not tested here.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI
Add totals over the selected time range: prompt tokens in, prompt tokens
read from cache (attention cache and linear checkpoint), prompt tokens
computed, generated tokens out and finished requests. They use counters
that /metrics already has.
Move Refused / failed to the first row. The status row is now second.
The ratio panels move below the throughput section. No panel is removed
and no panel id changes.
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.
The residual junctions take the `_i8g` twins where the linear after them reads quant_act_i8g's
pair, so the prefill overlap runs on these trunks too. An a4 or w5 linear reads an f16 copy of
its input up to 64 rows: in such a step its junction also writes the bf16 norm output into the
linear's input row, where the unfused norm would, and the cast and w4a16_asym / w5a16 run as
before; the feed-forward keeps gelu_mul there. At four ranks the all-reduce is issued apart.
arch_test: the 31B on the three grids at one, two and four ranks -- the junctions, the decode
band's bf16 row, the same GEMMs and casts as the unfused step, the slices against the whole
step, codes and scales of every int8 pair on the same rows -- and the E4B form.
The norm junction (post-norm, residual add, scalar, norm), the gelu product and the two-rank
all-reduce junction with quant_act_i8g's quantiser in place of quant_act_i8's: row-major int8
codes and an f32 scale per (row, 128 columns), what gemm_nt_q reads at i8a8, w4a8i8_asym and
w5a8i8. The kernels are rmsnorm_quant_i8's and gelu_mul_quant_i8's; only the epilogue over the
staged bf16 row differs (r4d_q8.h, q8_row_i8g: quant_act_i8g's mapping and rule), so each is
byte-identical to its chain ending in quant_act_i8g. out_bf16 may be x's own buffer. No
four-rank form: a four-rank caller finds no row and issues the all-reduce apart.
r4d_selftest: rmsnorm_quant_i8g, gelu_mul_quant_i8g and ar_rmsnorm_quant_i8g (two cards) against
their chains, the junction also with out_bf16 over x.
a4 at five bits: u5 codes, a u8 zero point (0..31) and an f16 scale per [1 x 128] (libquant
`codes=u5 zero=u8 group=128 scale=f16`), ParoQuant int5's grid with no rotation. Read by w5a8i8
over quant_act_i8g's per-(row, 128) int8 activation above 64 rows and by w5a16 over the input cast
to f16 up to 64, as a4 reads w4a8i8_asym and w4a16_asym; q|k|v stay one GEMM. The views, row parts
and column cuts are a4's.
arch_test: the 31B form on both asymmetric grids at one and two ranks.
The h256 prefill online-softmax branch must remain wave-uniform, but the
previous branch let one row's growth vote make every row update its reference
maximum. A row's rounding could therefore depend on which other rows shared
the launch.
Keep the branch uniform and make each row update only when its own cross-half
maximum exceeds its own `m_ref + PGROW`. Rows below threshold retain `m_ref`.
This fixes row-coupled rescaling; it does not claim full-model bitwise
invariance across chunk sizes, since other shape-dependent paths remain.
The dedicated regression selector is `--case attn_prefill_rows` (exact match;
`--case rows` is not recognized). The older kernel-name selector runs the
regression only for that named GQA row; rerunning it for GQA4 also passes the
row checks. Three launch pairs run on six BF16 head-256 rows: GQA 2/4/6/8/12
and GQA6 with 4-token pages (18 assertions).
Against v1.15.1, 17/18 assertions failed; with this change 18/18 pass
bit-identically. For Spark GQA4, the baseline 58/128 pair differs in
588/118,784 elements (max abs 0.00195). Although this implementation file is
named `gqa6`, the parameterized body is included by the other head-256 GQA
wrappers too.
Controlled 917-token Spark BF16 rerun (same prompt, binary, model, TP1, BF16
KV, no prefix cache; only libr4d changed): chunk 128 vs 1024 kept top token 198
and all 20 candidates in common before and after. Maximum shared top-20
log-probability delta was 0.23717 on v1.15.1 and 0.28474 with this patch.
This example does not improve; it is included to avoid claiming general chunk
invariance. The earlier raw full-vocabulary pre-fix result (131,070/131,072
logits changed, max abs 0.46925) has no matching post-fix capture; the paired
API top-20 comparison is the comparable result.
On a separate 32-document, 31,391-position BF16 evaluation, chunk-1024 vs
chunk-128 reference achieved 99.49% top-1 agreement (31,231/31,391): 160
positions still choose a different top token between chunk shapes, not against
external ground truth. Mean KL was 0.000879, median 1.29e-5, p99 0.00462,
p99.9 0.10119, max 3.2961. The pre-fix result on this exact set was not
measured. At the separately
investigated scored row 461 (document 20, token position 477), prefix replay's
recorded top token 62594 was replaced by 2561 before the fix; after it, token
62594 was restored with a 0.184-nat top-token log-probability gap. That
0.184 is not a full-set KL, and the 3.296 maximum comes from the separate
31,391-position evaluation.
Fast CTest: 141/141. Full card selftest still has one unrelated
`hc_read_e4m3` prefill-tile failure, reproducible on untouched v1.15.1. No
throughput improvement is claimed or measured.
1.15's kR4dSumLanes partition folds a row's sum of squares over 256 lanes
whatever the block width, so a 1024-thread decode block reads it back with a
quarter of its threads, one read at a time: a Gemma 3 sandwich norm re-reads
the 5376-wide row it has just written twice, 21 dependent loads a lane each.
TranslateGemma 27B lost 5 % of its decode (four streams 225.0 / 227.2 tok/s a
stream against 238.2 / 239.7 on 1.14; ar_rmsnorm_post_quant_fp8 3.1 -> 5.1 ms
a step under --profile-ops).
r4d_lanes_sumsq (r4d_common.h) keeps the partition and the order of the adds
and only batches the reads, eight before their adds; libr4d is built
-ffp-contract=off, so every bit stays the same (greedy Qwen 300/300 x2 and
TranslateGemma 6/6 identical to the merge without it). Used by both
lanes_sumsq copies and rmsnorm_body's two loops. TranslateGemma back to
238.9 / 239.3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A self-contained HIP kernel plugin for gfx11 (RDNA3) that exposes the
libref-declared ops as device rows the engine can tune and dispatch:
* GEMMs (bf16, f16, int8-activation, vocab) retiled to 16x128 on the
wave-matrix (WMMA) builtins. The retile removes the 8x wave
redundancy of the naive tile and stages the activation once per
16x128 block; the 16-row and 64-row forms share the stage. The k-walk
double-buffers the 128-deep tile (the next tile stages while the
current one multiplies), on the m64 and tiled forms.
* Quantised GEMMs: fp8-e4m3 x e4m3 (tiled and ALU), mxfp4 x a8, w2a8,
w4a16, w5a16, w8a8 (the prefill heights 17..127 on the wave matrix),
and the gated (swiglu) form. E4M3 decodes exactly to f16 through a
256-entry LDS table; the WMMA fragments bit-cast the staged halfs
(a uint16-to-_Float16 assignment is a value conversion, not a
reinterpret).
* Half-precision-accumulate arms (acc = 1) on the m64 wave matrix:
the f16/bf16 16x16x16 builtins with the compile-time opsel half
select.
* Grouped MoE GEMMs (bf16, e4m3 with F32 block scales, mxfp4a8, w4a8),
retiled the same way, over the run-walk / gather structure.
* Normalisation (layernorm / rmsnorm) and the quantisation ops.
* GDN linear-attention, the QSA/KV state ops, and the MoE
router/scatter/gather family (router_topk_scatter, router_sigmoid_topk
with the correction bias, moe_gather, moe_gather_inv; the top-k
router runs to n_expert 512).
Every row implements an op libref declares; the selector (tune) picks
the implementation and the NOTUNE rows carry the untuned default.
Selftest-clean (121 rows, schema + finiteness); values verified against
CPU references per op.
Fixed:
- A preempted prefill no longer parks the engine: once its wait is overdue the scheduler
reclaims prefix-cache blocks over several rounds, returns leaked state slots when nothing is
running, preempts only decoding requests it is ahead of (never one still building its prompt),
and fails a recompute an empty pool cannot hold instead of waiting forever. Before, concurrent
long requests that filled the KV pool could preempt every runner and leave all of them waiting
with nothing running while /health answered 200 (#360)
- A scored request's candidate list is capped at 4096 ids, and a step whose pinned scored rows
cannot be allocated cancels those requests instead of stopping the engine
- qwen4exp: the pinned copy of the window bounds is freed when a rank's model is re-declared
Server hardening:
- Keyless loopback-only routes need a loopback socket, a matching Origin and a Host naming the
loopback or --allow-host; a TLS proxy on loopback no longer makes every client local
- --trusted-proxy CIDR (repeatable): X-Forwarded-For from a vouched network names the caller in
the logs; authority still reads the socket
- A 401 closes the connection; drains of unread bodies are bounded; multipart form fields and
buffered Anthropic tool-call arguments are parsed under the same size and depth gates as JSON
- 500s carry a generic message on the wire (the reason stays in the log), client text in log lines
is sanitised, and a security-relevant header sent twice is refused
- An empty --api-key value stays a startup error (now pinned by a test)
- hfget.sh vets a repo listing's file names before fetching and hashes each LFS download against
its oid
- cpp-httplib v0.64.0; vendor/SHA256SUMS pins every vendored file (ctest vendor_sums), and
.woodpecker.yml runs the host suite on every push
Thanks to @baKon (#360) and @fl0l0u.
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.
Eighteen upstream releases, taken the way the lift was taken: the
split pair llama.cpp now carries (1ab23c33b), against the cpp-httplib
v0.64.0 tag. The vendored pair before this commit was byte-identical
to the old base plus patch 0022 -- re-checked against the pinned lift
commit, not taken on faith.
0022 was written because upstream's keep-alive drain could be paced
one byte per socket timeout forever, and because a refused request's
unread body had no reason to be drained at all. v0.64.0 does both of
those itself: every 4xx/5xx response now carries Connection: close,
a scope_exit in write_response closes the socket when it sees that
option, the drain is skipped for any response committed to close, and
a drain that does run is bounded by a 256 KB cap, the connection's
read timeout as a total, and an immediate close for a part-read body.
The old patch applied nowhere, and mostly needed to be nothing.
What one line is still owed: the library bounds the drain's time only
by the connection's read timeout -- the same knob that bounds a whole
request's reads, uploads included, so lowering it would cap uploads
too. The reworked patch gives the drain a five-second budget of its
own. transport_test's cases for the refusal and the stalled drain are
unchanged: they pin the behavior, whoever in the tree implements it.
Also new in this window and watched with interest: set_trusted_proxies
arrives with real IP matching -- the seam a coming commit wires.
Manifest regenerated; vendor_sums green.
declare() resets the rank's Model with Model{} on every re-declare --
every rebuild, every sizing probe, every test case -- and the reset
drops pipe_cu_h, the once-made pinned copy of the window bounds, on the
floor: the pointer is overwritten and the pin leaks. arch_test flags it
under the asan tier (qsa_a_widened_step...: 8 bytes, calloc,
pipe_bounds), and the leak grows one pin per re-declare of a rank.
Free the copy where it is dropped. The copy is read only by a widened
step's memcpys, and no step runs across a declare.
Two standing gaps in how this tree is guarded.
vendor/ records what every lifted file is and what we changed, in prose
-- prose nothing enforces. vendor/SHA256SUMS is the mechanical half:
all 73 files under vendor/, the lifts, the patch series and the record
itself, hashed; tests/vendor_sums.sh recomputes both directions -- a
file whose content drifted from its record, and a file that arrived
without being recorded -- and fails the suite (ctest: vendor_sums, in
the fast tier). An unrecorded change to a lifted dependency now has to
survive being a committed manifest update to ship, instead of slipping
through a rebase the way 33108e4's silent reverts did through this
branch's history.
And no CI ran the suite at all. .woodpecker.yml (Codeberg CI) builds
CPU-only with the media codecs present and runs the host preset --
everything but the gpu and oot tiers. The runner is the current Ubuntu
LTS deliberately: the mp4 writer binds FFmpeg's >= 7 AVIO callbacks and
24.04's 6.1 does not compile it.
Rehearsed on a native Ubuntu 26.04 box -- the same gcc 15.2 the image
carries -- the host preset fails eight cases on this branch, and the
same eight on plain upstream/main: arch, chatparse, engine_e2e, two
gbnf shards, place, quant_ggml and avx_check. Pre-existing under gcc
15, partly machine-dependent (avx_check compares kernels op by op on
the CPU it finds, and the gbnf shards flip under load); this branch
adds none of them. CI's first red is upstream's to see.
The --model repo-id path trusts the hub with the machine's filesystem and
the container runs with the kernel's door off. Both stop here.
hfget.sh trusted a listing's file names to be names: an absolute path or
a .. segment wrote wherever the destination's owner could write, and a
name shadowing .hfget-manifest taught the next run whatever it liked. A
listing is now vetted whole before anything is fetched -- absolute
paths, .. segments, control characters (a tab splices one entry into two
fields), names of hfget's own manifest -- and a child refuses a path
that would escape anyway. Silent skipping was the alternative, and it
leaves a directory that reads as complete and is not.
And the content key was the hub's claim, never checked: an LFS file was
kept for its size and its claimed oid recorded without ever hashing the
download, so a swapped file of equal length -- or a spliced resume at
any length -- passed forever after. The download is hashed on arrival
and kept only when it matches the claimed sha256; a mismatch deletes the
file, and the manifest now certifies verified content.
--model-revision REV fetches at a branch, tag, sha or refs/pr/N instead
of the moving main: without it a restart can serve weights nobody
reviewed, and the guide now says to name one.
--api-key-env NAME reads the key from the environment, where only the
process and root can reach it, not the command line where every process
on the host reads it in ps; an unset or empty variable refuses startup
exactly like an empty --api-key. The compose files carry the key
through environment: now -- the fail-closed :? guard moves with it --
across all 52 model files.
And the containers' seccomp=unconfined has a way out: Docker's default
profile, plus exactly the calls that forced the escape -- io_uring for
the n-gram table, mbind/set_mempolicy/get_mempolicy for ROCm's NUMA
binding -- is shipped as seccomp-radiance.json and selected through
RADIANCE_SECCOMP; the default stays unconfined until each operator
audits their own card stack. Verified: under the profile io_uring_setup
and set_mempolicy behave as under unconfined and a non-listed syscall
earns EPERM.
hf_model_test: the escape-listing refusal, the oid verify (bad rejected
and deleted, good certified), the pinned revision fetched -- against a
fake curl for a hub. config_test: --api-key-env fails closed unset,
reads the key set. ASan+UBSan: config/diag/hf_model/server/transport/
wire/lifecycle, 8/8.
Four ways the server told more about itself than the caller earned.
The exception handler logged e.what() sanitized and then put the raw
string on the wire: a 500 whose message echoes request text is a
reflection point, and one that quotes how a handler broke names the
server's internals to whoever prodded it. The wire gets the generic
sentence now; the reason stays in the log. The realtime and speech
sockets caught their session's exception the same way -- raw what() to
the log and onto the client's error event -- and follow. Their WebSocket
wrapper logged e.what() and the request path unsanitized: the path is
fully client text, and a client that can put CRLF and an escape sequence
into a log line can forge the next one.
A security-relevant header sent twice is a request built to be read two
ways: this server reads the first copy, a proxy in front may read the
last or join them, and whichever copy the disagreement lands on, the
attacker picked it. Host, Authorization, X-Api-Key and Origin are
refused whole at 400 before either reader -- the key gate included --
even when every copy carries a valid key. The lookup is
case-insensitive, so an Authorization beside an authorization counts.
And the model card's `root` is a path on this machine, served to anyone
/v1/models admits. Keyless, it now belongs to the local operator, the
rule /diagnostics and the LoRA admin already follow; with a key it
travels with the key.
server_test: the_models_root_path_follows_the_key. transport_test:
a_duplicated_security_header_is_refused. ASan+UBSan: server/transport/
wire/stream/speech/speech_stream/dashboard, 7/7.
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.
Three ways a client spent the server's patience or memory without ever
being admitted:
The gate's 401 answers before any handler sees the request, so its body
sits unread on a keep-alive socket, and httplib's anti-smuggling drain
will wait for it: one byte per read timeout paces a whole worker, at the
pacing client's chosen rate. The refusal now closes the connection
instead, says so on the response, and buries the body with the socket --
which is also what makes draining a refusal pointless.
A drain that does have a purpose -- a framed body on a request the
router answered without reading it -- inherits the stream's 30 s read
wait per packet gap and no total bound at all. It keeps both waits now:
five seconds per gap (the stream's own set_read_timeout, the same knob
the WebSocket upgrade uses) and five in total (a deadline the discard
provider checks), then the connection dies and the timeout is restored
for whatever the connection still has coming.
And bodies. The per-request cap bounds one body and no sum, every byte
of a body is buffered before parse, admission or any accounting sees
it, and a few hundred concurrent large POSTs is an OOM that reaches the
engine before any refusal does. read_and_bridge now holds every buffered
byte against a transport-wide budget and answers 429 with Retry-After to
the newcomer the budget has no room for; the reservation releases on
every exit, including the peer vanishing mid-body. The budget defaults
to eight bodies at the per-request cap and moves through
ServerOptions::max_inflight_body_bytes.
Vendor: the two httplib hunks are recorded as patches/0022, and
UPSTREAM's "no file content differs" for the pair is replaced with what
the split actually is and what is now edited in it.
transport_test: a_refusal_closes_the_connection,
a_stalled_drain_dies_on_its_deadline, the_inflight_body_budget. ASan+UBSan:
transport/wire/lifecycle/server/config/diag/dashboard, 7/7.
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.
Three ways in, each ending in a parse that bounds neither what it
builds nor how deep it nests:
videos.cpp read its multipart form fields with the raw parser, so a
512 MiB field of brackets died at the tree's teardown; the same file's
JSON path was bounded, so the form path now shares its gate, and a
field over budget or over depth reads as a bad parse (a form test pins
both refusals and a well-formed field).
Anthropic's buffered body parsed the model's tool-call arguments
directly; the streaming path already scans them with json_complete,
whose depth cap keeps a cooperating model from stack-killing the
worker, and the buffered body now passes the same gate, reading too
deep as an empty input.
The image decoders checked the container header's dimensions against
the pixel cap but converted whatever the bitstream actually decoded;
a container whose SPS disagrees with its header slipped through. Both
now re-check the decoded frame, as the video path already does. The
re-check is inside RAD_HAVE_FFMPEG and compiles with every FFmpeg
build; the media-less container proves the two server changes.
d773992 restored the refusal 33108e4 had silently taken back, so the
behavior is main's again. What no branch carried was a test. The hunk
was written once, merged, and deleted by a stale rebase with nothing
noticing until an audit read the parser; an empty --api-key value --
a unit file whose $RADIANCE_API_KEY was never set -- must stay a
startup error, so a config_test case says so, and the next silent
overwrite trips a test instead of an audit.
The whole-recompute gate refused a preempted request forever when the pool held only cache entries, and an empty running set left a leaked state slot unreclaimed. Reclaim the cache over several rounds, release idle state slots when nothing is running, and admit the overdue waiter if it can ever fit. A prefill is never a victim while a decoder is running; tests cover the deadlock, the leaked slot, and the lost KV sequence.
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.
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
The file tier read every file-tier unit of a routed layer whether or not
the router sent rows to it. A deep layer keeps whole experts on the drive
(288 per world), but a pass routes rows to a handful of them: the read
volume was ~18x what the router justified, and the engine streamed
~378 GiB from the SSD per run at 2.05 tok/s (GLM-5.3-Flash, TP2).
The layer's router has run by the time the stager triggers -- the
trigger is the layer's first expert op -- so the pass's route counts are
already on the device. Ctx::route_counts_device exposes them; the file
stager hands them to Mover::stage_file_units, and an expert counted
zero, which has no sorted rows and no GEMM run naming it, is left on the
drive: its weights are not read at all. Its table entries are published
at a valid dummy address (the calm region) for the pass and nulled again
with the staged units, because the kernels still issue the layer's table
and a null entry fails the step. Published even when EVERY unit of the
layer is skipped -- a decode step can route nothing to a layer.
The drafter's own weights (the "mtp." namespace) run on every draft pass
of every decode step, more often than anything a profile could rank, so
the planner pins them in the host pool ahead of everything ranked
(MoveUnit::draft_head) instead of letting the expert fill push them to
the file tier every step.
Read extents are also clamped to the container file's size, so a
truncated container fails a read loudly instead of reading past EOF.
Measured on GLM-5.3-Flash TP2 (2x Radeon R9700), 250-token essay at
temp 0: 3.4-3.6 tok/s where main gives 1.42 on the same prompt.
Assisted-by: GLM-5.3-Flash
Main's glm5next width-shards the routed experts unconditionally
(GlmTp::expert_width, ff_lo/ff_hi): an expert's stored form is a shard
across ranks, so --weights-disk-tier refuses it and a 151 GiB expert set
cannot leave VRAM at any pool size. The helper's expert-parallel
declaration (expert_base windows, RAD_SHARD_NONE, no ff spans) already
exists upstream -- qwen4exp uses it -- so this retargets glm5next onto it:
each rank owns 288/world whole experts, the routed arm's buffers
full-width (FE), the shared expert still width-sharded, world 1 unchanged,
and a shape probe's rank >= world clamps to rank 0's window.
Fixes the 24.78 GiB "no eligible tier" startup OOM on 2-card hosts; the
world-8 graph pin is re-recorded from the test's own pin: printout.
Assisted-by: GLM-5.3-Flash
Main's stall watchdog samples only the queues' read indices, and the DMA
lane trusts the SDMA queue's written-back read pointer for its room check.
Both stall wrongly: a drive-paced prefill parks every queue for seconds
(one rank spins at the all-reduce while the other reads its layer off the
drive -- spurious dumps), and the SDMA engine's written-back read pointer
can stop moving while the engine runs on -- a full ring then waits forever,
wedging the startup pool fill above ~32 GiB/rank.
pread_exact counts the bytes it returns (rad::dio_progress); every O_DIRECT
read funnels through it, and read_progress adds that to the queues' read
indices: a wait that moves nothing anywhere is a hang however slow the
drives are, so the threshold is a flat 5 s and every stall report is
genuine. The main DMA lane names its lists the way the xp queue already
does -- each list ends by writing its number to a word the engine keeps
advancing (fin/ends) -- and dma_read takes the further of that fence and
the read pointer, so the room check can no longer mistake a stalled
writeback for a stalled engine. dump_dma_lanes reports the finished-list
count.
Verified on the wedge reproducer: GLM startup with a 36000 MiB pool fill,
decode with promotions, and a 13300-word drive-paced prefill -- zero
spurious dumps, the ring live throughout.
Assisted-by: GLM-5.3-Flash
33108e48 (the preempted-prefill gate's wait bound) was cut from an older main and, landing, took
back three changes that had merged before it:
- a28221eb: a prompt id outside the vocabulary is refused at admission (Scheduler::add_locked),
never staged into a pass where the embedding gather faults the device and stops the engine; and
its test, a_prompt_names_real_vocabulary_rows.
- b9c685a9: --api-key "" is a startup error, not a server that looks guarded and answers every
keyless request; and the guide's lines on it and on the loopback-only routes.
- ed1e5caf: a scored row the step in flight finishes gets no step issued ahead; and its two tests,
the non-scored one with a token left after the step in flight so that a step ahead exists (#349).
The wait bound itself, the lookup index and the rest of 33108e48 are unchanged. sched_test 176,
config_test 62 and server_test 177 cases pass.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qthwau4zwWgAaD8vZrycp1
Every program carries a sentinel KV group at index 0. KVGeom reads its decl.kind 0 as RAD_KV_FULL
with block size 1, while the manager's plan for it pages nothing and owns no block. The gate
(e668d49) walked every group KVGeom calls paged, so for the sentinel it wanted the whole prompt,
one block a token, out of a pool of none: a preempted request was never readmitted. The bound on
the wait (33108e4) cannot help, since preempting running requests frees nothing in that group.
engine_e2e_test's qwen35_preemption_by_recompute_changes_no_logit hung on it (the KL recording of a
small pool: one preempted document, nothing left running); with the group skipped it passes in
0.9 s. It may also be the live request in #346 that waited 710 s with gen=0.
The gate now skips a group with no blocks (total_blocks 0), as KVManager::ensure skips a group its
plan does not page.
sched_test: a_preempted_prefill_ignores_a_kv_group_that_holds_no_blocks (a group the scheduler sees
as full and the manager as empty; the preempted request stayed Preempted after the pool emptied
before the fix). 173 cases pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The prefill KV split (6a7824a) stores each segment's row sum under `if (h == 0)`, so only half the
wave consumes `l_i += swap16(l_i)`. A compiler may sink the exchange into that half, where
v_permlanex16 with fi = 0 reads the lane's own value for the inactive partner, and the stored sum is
then twice one half's instead of the pair's: the merge normalises by the wrong total. The decode
kernel's f32-partial path has the same shape (lrow read under `if (h == 0)` only).
swap16_fi sets fetch-inactive, so the partner's half is read whatever exec says. With every lane
active it is the same exchange. Found by sabi-noema and posted by mordae in #328; this is their
helper and prefill change, plus the decode path.
The compilers I have do not sink it: in this tree's build (ROCm 10.1) and in the published 1.14.0
libr4d.so, every split instance of the h256/gqa6 prefill kernel exchanges before the `h == 0` mask.
So the fix changes the code (op_sel:[1,0] on those exchanges, a register shuffle around them) but
not the results here, and no test here can fail without it. r4d_selftest: the h256/gqa6 prefill and
decode rows, every cache layout, 453 checks, 0 failures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The checkpoint's own encoder writes an assistant turn as reasoning followed by a sectioned DSML call block, with each argument tag naming string or JSON. The template analysis cannot state those typed tags, so the format is declared as data and chatparse_test reads it back. Split from #266; no model plugin or kernels.
75b4c92 brought the kernel side of KLATE (tile t+1 K fetched once tile t has its scores) and set
P_OPT to (3954187 | O_KLATE) in this launcher; a later merge restored the old P_OPT line, so the
kernel code is there but Qwen3.8 prefill no longer takes it. This puts the bit back. Load order
only: the bytes are the same.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
49ca5ff made a three-wave verify past 16k keep at least 64 segments a sequence. The declared scratch
is the worst over every sequence count up to max_seqs, so at 256 sequences it became 64x the law's:
h256/gqa12 at max_ctx 200000 went from 7.62 to 487.5 MiB a card, and the KV pool lost that (#342:
5-8 % prefill on an expert-tiered MoE).
The floor is now min(64, 1024 / units), units = KV heads x sequences. Up to eight sequences of two
KV heads it stays 64; at 16 it is 32, at 256 two, and the declared region stays at what eight
sequences need.
Measured on 2x R9700, Qwen3.8-27B MXFP4 TP2, k6_v4, speculation 7 without the short block (every
step an 8-row verify), forced segment counts, ms a decode step:
45k x8 64: 41.24, 32: 41.20, 16: 42.29
45k x12 64: 57.42, 32: 57.38, 16: 59.39
45k x16 64: 74.83, 32: 74.68, 16: 74.79
90k x8 64: 51.79, 32: 52.02, 16: 54.42
Up to 64 segments past eight sequences changes nothing; the new floor gives x12 42 and x16 32.
r4d_selftest's split-law case pins the region at 16 sequences (100k and 32k: 32 segments) and at
256 (2); it read 64 for all three before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every linear of the trunk is a LinearFP8, so the container's encoding decides the
GEMM: bf16 stays `gemm_nt` exactly as before, a recipe's block E4M3 is gemm_nt_q at
fp8a8 over an activation quantised once per producer, and int8 is gemm_nt_q at
i8a8. The format is read off layer 0's first linear; a trunk mixing formats is
refused by name. The convolution, the norms and attention stay bf16.
On a block-fp8 trunk the fused producers run: rmsnorm_quant_fp8 with a fold for
each mixer's norm (the previous block's residual add included) and MlpFP8 for the
feed-forward, whose gate|up GEMM applies SiLU(gate) * up and quantises in its
epilogue. The convolution's C * conv(B * x) and the codes its out projection reads
become one gate_quant_fp8 at act none. `gemm_nt_q_gated_wide` puts whole prompts
through the fold instead of falling back to the pair past 64 rows; k and v ask
for `gemm_nt_q_short`; the head norms and rope ask for `rmsnorm_rows` and
`rope_rows`. Each of those is the model's own declaration, so no other
architecture's path moves.
The lm_head is read at its stored codes (bf16, or E4M3/int8 where a recipe made
it so, logits_gemm_fp8/_i8). A tied head also declares the final-normed rows and
the embedding table to the core (rad_declare_scores), so a scored step needs no
head read at all.
data/recipes/d1-3b-fp8.recipe: all 30 layers' linears to E4M3 with a bf16 scale a
128x128 block; the tied head to int8 per row per 128 columns.
Co-Authored-By: Pi <pi@localhost>
Four rows of our own, each declared only by a model that asks for it, so every
other caller keeps the row and the bits it had:
gemm_nt_q_gated_wide gemm_nt_q_gated at every M: the narrow tile to 64 rows
and, past them, the gated prefill tile (128 gate and
128 up rows against 64 activation rows a block), whose
accumulators are the unfused prefill GEMM's. The
narrow row keeps its M <= 64 ceiling and kernel.
gemm_nt_q_short the narrow fp8 row with the short-prompt split rule:
N <= 512, K <= 5120 and 41..64 rows run unsplit, where
the split's per-slice floors dominate. Its scratch hook
makes the same choice, so the arena matches the launch.
rmsnorm_rows the same norm; at n <= 256 and 1024 or more rows a wave
a row, its sums in rmsnorm_kernel's wave order.
rope_rows the same rotation; at 64 or more rows and 4 or more
heads one angle a (token, pair), every head turned with
it, byte-identical to rope.
gate_quant_fp8 gains act none: the plain product (`mul` then the quantiser) in
one pass, rounded once as mul_bf16 rounds it. Its `mode` stays 1 by default, so
the sigmoid producer every other model issues is unchanged.
r4d_selftest: the act-none chain against mul + quant_act_fp8 at M 1, 8 and 65 with
strided sources and without out_bf16; gemm_nt_q_gated_wide against the tiled
GEMM + gated_quant_fp8 at 65 and 129 rows; and the RDNA4 device phase accepts
gfx1200 beside gfx1201, where the card this was measured on lives.
docs/OPS.md carries the four rows ops_doc checks.
Co-Authored-By: Pi <pi@localhost>
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>
/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.
Prepared for exposing the dashboard and the API beyond the local machine. Each piece
answers a finding from the review; none changes what a legitimate client sees.
Parsing. Six entry points still called json::parse with no bound on the tree: the two
WebSocket sessions, the image form's loras field, the two re-parses of template kwargs,
the control-vector POST and the lora-admin body. A legal frame or body of brackets alone
built a tree whose teardown recurses once per level -- one worker stack, one process.
They all go through parse_json_bounded now, the body cap's own value and depth limits.
The same reasoning already refused deep bodies on the generation routes; frames and form
fields were the ones that never passed a gate.
Errors. ApiError::dump threw on invalid UTF-8, and URL-decoded params reach messages
without passing a JSON parser: a 404 becomes a 500, or worse a closed connection. The
dumps replace bad bytes instead of dying.
Logs. Session labels and echoed request text reach the log; an embedded newline forged a
line and an escape sequence drove the terminal reading it. log_sanitize filters control
bytes at the entry points -- labels, refusal logs, the exception handler -- while the
three loggers that print multi-line reports deliberately keep their newlines.
The browser. The dashboard page ships a CSP (its script talks only to its own origin)
and X-Frame-Options DENY; every response carries X-Content-Type-Options: nosniff. And
the loopback-only guards -- control-vector default, runtime LoRA, diagnostics -- now
treat a cross-origin browser as the remote client it is: a hostile page reaches them
through the victim's own browser, which is exactly loopback. Origin not matching Host
refuses; same-origin and non-browser traffic are untouched.
The gate. The API key's path exemptions are method-scoped (reads, plus the POST /ping of
the health-check convention), so an exemption can never ride a method no route answers.
An empty --api-key value is now a startup error rather than a server that looks guarded.
SSE. In the vendored httplib 0.46 an exception escaping a content provider aborts the
process; the provider ends the response instead. Upstream's 0.54 serve_guarded fixes the
cause -- the vendor lift is owed either way, and the catch is harmless belt until it.
The scored-prompt path (Request::token_scores) has always vetted its ids against the
vocabulary; the prompt itself never was. Raw id arrays arrive at admission verbatim from
the request body -- /v1/completions, /v1/embeddings and the generator take them -- and an
id past the embedding table is gathered by the step, fails it, and a failed step is a
device fault (spec 17): one request, {"prompt":[2147483647]}, ended every session on the
server. The check belongs at admission, where a refusal is a 400, not mid-pass, where it
is an exit.
The sched fixture's model declares 512 vocabulary rows and its requests spell prompts
from 1000 up; admission now refuses those, so the fixture's vocabulary moves above the
ids it uses.
decl_gated_fold_mx declared gemm_nt_q_gated_mx over 1..8 rows only, from
before libr4d had gemm_mxfp4a8_gated_gemv_wide (9..64, byte-identical to
gemv_wide followed by gated_quant_fp8, the pair it replaces). TranslateGemma
already folds to 64 through RADIANCE_G3_FOLD_ROWS; Qwen's 16-row verify steps
(two sequences at speculation 7) still ran gate_up and gated_quant_fp8 apart.
Qwen3.8-27B MXFP4 + DFlash2 at TP2 on 2x R9700, production flags, ms a decode
step, three interleaved rounds (medians), the 1..8 band -> folding to 32:
16 rows (x2): 1k 20.96 -> 20.78 (-0.9 %), 16k 21.96 -> 21.70 (-1.2 %)
32 rows (x4): 1k 23.97 -> 24.10 (+0.5 %), 16k 26.06 -> 25.98
32 rows (x8 short block): 1k 24.99 -> 25.14 (+0.6 %)
and 64 rows lost 2.1 % (16k x16) on the base before this main. So the band is
16: a taller step takes exactly main's path. Where the wide row does not
resolve (K at or under decode_shortk's corner), the declaration drops to 1..8
instead of losing the fold. Greedy output is identical to main (300 tokens,
two prompts).
arch_test: qwen35_fp8_mxfp4_feed_forward_folds_verify_steps_up_to_16_rows
(one and two sequences of 8 rows fold, three to eight take the pair).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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).
--host-headroom-mib is a courtesy to the system: the process's unpooled allocations, the
load's staging windows, the page cache. A linear-state snapshot store is not a courtesy.
A store too small for one snapshot does not serve a smaller store -- it serves none, and
every prefix hit re-prefills the whole conversation, while /metrics still counts the
attention blocks as a hit and the request log's "(cache 0)" is the only honest number.
--checkpoint-slots auto already promises a floor of kCheckpointSlotsFloor slots, but the
floor was only checked against what the host had left once the host pool, the streaming
mirror and the reserve had taken theirs. On a host where those fit exactly, the store
resolved to 0.
Charge the floor before the reserve: when the reserve is what stands between the host's
spare memory and the store's floor, it gives back exactly the shortfall -- whole MiB,
rounded up so the store is never a byte short, never below kHostReserveFloor (1 GiB) and
never above the margin the user asked for. A host that can pin the floor gets it; a host
that cannot still reports the shortfall, now naming --host-headroom-mib among the levers.
The boot guard a few lines below the sizing takes the same margin, or a count auto had
just fitted by giving the reserve back would be refused a moment later.
The rule is bytes over the host's own measurements: checkpoint_slots_want for the count,
MemAvailable, the memory cgroups and the driver's pin cap for the room. It needs no case
per model or per KV encoding -- a wider slot (more linear or windowed layers), a wider
streaming mirror (bf16 rather than fp8) and a larger --tp arrive as different numbers,
not as different rules.
Measured on 2x RX 9070 (16 GB), Qwen3.8-Flash-Next at --tp 2, bf16 KV, 2x262144,
--host-pool-mib 23652: 8 snapshots of 112.73 MiB, the reserve giving back 685 MiB and
holding 3.33 GiB (before: 0 snapshots, every turn re-prefilling 125-134k tokens at
ttft ~31 s with "(cache 0)"). The same 6398-token prompt twice: ttft 1.66 s -> 0.65 s,
cached 0 -> 5120, linear_checkpoints_written_total 0 -> 1.
Tests: the rule itself (fits -> untouched, short -> exactly the shortfall, beyond it ->
the 1 GiB floor, a smaller flag -> never exceeded) and checkpoint_slots_want against the
counts auto already reports.
At decode heights the recurrent update runs one workgroup per (sequence, head) and leaves the
card's memory mostly idle. Each delta-net layer now reads its out-projection (the whole weight,
7.9 MB a rank in MXFP4) into the on-die cache there, on the second lane behind a join from lane 0,
as prefetch_beside does beside the all-reduces. Up to four decode sequences and 32 rows; no read on
a step that carries a prompt's rows, at one rank, or where the deployment turns weight prefetch
off (RadBuildCtx::weight_prefetch_off: nothing is declared).
Qwen3.8-27B MXFP4 + DFlash2 at tp 2 on 2x R9700, production flags, 1k context, hwgrid ms/step,
median of five interleaved rounds, none -> whole projection:
x1 19.40 -> 19.10 (-1.5 %), x2 20.93 -> 20.78 (-0.7 %), x4 24.26 -> 24.17 (-0.4 %),
every round faster at each of the three;
x8 25.22 -> 25.48 (+1.0 %, four rounds of five slower) -- hence the four-sequence ceiling;
x16 (64 rows, no read) and 90k x4 unchanged. 4 MB reads as the whole.
Against this main (one round): x1 19.40 -> 19.15, other cells within noise.
Greedy output identical to the build without the read (300/300 tokens on two prompts, |dlogprob| 0).
arch_test: qwen35_fp8_reads_the_delta_net_out_projection_beside_its_decode_update; the qwen35_fp8
step pins move (prg_pins.py).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The full-attention decode law gives a three-wave workgroup (q_len * gqa > 32,
an 8-row DFlash2 verify at gqa 6) 128 / units segments whatever the depth.
Three to seven sequences of Qwen3.8-27B (two KV heads a rank) then get 21..9
segments, each walking 4-18k tokens at depth, and one or two sequences stay
at 64 / 32 where 256 / 128 are faster.
The law now reads the step's depth from the block table's width (max_blocks *
block_size, capped at max_ctx; the scheduler rounds the width to the batch's
longest sequence): up to 16k tokens 128 / units as before, past 16k at least
64, past 64k 512 / units capped at 256. Declare passes no table, so the
scratch is still sized at the declared bound, the deepest the law can be
asked for; the law grows with depth, so an issue never needs more.
Qwen3.8-27B MXFP4 + DFlash2 at TP2 on 2x R9700, k6_v4, speculation 7, ms a
decode step against this main:
x1 90k 22.07 -> 22.03 180k 25.35 -> 24.88
x2 90k 26.83 -> 26.36 180k 33.18 -> 31.99
x3 180k 42.41 -> 40.33
x4 90k 36.20 -> 34.96
Steps whose count does not change (1k x1..x8, the short block at 16k x16) are
within noise. Greedy output is identical (300 tokens, two prompts). The forced
segment sweeps behind the thresholds are in the comment.
r4d_selftest: decode_split_law_case reads the law through the decode scratch
hook's declare path, 21 batches across the depth thresholds.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
hc_role_wait, where hc_read_fused_kernel's B blocks wait for every A block, gave up after half a
second and went on, so a counter fault would have read a stale `d` and its scales and written
wrong values with no error. The all-reduce handshakes trap on the same condition (r4d_ar_seq.h,
r4d_ar_oneshot_2rank_exact.hip: a handshake that cannot complete is a lockstep violation); this
does the same. It cannot fire with the counters in order (each launch's last B block clears
them), so nothing that runs today changes.
libr4d/isa/res.sh: no hc kernel spills, hc_read_fused_kernel 126-147 VGPRs.
r4d_selftest --case hc_read_e4m3 and hc_read_bf16 on 890715f: 67 ok, 0 FAIL, the 24 byte-for-byte
comparisons against the previous decode kernels among them. --perfhc 4: 25.4 us a call (the
previous decode kernels 34.6), as before the change.
RDNA3's ISA lists exactly six wave-matrix instructions (f16, bf16, int8 and
int4 in; f32, f16, bf16 and i32 accumulating) and the toolchain emits them on
every gfx11 target; they run over multiple cycles driving the DOT pipeline
internally, and the MAC-core measurement on the 16-CU gfx1102 part confirms
it: f32-acc f16 19.11, f32-acc bf16 19.24, f16-acc f16 19.44, i32-acc i8
19.29 against the paired dot2 path's 18.86 TFLOP/s -- the same pipe within
three percent, matching the full-kernel 1.99-vs-1.97 already in r3d_common.h.
The i32-acc i4 tile is the exception at 25.68 TFLOP/s, 35% above, but it takes
i4 in both operands and the grids served here pair i8 activations against i4
and i2 weights: there is no mixed-precision integer WMMA on RDNA3, so that
pipe is unreachable from the w4a8 and w2a8 rows.
Commentary only -- the rationale passages in the README, CMakeLists.txt,
r3d_rows.cpp, r3d_plugin.h and r3d_selftest.cpp now state the measured
record; no kernel, lane map or numeric path changes, and the rebuilt library
is byte-identical (selftest 78 rows, 0 failed, 0 skipped).
A complete row set for the gfx11 family (1100/1101/1102/1103/1150/1151 plus gfx11-generic),
mirroring libr4d's structure: the quantised GEMM rows (m16, tiled, gated, the bf16 logits
gemm), the paged and ragged attention for decode and prefill, the KV store, the sampler
spine and the spec rows, with the recorded-fixture, board, selftest and comparison-driver
gates for each.
The gates are the record. Every row is measured against libref on the shape matrix: the
recorded fixture at 1153 cases with worst rel_l2 1.362e-03, the board's five modes with
bit-identical decision lines, the selftest at 74 rows, and the 233-case served-shape pairing
at 0 divergent against the tree libref. End-to-end on a 2B fp8 checkpoint served on the
card, coherent through prefix-cache adoption.
Two platform laws each shape the design. A kernel that calls device printf takes the
implicit hidden_hostcall_buffer argument and is undispatchable by the AQL backend, so the
trace records are plain stores behind a budget. And a plugin-owned __device__ global is not
a channel into the engine's dispatch path: in a dlopened plugin the runtime's symbol stub
is not the address the kernel's module writes, so the served trace channel is a hipMalloc'd
record slot passed as a kernel argument, with the device-global ring kept for the board.
kv_store bounds its slots at the pool's own plane (n_blocks x block_size), the span the
cache operand declares, not at the step's own span: a request that adopts a cached prefix
writes its new tokens at the allocator's global block indices, which sit past any bound
built from the step's token count, and a slot lost there is KV that attention then reads
stale. A corrupt slot map is dropped at the same bound.
DeepSeek's release carries no chat_template.jinja and its tokenizer_config.json
names none, so an HF-direct container answers /v1/chat/completions with 501
unless the serve passes --override-chat-template. The converter now takes the
template itself and bakes it into the vocab section, overriding whatever the
checkpoint carried or lacked. Trailing newlines are stripped as for a sibling
chat_template.jinja, and an unreadable or empty file is refused rather than
skipped. Both paths are covered: text_test reads the file, convert_test
converts the tiny checkpoint and reads the template back out of the container.
(cherry picked from commit 6381f61794cd61d1f86925fd23ea61e1b1544dfe)
engram_tables.py builds the Engram hash tables from the release's own tokenizer.json
and config.json, so rad-convert needs no llama.cpp converter run; imatrix_merge.py
fuses the gate/up imatrix entries llama.cpp's converter writes split, matching the
plugin's fused ffn_gate_up weights. The recipe is the UD-IQ1_S mix for the official
release (251.07 GiB plan).
The one-grid form and the pipelined tiled up-mix replaced hc_read_a_kernel, hc_up_mix_kernel and
hc_up_mix_tiled_kernel in place. Their previous forms are kept verbatim as *_prev, with
hc_up_mix_prev_launch launching the up-mix as before, and r4d_hc_read_pin_decode(1) selects them:
kernel A, then the up-mix in a second launch, and the tiled up-mix's K passes in sequence. 0, the
default, is the launcher's rule.
r4d_selftest's hc_decode_forms runs both on the same inputs on a real stream at 1 to 7 rows (each
one-grid instantiation), 8, 16, 32, 33 and 64 (the tiled up-mix at both row tiles), with E4M3 and
int8 codes, and compares x, the injected gains, the codes, their scales and the rotated twin byte
for byte. The two forms must dispatch different kernels (r4d_record_dispatches), so an ignored pin
fails: with the hook made a no-op, all 24 checks fail. For that the tiled up-mix now launches
through r4d_emit, so the dispatch log sees it. --perfhc times both under the launcher's prefill rule.
--perfhc M, cold (256 MiB through the caches), one R9700 at 240 W, three runs, medians, previous
-> rule: 1 row 32.3 -> 22.5 us (-30.3 %), 4 rows 34.8 -> 25.4 (-27.0 %), 8 rows 46.2 -> 43.3
(-6.3 %), 32 rows 51.1 -> 48.4 (-5.3 %). r4d_selftest --case hc_read_e4m3: 62 ok, 0 FAIL (24 of
them the new comparisons); hc_read_bf16: 5 ok.
libr4d/isa/res.sh: no hc kernel spills or uses scratch (195 kernels). hc_read_fused_kernel takes
126 to 147 VGPRs (9 or 10 waves). The pipelined tiled up-mix at its 32-row E4M3 tile takes 111
VGPRs where the previous one took 75 (12 waves a SIMD against 16), and is the faster of the two at
8 to 32 rows as measured above.
At 8 to 32 rows (two to eight streams at MTP 3) the up product with the mix ran its five K passes
as loads, barrier, WMMA, one after another. Its K loop now issues a pass's loads before staging
the previous pass from registers, with the mix's operands loaded alongside the first pass. The
barriers there order LDS only (hc_lds_barrier): __syncthreads() fences at workgroup scope, which
on gfx12 in WGP mode waits for every outstanding global load, so no prefetch survived it. The
quantise tail reads each thread's channels once, where it walked them a dependent load at a time.
Same fragments through the same WMMAs in the same K order, and the same tail arithmetic: the
output is bit-identical (compared byte for byte against the previous kernels in this series' last
commit).
r4d_selftest --perfhc M, cold, one R9700 at 240 W, three alternating rounds against 6c33ee4,
medians: 8 / 16 / 32 rows 46.6 / 47.8 / 51.4 -> 43.9 / 44.3 / 48.4 us (-5.8 / -7.3 / -5.8 %).
r4d_selftest --case hc_read_e4m3 and hc_read_bf16: 43 ok, 0 FAIL.
At one to seven rows hc_read is a chain of dependent latencies, not a stream of bytes: kernel A
is mostly its norm prologue and the L2 round trips around its dots, with memory idle meanwhile,
and kernel B cannot ask for W_up until A has ended. At Qwen3.8-Flash-Next's shape (hc 4, n 2560):
- A and B run as one grid (hc_read_fused_kernel), roles by ticket: a block's first act is an
atomic increment, tickets below `na` run A's body, the rest B's. A B block loads its W_up rows,
then waits until every A block is done. Every block holding a smaller ticket has started, so
the blocks it waits on are resident: no co-residency is assumed and none can deadlock. The last
B block past the wait clears the counters for the next launch on the stream (kHcSyncCtr more
words in the per-stream counter block), and a wait past half a second gives up rather than hang
the card. Without the counters the two kernels run as before.
- A's norm prologue loads all of a thread's h and norm gain at once, one round trip for ten.
- B's dot reads d from LDS as bf16, sixteen values in two 16-byte reads, two rows of W_up a thread.
- At four rows a wave computes its two W_down columns in one pass over N (hc8_dot_down2).
- Dynamic LDS starts 16-byte aligned: the fused kernel's static LDS is not a multiple of 16, and
misaligned N reads ran A three times slower.
- The quantise tail reads its group once instead of three times.
Every sum is the same fmaf sequence in the same order, so the output is bit-identical; this
series' last commit keeps the previous decode kernels behind a pin and r4d_selftest compares the
two byte for byte. Eight or more rows keep the tiled path.
r4d_selftest --perfhc M, cold (256 MiB through the caches), one R9700 at 240 W, three alternating
rounds against 6c33ee4, medians: 1 / 2 / 4 rows 32.7 / 33.2 / 34.7 -> 22.8 / 23.6 / 25.2 us
(-30 / -29 / -27 %); 8 and 32 rows unchanged. r4d_selftest --case hc_read_e4m3 and hc_read_bf16:
43 ok, 0 FAIL.
Pinned at 8 rows up to the wide row tile, the wide kernels refuse the shape (RAD_E_SHAPE: they
serve only the wide tile), and --perfhc stopped at that FAIL before timing anything, so hc_read
could not be timed at a verify step's 8 to 32 rows (two to eight streams at MTP 3). A pinned form
that refuses with RAD_E_SHAPE is now a skip; the forms that serve run, compare byte for byte and
time as before. The decode tiles' kernels, the first form, must still serve, and any other error
fails as before.
--perfhc 8 / 32 / 64, cold, one R9700: the decode tiles' kernels 46.5 / 51.2 / 81.0 us a call,
where each stopped at the FAIL before.
Two costs in gemm_fp8a8_body, which every fp8 and int8 linear at 64 rows or fewer runs
(gemm_fp8a8_nt_m16, gemm_i8a8_nt_m16, the bias and gated rows, and r4dchain_gemm_fp8a8):
- The fold loaded its weight and activation scales itself, after the next K tile's prefetch had
been issued. Loads return in order, so each fold waited for that whole prefetch, twice a tile at
FK 256, and the "one tile ahead" overlapped nothing. The scales are now staged through LDS a
tile ahead, beside the B tile: each thread loads one weight-scale dword and one activation scale
with its B prefetch and stores them with the B tile, so a fold reads LDS. Two registers a
thread; holding a tile's scales a lane (8 + 2*NT registers) spilled at the decode pins.
- The split-K finisher walked the partial planes token index fastest, `rows` floats apart, one
element a thread: a cache line a load and a round trip each, most of a 45 us call at N 512,
M 64. Consecutive threads now take consecutive weight rows, four rows a 16-byte load and four
loads in flight a plane; a shape off that alignment walks the rows fastest an element at a time.
The int8 single-tile wave pin goes from 12 to 10: the staged form needs a few more registers than
12 waves' 120 leave, gfx12 allocates them 24 at a time so 11 waves leave 120 too, and no decode
shape puts more than 8 of these waves on a SIMD. The gated three-tile form, at 8 waves since the
previous commit, spills 10 at 33-47 rows and 9 at 48 with the staging (0 and 7 without; at 9 waves
it would spill 70).
The same values are summed in the same order (each finished element from 0.0f in ascending split
index, rounded by the same rule) through the same WMMAs in the same K order: bit-identical. A dead
wave's fp8 block scale reads 0 instead of the plane row past the end; its rows are never stored.
A full r4d_selftest in 6c33ee4 and here, every launch of a gemm_fp8a8* or gemm_i8a8* row hashed
after it: 975 of 975 identical (829 gemm_fp8a8_nt_m16, 42 gated, 18 gemm_i8a8_nt_m16, 5 bias).
Greedy replies on Qwen3.8-Flash-Next (int8) and Qwen3.8-27B FP8 byte-identical to 6c33ee4's.
r4d_selftest --perfw8 / --perf at every narrow-GEMM shape of the two models at tp 2, cold
(256 MiB), one R9700 at 240 W, alternating rounds against 6c33ee4, medians, summed over each
model's ops at 1 / 8 / 32 / 48 / 64 rows: Flash-Next int8 61.7 / 64.2 / 83.6 / 111.9 / 130.9 ->
56.8 / 57.0 / 68.3 / 87.5 / 95.7 us, 27B FP8 411.0 / 411.9 / 427.2 / 446.3 / 485.4 -> 404.6 /
405.4 / 415.0 / 428.5 / 438.7 us. Most at narrow N, where the finisher dominated: fp8 512 x 5120
at 64 rows 53.2 -> 15.4 us, int8 256 x 2560 at 48 rows 21.0 -> 8.5 us. The gated row at 27B's
gate_up against the previous commit: 1.3-3.4 % faster at 8-32 and 48-64 rows, 1.8-2.3 % slower
at 33-47 (176.8 -> 180.2 us at 40), where the staging's spills cost more than its overlap gains;
against 6c33ee4, 3.5 % faster there. Decode step at tp 2, old / new / old: Flash-Next 15.76 /
15.69 / 15.76 ms, 27B FP8 28.02 / 27.69 / 28.04 ms.
The gated row at 33 to 48 rows (NT 3, MW 16) was pinned at 9 waves, 168 registers, where its
epilogue spilled: 57 registers at the full tile (48 rows) and 10 below it (12 and 59 in its
chained twin). At Qwen3.8-27B FP8's gate_up at tp 2 (N 17408, K 5120) 48 rows took 272.9 us
against 180.6 at 56. The gated form is always MW 16, so a block puts four waves on each SIMD, and
8 and 9 waves both hold two blocks a WGP: at 8 the form gets 192 registers for no occupancy, and
spills 7 at 48 rows and none below. f8_waves takes the gated flag (false by default), so no other
form's pin moves.
A pin changes register allocation only. r4d_selftest --case dequant_w4_bf16 (fp8_numeric, which
checks the gated row byte for byte against the GEMM + gated_quant_fp8 pair at every M it runs),
every launch of an fp8 narrow GEMM row hashed after it in 6c33ee4 and here: 879 of 879 identical,
42 of them gated; 1,526 ok, 0 FAIL.
r4d_selftest --perf 17408 5120 M, cold, one R9700 at 240 W, five alternating rounds against
6c33ee4, medians: 48 rows 272.9 -> 180.6 us (-33.8 %), 33 to 47 rows 186.2-187.6 -> 175.9-177.1
(-5.5 %), 8 to 32 and 56 to 64 rows within 0.3 %.
--perf N K M timed gemm_fp8a8_nt_m16 and the tiled row but not gemm_fp8a8_gated_nt_m16, the
engine's gate_up at every fp8 SwiGLU model, so that row had no timing. At N % 256 == 0,
K % 256 == 0 and M <= 64 it is now timed with the others, N being the gate and up rows together
as the engine fuses them; a shape the split rule would split is reported as not served. At
Qwen3.8-27B FP8's gate_up at tp 2 (N 17408, K 5120) on 6c33ee4, one R9700 at 240 W, cold:
157.1 us at 8 rows, 164.3 at 32, 186.7 at 40, 271.8 at 48, 180.3 at 56.
A hit recomputes the tokens past where it resumes. Kernels may round a row differently at another
chunk length (spec §17: the fp8 GEMM's split-K count is chosen from M), so a hit that recomputes
its tail in other chunks than a cold prefill of the same prompt can flip a near-tie in greedy text.
On the DeepSeek-V4.1 daily (TP4) a 24k-token prompt that hit a 16k one's tail snapshot resumed at
15856, ran a 528-token chunk to the next boundary and answered differently from its cold run.
--prefix-resume exact, the default:
- ChunkGeometry carries the grid an idle server's cold prefill chunks on: --max-num-batched-tokens
rounded down to the quantum, or the checkpoint interval where chunks split at it and it is the
smaller, times the span from the second interval on.
- plan_chunk writes checkpoints only on that grid. A prompt's tail snapshot is taken where its last
chunk starts (sliding-window snapshots keep their one-block margin) instead of at its last
quantum boundary. The chunk already ends there, so a long cold prompt no longer runs a short
extra step at its end.
- A checkpoint interval past the chunk must be a multiple of it; otherwise it is rounded up, and
startup says so.
- admit_one steps a hit with no snapshot to resume from (full attention) back to the grid. A
request's own checkpoint (Request::checkpoint_at, /v1/systemone's shared head) is honored where
it falls.
--prefix-resume nearest keeps the previous rule.
The cost is re-prefill: an exact repeat runs the cold run's last chunk again, and an agent's next
turn resumes where the previous prompt's last chunk started, about half a chunk more than nearest
(2048 tokens at a 4096-token budget). The property holds on an idle server; a prefill that shares
its steps with decode rows or other requests (--busy-prefill-chunk, --prefill-interleave) is cut
differently, as batching already changes greedy text.
Tests: sched_test covers the grid for six geometries (GDN hybrid, interval past the budget, span,
periodic and tip-only window snapshots, full attention), the interval rounding, the tail snapshot
at the last chunk start, admission stepping back to the grid, and a property over prompt lengths:
every checkpoint is a chunk start of the cold run of its prompt and of any longer prompt it
prefixes, and a hit from it cuts the cold run's chunks. config_test covers the flag.
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.
llama.cpp keeps a Gated DeltaNet's ssm_conv1d unquantised, in f32, and a container converted from
a GGUF holds it so. The three kernels that read the convolution weight, gdn_conv_prep,
gdn_conv_update and the convolution gdn_conv_recurrent_update folds in, read bf16, so their shims
refuse an f32 weight. The weight's element type is now a template parameter of all three.
r4d_gdn_conv_tap.h, which already holds the arithmetic the fold shares with the standalone path,
gives the vector a channel's taps are loaded as (ushort4 or float4) and the widening of one tap,
exact for either type. The shims take a bf16 or an f32 weight and pick the instance by its dtype;
any other dtype is still refused.
The raw entry points keep their signatures. r4d.h gets an f32 twin of each standalone one,
r4d_gdn_conv_prep_w4_h128_bf16_f32wgt and r4d_gdn_conv_update_w4_h128_bf16_f32wgt, rather than a
flag, so no caller of the bf16 ones changes. The fold has no raw entry point; its CV parameter now
also says the weight's type (1 bf16, 2 f32), which leaves every existing instance's template
arguments and name as they were. That is twelve new conv instances and sixteen new fold ones.
The bf16 instances compile to the same code. Built before and after with the build's flags, all
116 kernels of the two units have the same instructions, resource counts and metadata; only the
conv kernels' names change with the added template argument. The bf16 reads keep their shape:
widening gdn_conv_update's ushort4 to a float4 before use reorders its loads. The f32 conv
instances use no scratch, conv_prep 56 to 57 VGPRs (53 at bf16) and conv_update 108 (96 at bf16,
12 waves per SIMD instead of 16); each f32 fold instance has exactly its bf16 twin's counts.
r4d_selftest gets three cases for the card. gdn_conv_prep and gdn_conv_update over an f32 weight
holding bf16's values must write the bytes they write over the bf16 weight: q, k and v, g and beta
at prefill, and the conv state. The sequences are uneven; at prefill two are seeded from their
cache, one of them over two chunks, and a one-token one is not. Outputs are poisoned, the cache
must move and an f16 weight must be refused. The fold over the f32 weight must match the pair
over the bf16 one, byte for byte as the fold already does at bf16.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dense integer kernels compile their group in and read no `group` argument, and neither the
rows nor the layout hooks checked it: w8_enc_layout accepted an `i8*f16[1x32]` weight (a Q8_0
block) at group 32 and the kernel computed it at 128. The twelve dense gemm_nt_q rows now carry
C_EQ("group", ...), and the four hooks (w4, w5, w8, w2a8) answer RAD_E_DTYPE at any other group,
the one code select() counts as a refusal. relayout_parity_test pins the hooks, plugin_test the
rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A GGUF tensor of block type Q8_0, Q4_K or Q6_K could only be dequantised, so rad-convert reached it
through a recipe rule and re-quantised what was already quantised. ckpt_resolve now states the
planes libquant's ggml quantiser writes for the same blocks and marks the weight imported, and
ckpt_plane_rows splits each row's blocks into them bit for bit. The split is
core/format/ggml_planes.h, the reader's copy of lq_ggml's unpack functions, since the core cannot
call libquant; a type there is one table row, its planes and its split. Pieces of one block type
joined along rows import, an expert's slices of a stacked tensor included; mixed types and column
joins keep a GGUF reason.
The weight is not trivial, so the loader refuses it with the hint to serve the container
rad-convert writes, and ckpt_rows_f32 still dequantises it for a recipe. A rule that declines such
a weight is an error in rad-convert, since keeping its planes would hide that the rule did not
apply (spec.md §4.4).
Tests: quant_ggml_test holds every type of the reader's table to the quantiser's encoding,
checkpoint_test decodes the planes of Q8_0, Q4_K (one-block rows and a row join) and Q6_K against
the block definition and holds an expert's gate|up, two slices of stacked Q4_K tensors, to the same
blocks stored on their own, and convert_test runs a declining rule over a Q8_0 tensor, with the
GGUF writer moved to tests/gguf_writer.h for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A keyframe is pinned on the grid the steps run on, which is why 7935897 refused it with
latent_upscale. The pin can follow the switch instead: the server prepares each keyframe at the
small size too, the same way as at the canvas (stretch or centre crop), and the driver encodes
that picture into the keyframe's slot before the prompt pass, runs the small steps on the pack it
already lays out at the small size, and after the VUPSCALE pass encodes the canvas picture into
the same slot before the first full-size evaluation. The plugin reads its slots as before, so
neither the plugin nor the ABI changes; rad_builder.h documents the order. References keep their
own grids and are encoded once, as before.
Host: video_gen_test checks the pass order (E C S S U E S A D), each encode's size and slot and the
step rows at both sizes, and that a keyframe without its small picture is refused; videos_test
checks that each keyframe is prepared at both sizes with its stretch/crop and that the tower still
sees the canvas frame only. GUIDE, the ComfyUI node's README and tooltip no longer say keyframes
refuse latent_upscale.
Under --tp-wire wht6 a TranslateGemma step of 2-3 sequences (16-24 rows) sent its junction as
three launches (the standalone lossy all_reduce, rmsnorm, rmsnorm_quant_fp8): the fused
ar_rmsnorm_post_quant_fp8 sent the exact wire only, and the compressed fused form needed a row of
whole 512-element chunks, which Gemma 3 27B's 5376 is not (10.5).
- r4d_fused_quant_fp8.hip: a row of whole 64-element groups that is not whole chunks ends in a
partial chunk whose missing groups go out as zeros and are not stored back. Every real group is
the same 64 elements as in the flat message, so its bytes and the sum are the standalone wire's.
The (row, chunk) mapping is a template parameter (PAD, wire 6 only), so a row of whole chunks
(Qwen3.8's 5120) runs exactly the code it ran before; as a runtime branch it cost a Qwen3.8 x4
step 1.3-1.6 %. POST (the sandwich post-norm) on either wire.
- r4d_ar_entry.hip: K % 64 instead of K % 512 for wire 6, a size check of the padded message
against the slot and the local pack, and the local pack's scale region a sixteenth of the slot
instead of a thirty-second (padding adds up to 7 groups a row: a 2048-row prefill chunk would
have overrun the old size).
- gemma3: the junction declares its lossy twin (op_ar6) and takes it up to kAr6MaxRows (24); a
taller step keeps the standalone all-reduce, which spread over more blocks wins there (the
fused kernel gives a block one row).
TranslateGemma-27B MXFP4 + DFlash2, 2x R9700, --tp-wire wht6 --draft-short-from 8, greedy,
aggregate tok/s, two rounds, junction limit never / 24 / any:
2 streams (16 rows) 350.7 346.2 / 370.4 367.0 / 357.7 356.0
3 streams (24 rows) 455.8 451.2 / 462.8 460.6 / 437.3 436.8
4 streams (32 rows) 553.7 553.6 / 553.9 560.2 / 521.0 523.0
8 streams (32 rows) 717.4 718.0 / 716.7 720.8 / 662.4 661.9
So 2 streams +6 %, 3 +2 %, 4 and 8 unchanged.
Bit identity: with --tp-wire-min-kb 1 (one stream's steps go out lossy) the fused path gives the
unfused one's greedy top-5 logprobs, 300 of 300 tokens, max |d| 0, on two pieces (x1 there 197.6
-> 212.6 tok/s). Qwen3.8-27B MXFP4: 300 of 300 identical on two prompts, speed unchanged.
Tests: arch_test (the lossy-wire junction test now also expects a 24-row step to fuse through the
twin, other op instances than the 8-row step's, and the 64-row prefill to stay unfused).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reuse one optional-link chain per repeated operand, preserving exact bounds and existing compile limits. Includes a synthetic multi-bound schema regression.
AI-assisted contribution; original implementation by claude-nanbeige.
The header asserted "Every kernel of every loaded library ran" on a pass
whose own body counted 132 of 510 rows reached, so a coverage gap read as
full coverage. Print the sentence only when no declared row was left
unreached; otherwise name the count and point at Rows nothing ran. The
counts come from the same LibRow data the section below prints, so header
and body cannot disagree.
Reproduces on v1.13.0 (checked-in docs/KERNELS.md); the generator literal
is unchanged on current main.
The counting is one python3 pass; exit 77 (ctest's SKIP_RETURN_CODE)
where python3 is not present, the same posture ops_doc takes for plugins
that will not dump.
The checked-in libr4d section of Rows nothing ran said 239 not reached
over a table of 243: 486c9331 added the four kv_store_streamed rows to
the table without the count (the previous regeneration, 1e968f6e, was
consistent at 239/239). The generator prints header and table from one
vector, so a file like this cannot be one run's output: it is a hand-
merged regeneration, and its headline (132 of 510) and section totals
read four rows short of the tables.
Count the rows each section emits (tests/kernel_report_check.sh), fail
the fast tier when a header and its table disagree or the headline no
longer adds up, and correct the report to the numbers its own tables
show: libr4d 243 not reached, 291 declared (the four rows are in
r4d_rows.cpp and the library reports them), headline 132 of 514.
Regenerating the report from one run on a rig with cards supersedes the
corrected numbers; the test keeps the file honest.
On a box whose cards expose no peer path (IOMMU off; the engine carries
the fact as device.p2p and selects host-mailbox rows around it), the
2-rank collective cases failed with RAD_E_DEVICE: ar_ipc_enable_peer
throws enable_peer: invalid device ordinal, init maps it, and a box
configuration the engine serves shows up as five failures. A card count
is not the fact the kernel contract gates on; hipDeviceCanAccessPeer
answers it without launching a kernel. Gate every collective case on it,
with a skip naming device.p2p, like the card-count gates. On such a box
the five failing cases now skip (targeted --case runs); the rest of
r4d_selftest is unchanged.
An AUTO probe that misses leaves one STATUS line in the configure log,
and the engine boots green and 500s every media request; the startup
report -- the part of a log to paste into an issue -- said nothing about
the capability that decides it. mm::decoder_version() names it (the
libavformat version, or "absent (built without libav*)"), reported on
the startup report and /diagnostics (hardware.host.media), and GUIDE
1.1 lists the five -dev packages, the RAD_WITH_FFMPEG tri-state and the
symptom.
A userspace SDK (venv-style) finds hipcc via -DRAD_HIPCC, then device
compilation dies on clang's 'Could not find standard C++ header cmath':
ROCm's clang needs --gcc-install-dir for the distro libstdc++, and
--rocm-device-lib-path for the tree's amdgcn/bitcode. ROCM_PATH covers
discovery, not these. The working flag set, for the SDK and the core
system install, in 1.2 after the direct-CMake recipe.
pp, cN, M, I, T, ti8, FK, W4, iq4r, hc_write, pp64K, QSA and L0..L3 are
used as if defined; the kill levels are defined below the table that
references them. One glossary block after the intro; every other word of
the document is unchanged.
The sentence in the Checking section predates the libref rows (ref_qsa.cpp
landed in the same release), and it reads as a reason to skip QSA's reference
comparison in a review. The library rows and the report's completeness matrix
show five registered ref rows. The remaining limitation is the subsystem one:
no oracle compares a dense run against a sparse one above the bound, and that
sentence stays.
The builder accepted one conversion direction beyond the exact widening it already did: a single-plane RAD_F32 source declared RAD_BF16 is rounded to nearest even at load (WeightInfo::narrow, beside widen). It is staged like a widened weight, never read in place from the container, and the planner and oracle treat it as 'not the container's stored bytes'. build_test covers the declaration, the stored dtype and size, and that it is not file-direct.
Post-norm encoder with fused Wqkv and biases, NeoX rotary, non-causal attention, a dense MLP on even layers and a top-2 of 8 expert MLP on odd layers, mean pooling into the pooled f32 buffer for /v1/embeddings. The checkpoint is f32; data/recipes/nomic-embed-v2-moe-bf16.recipe casts the linears, the token embedding and the token-type table to bf16 (the device kernels read bf16), norms and biases stay f32. The checkpoint's shared experts.bias is not applied: against a llama.cpp run of the same checkpoint at Q8_0 the variant without it matches best (cosine 0.9994; the others 0.9990 to 0.9993), and llama.cpp's own nomic-bert-moe does not carry it. Verified on a gfx1201 card and on libavx/libref against a pure-float32 torch reference: mean cosine 0.99995, min 0.99983 over 20 texts. Unit tests declare and lint a cut-down model. Not verified: inputs above 512 tokens against a reference on the device, other quantisations.
meta_from_config_json reads the nomic spellings (n_layer, n_embd, n_head, n_inner, n_positions, moe_top_k, layer_norm_epsilon, rotary_emb_base) as fallbacks in the same chain as the usual keys; existing checkpoints parse as before. RAD_MAP_TRANSPOSE can first take one expert's sub-tensor of a stacked table: src_index[0] picks the dim-0 sub-tensor of a rank-3 stack, or, with src_rows[0] > 0, the row block of a rank-2 stack flattened over its rows. map_transpose_slice() declares it; map_slice() takes the same optional sub_rows. Tests in checkpoint_test cover the aliases, the [8,4,3] case, the flattened case and an out-of-range index.
meta_from_config_json reads the nomic spellings (n_layer, n_embd, n_head, n_inner, n_positions, moe_top_k, layer_norm_epsilon, rotary_emb_base) as fallbacks in the same chain as the usual keys; existing checkpoints parse as before. RAD_MAP_TRANSPOSE can first take one expert's sub-tensor of a stacked table: src_index[0] picks the dim-0 sub-tensor of a rank-3 stack, or, with src_rows[0] > 0, the row block of a rank-2 stack flattened over its rows. map_transpose_slice() declares it; map_slice() takes the same optional sub_rows. Tests in checkpoint_test cover the aliases, the [8,4,3] case, the flattened case and an out-of-range index.
The sampler's candidate plane is kSampleCandidates (1024) wide and at top_k 20 about 20 entries are live,
but the coupled verify ran its eligibility scan (global memory, one entry at a time) and its sums and
walks on one thread over all 1024: 92-151 us a launch at any row count, on the critical path of every
coupled step. The workgroup now checks validity and takes the maximum in parallel (order-free, exact),
compacts the live indices in ascending order into LDS, and the serial sums and walks run over that list
in the host reference's order, so the token is the same bit for bit.
vtime (n_cand 1024, 20 live, every row bound): 151.7 / 92.8 / 100.5 -> 31.3 / 32.2 / 35.9 us at 4 / 16 /
64 rows; device == host on every row.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Q's temperature (RADIANCE_DFLASH_Q_TEMP) only moves acceptance, never the
output law. Held-out tokens per verify step at request temperature 1, x4,
32 rows of the eval set, Qwen3.8-27B MXFP4 with a DFlash2 drafter fine-tuned on our traffic, our serving flags:
ordinary rule 3.52; coupled with Q at 1.0 3.71, 0.7 3.88, 0.5 3.85,
0.35 3.77. The walk's scores are flatter than the target's law, so a
sharper Q puts its mass where the target's is; 0.6 is the default now.
At 0.6, 3 interleaved rounds against the ordinary rule (64 held-out rows
at x4, and three requests at x1 and x4, 1500 tokens, T 1):
- tokens per step 3.53 -> 3.82 (+8.2 %), every round apart
(3.50/3.49/3.61 vs 3.82/3.79/3.86); time-weighted decode +5.4 %;
- decode per stream: 0.7k prompt x1 174.1 -> 181.7 (+4.4 %), x4 144.6 -> 153.8
(+6.4 %); 22k prompt x1 186.6 -> 191.0 (+2.3 %), x4 135.1 -> 146.2 (+8.2 %);
41k prompt x1 186.9 -> 196.8 (+5.3 %), x4 125.8 -> 135.0 (+7.3 %);
aggregate at x4 +5.3..+5.5 %.
Coupled at 0.6 against the ordinary rule, 5000-6000 samples of tokens 1-4
of two chat prompts: chi-square p 0.62..0.99.
The walk's kernel issues each candidate's successor slice and unary score
before the predecessor's codebook row (both are independent of it). This is
the build measured above; it moved the pass time within noise (91.3 -> 90.8
us at M 16, steps 7), and tokens, ids, x and status still match the host
oracle on all 40 random lattices (q by FP64 exp ulps, <= 4.3e-16).
ctest (the environment-only tests excluded) 105/105.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
DFlash2's drafts were the greedy walk over its candidate lattice, accepted
only when they equal the target's own sampled draw: P(y == x) instead of
rejection sampling's sum min(P, Q). --draft-coupling already did the latter
for a linear MTP head; this extends it to the block drafter.
- dflash_couple_propose (spechub plugin, device row + host oracle): after
dflash_select, the same lattice walked again, sampled. Position l scores
each candidate as dflash_select does (unary + low-rank edge from the
previous token), Q_l = FP64 softmax of score / q_temp over the best eight
in-vocabulary candidates, x_l ~ Q_l at (seed, base, KEY_DRAFT + l + 1),
x_l is the next predecessor. Position l writes round l+1's state row, so
the engine binds it and the sampler's mtp_couple_verify (maximal coupling,
residual (P - Q)+) verifies it exactly as an MTP round. Q depends on the
committed text and on x_0..x_{l-1}, never on the verify, and is stored
exactly. Greedy requests keep dflash_select's tokens (status 0); a draw
for another card or a Q that cannot be built takes the walk's argmax and
the ordinary verify (status -1). The shared arithmetic is in
abi/rad_spechub.h (rad_dflash_couple_step / _walk).
- The block driver stages one draw per drafting row before the query pass,
reads the states back with the slots and binds them after the commit
(Engine::bind_couple, shared with the serial driver).
- qwen35_fp8 declares the planes and the op under --draft-coupling;
RADIANCE_DFLASH_Q_TEMP sets Q's temperature (default 1, exact at any).
- Default (flag off): no op, no plane, no change.
Gates:
- spechub_dflash_couple_test (CPU): emitted token vs P by chi-square over 3
seeds each, Fisher-combined p 0.135..0.919, for Q = P, Q on fewer tokens
than P, Q mostly outside P, top_k 20 + top_p 0.95, top_p 0.6, top_k 3 at
T 0.7, peaked Q; acceptance = sum min(P, Q) within 5 sigma; the walk's
stored Q equals the softmax of its scores (1e-5) and x follows it (p
0.993); the whole draft/verify/bonus loop over 3 tokens matches the
target's autoregressive law (combined p 0.62 at q_temp 1, 0.67 at 0.5,
0.024 with every 2nd step on the ordinary verify).
- Device row vs host oracle, 40 random lattices at the production geometry
(V 248320, K 16, R 256, steps 7/3, M 1..16): tokens, x, ids, status
identical; q differs only by FP64 exp ulps (<= 4.3e-16 relative).
91 us a launch at M 16, steps 7.
- Engine, Qwen3.8-27B MXFP4 TP2, our serving flags, 4-6 tokens of two chat
prompts at T 1 / top_p 0.95 / top_k 20, 5000-11000 samples per arm:
coupled vs ordinary speculation chi-square p 0.23..0.81 (tokens 1-4 and
pair 1-2); both differ from no speculation on one prompt by the same
amount (the verify-vs-decode logits, not the rule).
- Flag off, old build (up12 5dbb5dc) vs this: greedy top-5 logprob traces
identical over 300 tokens (spec 7 and 0, two requests each), 6/6
fixed-seed sampled texts identical.
- ctest (the environment-only tests excluded) 105/105.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
## Summary
Optimize HYV3 decode and the shared W4/W5 and signed-I4 expert paths:
- Compact the asymmetric W4/W5 one-row epilogue without changing its WMMA or split-K arithmetic.
- Pack per-128-scale I4 experts into `t16k64` fragments and load one routed row directly into registers; keep prefill compatible with the same packed weights. Subgroup-scaled codebooks retain their layout.
- Narrow BF16 activations to F16 inside the W4 decode GEMM, replacing the separate activation cast with the same rounding.
- Reuse fused Q/K normalization/RoPE/KV-store, residual norms, routing and the TP1 shared/routed gather in HYV3. TP2 retains separate arm reductions.
- Add cold-weight timing modes, canonical/byte/guard checks, independent nibble-address tests and an affected-path/measurement report.
## Validation
On merged `main` (`2d2f638`):
- `gfx1201` kernel library, selftest executable and all three HYV3 plugins: compiled.
- Release and ASan/UBSan/leak architecture suites: passed.
- Layout parity: 1,145 checks over 20 cases, including GPTQ, rotated experts and subgroup codebooks: passed.
- Reference arithmetic: 136,622 checks over 254 cases passed with two failing upstream inventory/sweep cases excluded; the same failures were reproduced using unchanged upstream test source.
A full engine/unit run is blocked by upstream's missing KV-stream headers. No GPU workload or serving-service changes were made during this validation pass.
## Measurements and readiness
Earlier TP1 HYV3 measurements reached 115.678 decode tokens/s versus 90.290 initially; the isolated expert-packing step measured 95.392 to 103.364. These used a highly repetitive 10,030-prompt/2,000-output `alpha` workload on an R9700. They are **historical, not measurements of this rebased PR**, and establish neither general throughput nor gains on other models.
Keep this PR in draft until current-base GPU numerical/guard checks and matched throughput/text/tool-quality measurements pass for HYV3 and the other affected W4/W5/I4 paths. The historical tool subset did not clear its earlier guard and needs an isolated rerun.
See [the optimization report](docs/benchmarks/hyv3-w4-decode.md) for affected models/encodings, historical results, validation details and remaining gates.
Prepare a unity-gate plane once per step and use the existing gather at TP1 while preserving routed BF16 rounding before the shared add. Retain independent arm reductions and combination at TP2, with multi-pass graph and routing-rounding checks.
Reuse the existing BF16-rounded add/norm fusion while retaining final output materialization and the original collective positions. Cover TP1, TP2 and multi-pass prefill without introducing calibration hooks.
Wire the existing fused prologue into the private HYV3 attention helper for small BF16-KV batches. Retain the separate operations for other shapes and KV layouts, with graph coverage of both paths.
Replace the equivalent FP32 cast/add/cast chain with the existing BF16 add and enable the existing fused router for HYV3. Preserve separate tensor-parallel arm reductions and BF16 rounding boundaries; add the reference arithmetic check.
Replace the separate BF16-to-F16 activation cast with the same nearest-even narrowing on load. Keep existing split-K and WMMA arithmetic. Test finite and raw-bit activations, canonical arithmetic, byte parity and output guards; provide BF16-input cold-weight timing sweeps.
Change only the per-128-scale load-time expert layout to 16-column/64-K fragment tiles. Add the register-loaded one-row kernel, keep staged prefill compatible, and leave subgroup-scaled codebooks row-major.
Update the stored-layout hashes atomically with the layout and add independent canonical-nibble address checks.
Add the TP1 HYV3 expert geometry to the timing harness while keeping the Flash-Next mode. Rotate actively addressed codes and scales and check all output bytes across dispatch forms.
Keep WMMA, group and split arithmetic unchanged, but stage and reduce only the live row. Add byte parity, guard and canonical-arithmetic cases over legal launch geometries.
Extend registry bounds for the existing qkv_norm_rope_kv_store implementation and exercise the head-128 GQA-8/16 shapes numerically. No HYV3 architecture hook is included in this kernel-only branch.
isa_tools (fast tier) runs libr4d/isa/selftest.sh: no build tree, no card, no
ROCm. rows.awk at the nine 24-VGPR boundaries and at the wave64 quantum;
waterfall.awk on a forward branch after a movrel (not a loop), a real back-edge
(a loop), a movrel with no branch, and a kernel with no movrel after a kernel
that has one.
Against the code this replaces, five of the nine occupancy checks fail (97,
121, 145, 241, 256) and the forward-branch case counts a loop where there is
none. The rest pin behaviour that is right today: the movrel-with-no-branch row
and the empty kernel stay as they are, and the seen-flag reset in flush() has no
observable case in this tree -- waterfall.awk resets it per kernel so a later
edit cannot reintroduce one.
Both instruments could report a clean tree after inspecting nothing.
res.sh and waterfall.sh skipped an object whose code object would not extract
(`|| continue`), skipped a disassembly that failed, and then printed a header
and a short table and exited 0. waterfall.sh additionally counted every
s_cbranch_exec* after a movrel -- a forward branch is not the loop that re-runs
the movrel -- and carried that flag across kernels, because flush() reset n and
loops but not seen.
Now: no .hip.o under BUILD, a code object that will not extract, a
llvm-readelf/llvm-objdump that fails, or not one kernel inspected all exit 1. A
HIP translation unit with no kernels carries no .hip_fatbin and is skipped, not
failed -- one exists in this tree (r4d_ar_entry), which is why "every object must
extract" was not an option. The parse is waterfall.awk, and a branch counts only
when its target label was already defined above it, i.e. is a back-edge.
Measured over every kernel this tree builds (761 movrels): 199 loops become 101,
19 rows change, and 12 of them are r4d_ar_twoshot_Nrank_exact reporting 7 where
it has no back-edge at all:
r4d_ar_twoshot_Nrank_exact 7 -> 0 (x12)
r4d_hc_bf16 6 -> 1
xprefetch 4 -> 3
r4d_ple_gate_bf16 3 -> 0
r4d_ngram_ids 2 -> 1
spechub 9 -> 8, 2 -> 0
r4d_encoder_bf16 1 -> 0
A model with snapshots (recurrent state, or a sliding window the cache does not index) resumes a
hit only at a snapshot, and those are taken on the checkpoint interval and at each prompt's tail.
A head every request starts with -- the same system prompt or instructions in front of a different
text, as a translation service sends its pieces -- is usually shorter than an interval, and each
tail is its own, so the head was computed again by every request.
The cache now counts the blocks published right after each block (Entry::n_children) and reports
where a lookup leaves a head that at least two cached prompts already left differently
(CacheHit::branch_at; one is not enough, the next prompt could be the same conversation going on).
When nothing resumes within kSharedHeadMin (256) tokens of that point, admission sets the request's
own checkpoint there (Request::checkpoint_at, which n > 1 already uses), and the requests after it
skip the head.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
--request REQ.json --rad MODEL.rad renders an OpenAI request through parse_chat_request with the
server's own adapters (the container's vocabulary, --override-chat-template, --chat-template-kwargs,
the architecture plugin's declared reply format from --home or the template's analysis with
--no-plugin), and reads each --reply file as the model's tokens: stopped at end of generation,
detokenised with the request's preserved tokens, parsed whole (the non-streaming body) and through
the SSE emitter (reassembled as a client does), with the tool-call grammar run over the tokens as
the sampler masks them. --render-raw renders a template with any JSON context through the vendored
jinja engine, for message shapes a request cannot carry. One JSON object on stdout.
rad-chatparse is now a plugin host: rad_core whole-archive with exports, the legacy parser's sources
compiled in.
RadChatFormat/ChatFormat gain arg_json_value_prefix, a second value prefix written in place of
arg_value_prefix before a JSON value (DeepSeek-V4.1's DSML: string="false" before JSON,
string="true" before text). The tag the reply writes decides how its value is read, for declared
and undeclared names alike, and JSON that does not parse is kept as its text; the grammar writes
the tag each argument's schema calls for and either for an undeclared name. The field sits at the
end of the struct, so an older plugin's shorter struct reads as unset and nothing changes for it.
chat_format_check refuses a typed format without both prefixes, with prefixes not told apart, or
with string-typed other values.
Tests: reading, streaming at every truncation, grammar arms per schema, refusals, ABI tail.
ChatTemplate::load ran the thinking probe, the first full render, outside any handler; a template
that compiles but fails in the reply-format analysis (here llama.cpp's own DeepSeek-V4.1 template,
which calls dict()) threw out of load and ended the process. It is now RAD_E_FORMAT with the
template's words, as a failing render already is per request.
llama.cpp names each imatrix entry by its tensor (blk.0.attn_q.weight.in_sum2); importance_for
stripped .weight from the weight's name and looked up only the bare stem, so --imatrix matched
no weight from a llama.cpp file: the codebook types that need it (iq1_s, iq2_xxs, iq2_xs) were
refused and every other type was quantised without its importances. Both spellings are found now,
per-expert rows included, and the row is read under the entry's own name.
Tests: format_test a_converter_weight_name_finds_llama_cpps_spelling (a dense and a stacked expert
entry spelled .weight.in_sum2, a missing expert, a wrong width) fails without the change and
passes with it; a_converter_weight_name_finds_its_imatrix_row (the bare spelling) is unchanged.
res.sh rounded the VGPR count up to a multiple of 8 before dividing the SIMD's
1536 registers, so 128 VGPRs reported 12 waves where the hardware allows 10, and
256 reported 6 where it allows 5. gfx1201 wave32 allocates in multiples of 24;
wave64 keeps the 8 the script used for both, which nothing measured says is
wrong.
gfx1201 Wave32, 1536 VGPRs/SIMD, measured over every kernel this tree builds
(3369 rows, ROCm 7.15 / clang 23, -O3) -- 755 rows change:
6 -> 5 214 rows (256 VGPRs)
11 -> 10 119 rows
14 -> 12 118 rows
10 -> 9 112 rows
13 -> 12 96 rows
12 -> 10 96 rows
The parse moved into rows.awk so selftest.sh can check it at the boundaries
(96/97, 120/121, 144/145, 240/241) without a build tree. Five of those nine
boundary checks fail on the arithmetic this replaces.
The row was only ever run at M = 256, which is a whole number of tile heights,
so no test entered the guarded epilogue. Every tile height the prefill arms
dispatch (64, 96, 128, 256 -- tile_bmbn) now gets the rows just past its tile
and one row past that, which is the shape that reads Ascale[M].
Smoke coverage: the harness checks the return code and the stream sync, not the
numbers, so this catches a fault or a rejected launch, not a wrong tail.
The epilogue computed $v = acc * Ascale[m]$ before the store guard, so on the
last row tile of an M that is not a multiple of the tile height it named
Ascale[M] -- a row the caller does not own. The read is under the guard now.
inside is STFAST && (m0 + BM <= M), so it implies m < M for every row of the
tile, and n < N holds unconditionally because the launch rejects N % BN != 0.
No behaviour change is claimed: on gfx1201 at -O3 the compiler already
predicates the whole scale-and-store block (s_and_saveexec + s_cbranch_execz
around both the global_load_b32 of the scale and the store), so the published
binary does not issue the invalid load. This keeps the source honest for
compilers and ISA levels that do not.
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.
q38-27b-paro-mxfp4-df2.recipe for a paroquant_m2xfp4 checkpoint: the trunk is imported as it
ships, rotations included, and the drafter's linears go to M2XFP4 as in q38-27b-m2xfp4-df2.recipe.
TOOLS.md names the import beside rad-convert's other imports.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A paroquant_m2xfp4 checkpoint (format m2xfp4, groups of 32, subgroups of 8, rotation groups of
128) is imported as ParoQuant's MXFP4 is: the codes, exponents and weight_meta bytes become the
m2xfp4 scheme's three planes byte for byte, joined row by row, with the learned rotations beside
them as the givens tables. LinearFP8 declares the rotated form like the rotated MXFP4 one, through
givens_dense_quant into its own E4M3 pair, and libr4d's layout hook and both m2xfp4 rows accept
it, the rows running a fused projection's parts (pb1/pb2) one launch a part as the mxfp4a8 rows
do. libref accepts the rotated planes and runs the parts as its mxfp4a8 arm does; libavx serves
no M2XFP4. checkpoint_test covers the import, quant_m2xfp_test libref's parts and r4d_selftest
libr4d's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gate_up GEMM + gelu_mul + quant_act_fp8 fold ran only up to 8 rows; at 2-8 concurrent translations with
speculation a step is 16-64 rows and the three kernels ran apart. gemm_mxfp4a8_gated_gemv_wide (9 <= M <= 64,
K >= 2688) is gemv_wide at two column tiles a block, the gate tile j and its up tile n/16 + j: each K-wave loads both
tiles' weights and reads the activation once; the wave partials are summed in gemv_wide's order and the narrow fold's
epilogue quantises, so codes and scales are byte-identical to the unfused path. No spill (96-196 VGPRs, RT 1-4).
RADIANCE_G3_FOLD_ROWS (0 = today's 8) sets the fold band; RADIANCE_G3_PF_ROWS / _PF_MIB / _PF_EARLY expose the
prefetch beside the all-reduces (measured: no gain, defaults unchanged). Unset knobs keep the pinned graph and steps.
Measured on 2x Radeon AI PRO R9700, TranslateGemma 27B (MXFP4 GPTQ, DFlash2 drafter, speculation 7), greedy held-out
translations, aggregate tok/s, 2 interleaved rounds:
| fold ceiling | x2 | x4 | x8 |
| 8 (today) | 289.9 | 521.2 | 686.3 |
| 16 | 298.6 (+3.0 %) | 521.0 (-0.0 %) | 686.9 (+0.1 %) |
| 32 | 296.9 (+2.4 %) | 541.6 (+3.9 %) | 682.7 (-0.5 %) |
| 64 | 297.8 (+2.7 %) | 549.0 (+5.3 %) | 700.0 (+2.0 %) |
Tests: r4d_selftest gated wide fold byte-for-byte against gemv_wide + gelu_mul + quant_act_fp8 (or gated_quant_fp8)
for TranslateGemma's 21504x5376 at M 9-64 and other shapes (156 ok, 0 FAIL on gfx1201); arch_test gemma3 16/16
(defaults keep the pinned graph and steps, knobs move only what they name).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The KV split of the head-256 / GQA-6 prefill kernel (few workgroups -> split the KV walk into segments,
f32 partials, the split-KV merge with a cu span) now serves every head-256 prefill row: GQA 12
(4-token pages: fp8, bf16, fp8_v4, k6_v4), GQA 6 with 4-token pages (the same four), GQA 8, GQA 4 and
GQA 2 (fp8, bf16). The fewer KV heads a rank holds, the more it matters: at TP 2 Qwen4-Exp (GQA 12) and
Qwen3.5-35B-A3B (GQA 8) keep one KV head per rank, so a 53-row tail runs 2 workgroups on 32 WGPs.
The host side (the law, the scratch sweep, the scratch-capped count, R4D_PREFILL_SPLITS, the merge
launch) moves into r4d_attn_prefill_split.h; each unit passes its own geometry (query rows per workgroup
= 24 * 16 / gqa, tile 48). The GQA-6 unit is refactored onto it with the same law (Qwen3.8-27B in the
engine: greedy top-5 logprobs bit-identical before and after at 300 positions after 25k and 41k prompts).
Left unsplit: GQA-2 launches with a sliding window (the partition has no window floor; a 1024 window
walks at most ~26 tiles), the lossy e4m3 legs, and the head-128 / head-64 legs sharing the bodies.
Split count, one sequence, N query rows -> S: GQA 12 with 1 KV head: 1-32 -> 32, 53 -> 16, 160 -> 6,
1024 -> 1; GQA 8 with 1 KV head: 53 -> 16, 345 -> 4; GQA 2 with 4 KV heads: up to 160 -> 8. Scratch at
declare at most 25.4 MB per row. Split vs unsplit: at most 0.000488 (fp8 KV) and 0.0039 (bf16, fp8_v4,
k6_v4; about 1 bf16 ulp).
Tests: the split tests generalised over geometry for all 18 split rows (query lengths 1-640 over 8k-20k
keys, empty segments, ragged batches, pipelined pieces, poisoned scratch, oracle rows at each tile edge,
declare-time scratch): 1782 ok; the mixed-step case over 9 geometry x cache pairs: 54 ok. Every kernel
that existed before is byte-identical (311 of 311).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
DenseFP8, the drafter's linear, reads a plain m2xfp4 encoding as LinearFP8 does: the weight view
takes the codes and meta planes together, the E8M0 plane is b_scale and b_ref, and gemm() issues
gemm_nt_q at dtype m2xfp4 over the same E4M3 pair. declare_slice stays block fp8 and clears the
flag. The DFlash2 block keeps an M2XFP4 gate_up off the fp8a8 gated fold, as it does an MXFP4 one.
The recipe is q38-27b-mxfp4-df2.recipe with its 4-bit trunk and drafter rules at m2xfp4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LinearFP8 recognises a plain m2xfp4 encoding (codes, E8M0 exponent and one meta byte per group of
32, no transform) and declares gemm_nt_q at dtype m2xfp4 over the producer's E4M3 pair: the weight
view selects codes and meta together, the exponent plane is b_scale and b_ref as for MXFP4, and the
row-part, shape and column-shard rules are the MXFP4 ones. Like the other non-block-fp8 forms it
refuses a stored view. step() issues it in a block of its own with the MXFP4 GEMM's operands, and
MlpFP8 keeps it off the fp8a8 gated fold, so an M2XFP4 gate_up takes the GEMM and gated quantiser pair.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two gemm_nt_q rows at dtype m2xfp4: a split-K decode kernel that stages the weight through LDS,
and a tiled prefill kernel after the mxfp4a8 one. The relayout appends the [K/32][N] meta plane to
the fragment-order codes and r4d_m2xfp4.h's e4m3 staging table takes the subgroup multiplier as a
second index, so the WMMAs and the epilogue are the mxfp4 kernels'. The decode row keeps its own
per-output arrival counters, as mxd_out_ctr does. r4d_emu_m2xfp4 runs both kernels on the host,
and r4d_selftest and kbench (a 4e-2 tolerance for the k = 3 rounding) cover the rows. The raw
entry points are declared in r4d_m2xfp4.h, beside the table.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libref serves gemm_nt_q at dtype m2xfp4 against the E4M3 activation and its per-128 scales, from
ref_m2xfp4.cpp: libref keeps one row an op, so the gemm_nt_q row takes its launch, shape and
layout hooks from there, each answering m2xfp4 and passing every other dtype to the hook it had.
The layout joins the codes and meta planes into one U8 operand (codes rows, then meta rows) and
the GEMM decodes it element by element. libavx refuses the encoding, so the host backend falls
through to libref. The core's selection reader hands out the same codes+meta form for an m2xfp4
encoding, so the oracle and fixtures can build the operand. quant_m2xfp_test runs the row over the
quantiser's planes; OPS.md gains the operand.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
M2XFP (arXiv 2601.19213) keeps OCP MXFP4's codes and E8M0 exponent and adds one metadata byte a
group of 32: four 2-bit extra mantissas, each refining the shared scale of a subgroup of 8 to
(1 + k/4) . 2^E. The quantiser searches each subgroup's k and the exponent's bias by least squared
error (the paper's Sg-EM), stores codes, scale and meta as three planes of scheme "m2xfp4" and
supplies the decode hook the core needs for a scheme it cannot follow. spec.md gains the
encoding and quantiser rows; quant_m2xfp_test covers the planes, determinism and quality.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rounded to nearest, the 31B's w4a8 trunk leaves streamed tool calls inside their string arguments:
after `sku:<|"|>MS-110` it prefers `**,` (58%) to the string's close (41%; bf16 ~1.0), and
BetterBench's order request stalled in 10 of 20 tries. This adds what it takes to make the same
container (same grid, kernels and size) with the trunk's int4 codes chosen by GPTQ against the bf16
model's own activations.
- arch/gemma4: with RADIANCE_CALIB_DIR set, the plugin serving the 31B's bf16 checkpoint sums the
Gram of every dense linear's bf16 input over the corpus a server is fed (gram_accum into a
PERSIST [K, K] f32 buffer a tap) and writes the files at RADIANCE_CALIB_TOKENS, as arch/gemma3's
tap does: q|k|v's and gate|up's input whole from rank 0, o_proj's and down's this rank's columns
as `<stem>.part`, which libquant places on the diagonal. The files carry the names the w4a8
container gives the weights (gemma4_bf16's attn_qkv, attn_o, ffn_gate_up, ffn_down), so a GPTQ
recipe converting that container reads them with calib=DIR. RADIANCE_G4_CALIB_LAYERS=lo:hi records
a slice of layers (the 31B's taps are ~364 MiB a layer a rank at --tp 4, and 60 layers of them do
not fit beside the bf16 weights). Under the tap a step runs whole and on one lane; without
RADIANCE_CALIB_DIR nothing changes.
- data/recipes/gemma4-31b-dense-bf16-w4a8g-df2.recipe: the -df2 recipe with `gptq codes=i4
group=128 scale=f16 rule=search calib=$CALIB` on the trunk's four linears.
- docs/GEMMA4-31B-GPTQ.md: the route, the corpus, how to run it, and the measurements.
Measured (1.11.0, the same tap and recipe): by GPTQ the close is 99.8% and no try stalls; KL against
bf16 on the model's own turns falls from 0.341 to 0.251 (the w8a8 container 0.226), at the same
speed. The convert takes 75 minutes with OpenBLAS in the image (#220; an estimated days without). A
container made this way is on Hugging Face as Ashlyn4202025/gemma4-31b-w4a8-gptq-dflash2, and with
the block-16 drafter as Ashlyn4202025/gemma4-31b-w4a8-gptq-dflash2-b16.
Tests: engine_e2e takes the tiny Gemma 4 (shaped like the 31B) through the whole route at --tp 2:
the tap's files, by name and width on each rank; rad-convert with the two shipped recipes, every
trunk linear fitted and none rounded to nearest; and the GPTQ container's KL against the bf16 model
on held-out documents more than three times below the round-to-nearest one's (0.0018 against
0.0105). With rank 0's and rank 1's .part blocks swapped the margin is 2.2 times, which fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Gemma 4 (sliding layers the prefix cache does not index, no linear state) a hit resumes the
trunk's window from a window snapshot. The check for a hole in a block drafter's own KV after a
hit counted every paged group the prefix cache does not index, the trunk's windowed one included,
so it found a hole the snapshot fills. z-lab's DFlash drafter keeps a full-attention cache, which
the prefix cache indexes; with that false hole its floor sat at the hit, and with no window to
slide it was declined for the rest of every turn after a hit (on the 31B: 1.00 tokens a step on
those turns, 4.25 with this). The scheduler now counts a group the snapshot restores
(IKVManager::window_snapshot, the KV manager's KVGroupPlan::win_snap) as no hole, and the startup
line says how many: `draft floor: 3 paged group(s), 2 prefix-cached, 1 in the window snapshot -> a
hit leaves no hole`. A drafter's own windowed group is not in the snapshot, so DFlash2 and every
model with linear state are unchanged.
Tests: sched_test (a full-attention drafter drafts at once after a hit the window snapshot resumes,
and with the trunk's window counted as a hole never drafts again that turn; the fixture gains a
full-attention trunk).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A step that mixes decoding sequences with a prefill chunk issued the dense attention once, at band
max_q_len, so the decode rows ran through the prefill kernel: one workgroup per KV head walking the
decoder's whole context. With a decoder at 188k beside a 2048-row chunk that tail set the step time.
In a MIXED step the attention is now issued twice:
- the decode half at the decode band (served by the split-KV decode row); at most max_seqs - 1
sequences of at most the decode band's rows, which its declared scratch covers;
- the prefill half always at the op's top band, which selects the query-tiled prefill row built for
launches over part of a step (absolute cu from entry D, as the GDN block issues its prefill half and
as ArPieces issues its pieces); the kernels read exact lengths from cu. At its own query length a
chunk of 10 rows or fewer would select the decode row, which sizes its partials from the whole
step's rows and has no cu span.
A chunk no longer than the verify blocks beside it keeps the single launch (the step is decode-
shaped). Pure decode and pure prefill steps issue exactly as before (graph pins unchanged; only the
pinned steps that contain a mixed step move).
RADIANCE_ATTN_BAND_SPLIT=0 restores the single issue.
Measured on 2x Radeon AI PRO R9700, Qwen3.8-27B MXFP4, TP 2: one sequence decoding after a 188k
prompt while a fresh 25k prompt arrives (2 rounds each):
- mixed step 510 / 508 ms -> 211 / 211 ms
- the new prompt's prefill 11.3 / 11.3 s -> 5.0 / 5.0 s (the same as beside a 0.7k decoder)
- the decoder's rate over the window 85 / 82 -> 109 / 103 tok/s
30 minutes of mixed serving load (12 decoding streams with speculation, fresh 25k / 41k prompts,
cached re-sends that prefill a few-row suffix, TranslateGemma beside): 0 errors, 0 restarts.
Tests: arch_test qwen35_fp8_issues_a_mixed_steps_attention_once_per_band (both halves' operands, the
prefill half at the top band for a short chunk, the single launch when the chunk is not longer than
the verify blocks, one issue per layer for pure steps); r4d_selftest attn_mixed_step (production
per-rank geometry, scratch bound exactly as the engine binds it per band, 15 decode sequences of 8-10
rows beside chunks of 1 to 640 rows).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The prefill attention kernel gives each workgroup 64 query rows of one KV head and walks the whole
causal context serially. A launch with few query rows therefore has few workgroups: the tail chunk
of a prompt (53 rows) or a follow-up turn of a few hundred tokens runs 2-10 workgroups on 32 WGPs,
each walking up to 188k keys (17.7 ms per layer at 188k).
When kv_heads * qtiles * seqs is below the WGP count, the launch now splits the KV range into S
segments (blockIdx.x = qtile * S + segment), writes unnormalised f32 partials (O, m, l) in the
decode partial layout and merges them with the existing split-KV combine. S is the smaller of one or
two rounds of workgroups, capped by the context's tiles and the declared scratch. A segment past a
workgroup's causal end still writes an empty partial; the merge reads every segment it counts.
The merges take a SPAN parameter so a launch over part of a step (pipelined pieces) only rewrites its
own rows; the decode instances are unchanged (identical ISA).
R4D_PREFILL_SPLITS: unset/0 = the law, 1 = off, N = force N (debug/tuning).
Measured on 2x Radeon AI PRO R9700, Qwen3.8-27B MXFP4, TP 2, k6_v4 KV:
- r4d_selftest --perfpaged, off -> on: 53 rows over 40k 3.71 -> 0.47 ms, 80 rows 3.64 -> 0.68 ms,
345 rows 3.80 -> 1.79 ms, 1024 rows 4.29 -> 4.29 ms (no split).
- Engine, 188k prompt, time to first token: 62.78 -> 62.54 s (the tail chunk).
- KLD vs the bf16 reference: chunk 64 0.040384 -> 0.040337, chunk 2048 0.040237 -> 0.040220;
top-1 agreement 93.985 -> 93.998 %. Split vs unsplit outputs differ by at most 1 bf16 ulp.
- With R4D_PREFILL_SPLITS=1 the engine is bit-identical to before (top-5 logprobs, 100 positions).
Tests: attn_split_case / attn_split_scratch_case for k6_v4, fp8_v4, fp8 and bf16 KV (q 1-345 over
8k-20k keys, empty segments, ragged batches, pipelined pieces), scratch poisoned; 410/410 ok.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The history pass has a row for every position a verify could commit; rows past the last
committed one repeat it, and the run's last row is draft round 1's input. The card gave that pass
the run's whole length as its context. Attention places row j of a q_len-row run at
seqused - q_len + j and reads keys up to there, so after a verify that accepted acc < n_spec
drafts, round 1 also read the n_spec - acc positions after its own: slots the head's layer had
not written for this sequence (last step's speculative rounds, or whatever the block held before
it was handed out). Its proposal then followed those bytes. Positions 2 and on were right: each
round is one row whose context ends at its own position.
This fits #221 (Qwen3.8-Flash-Next, position-1 acceptance 0.01-0.16 after a
few short conversations sit in the prefix cache, healthy with --no-prefix-cache, after a restart
and on long conversations): with the default lending cache the pool hands out blocks it lent the
expert slab once cached blocks pass the live mark, and their unwritten slots hold expert bytes;
above 2051 tokens the head's QSA path bounds each query by its own position. On the reporter's
model (TP2, their flags, 32 distinct short chats on a fresh engine) 1.12.0 falls to p1 0.352 from
request 9; with this change p1 is 0.953, as with --no-prefix-cache (0.955), replies identical.
The context now ends at the last committed position. Earlier rows of the pass count lower than
their positions, but nothing reads their output (the head goes on with draft_out_ids only), and
every row's K and V still store at its own position's slot.
Tests: advance_test (no row of a history pass or a round counts past its own position, and the
run's last row sits exactly at it, for every acceptance and lead; fails before: the last row at
204 for a head at 201; and right after a 1-2 token prompt, where the rows nothing reads count
before the sequence's start, every row still stores at its own position and the last sits at
the committed one); ref_test (rows of a paged-attention run that sit before the context's start
return zeros, not NaN, and the rows after them stay exact).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
A pipelined engine issues each step's successor before the step is read back: block drafters
(DFlash, DFlash2) since 1.11.0, serial MTP and decoding without a drafter since 1.0.0. The step that
emits a request's last token therefore had one more step queued behind it, for a request its commit
then finishes. That step verifies nothing, yet the card runs its whole forward pass and the
drafter's context pass behind it, and a request that arrives once the last token is out -- a
single-stream client's next turn, sent as the reply ends -- waits for all of it before its prefill
starts. On Qwen3.8-27B ParoQuant int5 with DFlash2 on one R9700 that is about one decode step (34-53
ms) of TTFT on every back-to-back request (#225: 105 -> 139 ms); for 127 requests 1.12.0 ran 806
decode steps, all issued ahead, against 1.8.1's 680.
Scheduler::step_next_locked, beside the other rules for issuing ahead and before the next step's KV
is reserved, now issues nothing when the step just issued ends every request it carries: when it can
bring each to its max_tokens (certainly with the token it emits, possibly with the drafts it
verifies: output + 1 + drafts >= max_tokens), or, most likely, when those drafts hold an
end-of-generation id (ignore_eos requests excepted). The engine hands the scheduler the
end-of-generation ids at start (set_eog), the sorted list the card's acceptance reads. A guess that
misses (a drafted end the verify rejects, too few drafts accepted to reach max_tokens) costs one
step built after the commit instead of before it. Ends it does not predict still leave one step
behind: an end the verify chose itself, a stop string, the context limit. Without a drafter only
max_tokens ends are caught, exactly. At -v the commit names each request that ended with a step
issued ahead behind it (finish reason, its last step's tokens and accepted drafts, output against
max_tokens, whether its drafts held an end).
Tests: sched_test pins both halves (a drafted end issues and reserves nothing; a request whose next
token is its last, or whose token and accepted drafts could reach max_tokens, issues nothing; an
ignore_eos request's drafted end, drafts without an end, and a request that every draft accepted
would leave a token short still issue ahead; of two requests one going on, both issue ahead); the
test of a request finishing under a step issued ahead now ends it on an end of text the scheduler
cannot see coming. engine_e2e_test: two 32-token replies without a drafter are 62 decode steps, all
issued ahead, not 64.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since #239 the E4B form runs at two ranks. The three compose files now
use --tp 2 and name the audio encoder; the one-card profiles move to
nemotron-3.5-bolt-e4b-{bf16,i8g,a4}-tp1.yaml.
Declared after the vision tower when the container carries it. Audio rows
take the media scatter before the embedding all-reduce, and the per-layer
inputs of their positions use the pad row, as image rows do. The probe states
30 s of frames.
Gemma 4 E2B/E4B keep their feature extractor settings there, not in a
preprocessor_config.json. AudioConfig reads preprocessor.* first, as before,
then processor.feature_extractor.*.
The USM conformer moves out of embgemma2 unchanged, with the checkpoint
prefix and the plugin name as parameters, so a Gemma 4 conditional-generation
checkpoint (model.audio_tower) can declare it too. The feature size comes
from preprocessor_config.json or, failing that, from processor_config.json's
feature_extractor. embgemma2 declares the same graph (arch_test pins).
With fewer KV heads than ranks, each rank keeps one head and reads the
rows of k and v of that head (as one span, or the k and v parts of a fused
q|k|v, with the scale plane alongside); q stays an even share. Both classes,
as geom_from already counts it for the sliding class. The attention
junction keeps every row where the per-layer branch follows. Gemma 4 E4B
(two KV heads) then runs at four ranks.
As #197 did for gemm_mxfp4a8_tiled (a85f87e): the weight words a thread stages (the nibbles, the
fifth bits, the zero word) are loaded into registers a slab ahead, right after the staging
barrier, so their DRAM round trip runs under the slab's WMMAs instead of in front of the next
unpack. The slab's weight scales are loaded after the WMMAs, just before the fold: held from the
top of the slab next to the words they need 248/251 VGPRs (int4/int5), 5 waves a SIMD instead of
6, and the kernel ran 4-8 % slower than before; loaded late it is 224/227 VGPRs (was 235/237),
no spills. Same fold, same WMMA order: bit for bit.
r4d_selftest --perfwpa (new: warmed min/median and an FNV hash of the output), one R9700 at
230 W, M = 1024, old and new interleaved, 12 rounds, median: int5 gate_up 34816x5120 2769 ->
2572 us, down 5120x17408 1394 -> 1310, delta-net qkv|z 1297 -> 1219, ssm_out 461 -> 430,
q|gate 937 -> 889 (int4 -6..-9 %). Hashes equal the old kernel's on ten shapes at 1024 and 2048
rows. End to end, Qwen3.8-27B PARO int5 at tp 1 with 1024-token chunks (BetterBench, old / new /
old): 23.5k-token prompt 2096 / 2151 / 2085 tok/s, 47k 1934 / 1979 / 1927.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A request is listed in the Requests card only while it exists. The engine
drops it from /stats within roughly 20 ms of its last token on a one-token
reply, and within half a second on a long one, so the per-request figures an
operator actually compares runs on -- average tok/s, time to first token,
context at finish -- are gone before a reader who looked away gets back to
them.
The card now keeps the last 200 completed requests, per browser, in
localStorage, under the live table: prompt, completion and context tokens,
ttft, prefill throughput derived from the uncached prompt and the time to
first token, decode throughput, and age, plus the averages of those rates and
the median time to first token.
Capture is by sighting. A request is recorded the moment a poll catches its
state as done, or, since the engine usually drops it before that happens,
from its last sighting once it leaves the payload. What began and ended
between two polls was never seen, so it is counted in a grey row rather than
invented. The poll runs at 100 ms while something is in flight and 500 ms
when idle; the idle rate is what the page had before, and the faster rate is
what makes capture work at all.
Ids are the history's own, not the engine's. The engine renumbers 1..N and
restarts at 1, so each row carries a unique storage key (engine id plus a
running offset persisted across restarts) and a separate history id shown in
the # column: it starts at 0, and clear writes that counter back to 0, so a
cleared table begins again at #0. Rows are shared by every dashboard tab: a
save unions with what is stored, deduplicates by key, and a clear is a
timestamp every tab honours. clear and json sit in the section header.
The card is 459 px -- one and a half times the stock 306 -- to give the
history rows; the live table stays fixed at the top and only the history
scrolls, under a column header that stays pinned. On a phone the history list
chains its scroll to the document, as the request table already did.
The stamps are one line a dispatch; what they are taken for is a pass's idle time and the gaps a
barrier leaves, which need the union over the queues and the kinds of pass told apart. Standard
library only, beside cardclock.py and statsdump.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every dispatch of one recorded pass in N on card 0 gets a completion signal of its own, into which
the packet processor writes its start and end. The barrier bit and the chain are decided as
without the signal, so the queues run the pass as unstamped; --profile-ops, the instrument so
far, plays no recorded pass and puts two barriers around every op. A pass is the plays of a tape
from its record 0, since a pass is played in stretches between host ops. A dispatch a record or a
ride rides on is stamped from that signal, held out of the pool until its times are read.
Nothing waits: a later play reads the signals that reached 0 and appends one CSV line a dispatch
(pass, record, queue, kernel, ordered, chained, start and end in ns, play, tape length) to
RADIANCE_AQL_STAMP_OUT. Unset, nothing changes.
The engine never hands a kernel the issued value of a ranged parameter: the oracle
binds it to the matched band's bound, and ref_common.h's band_rows spells the rule
out -- the parameter stays a ceiling where one is stated -- which is why every
existing kernel derives its counts from its operands. vtile_plan/crop/join were the
first to read M as the row count of the call, so the first real tiled encode refused
on device: a 512 keyframe's 3 x 3 plan, issued under the band bound 33, tripped the
wrapper's rows-of-y < M clause, which answered RAD_E_STRIDE -- and the strerror
insisted, wrongly, that a non-contiguous operand was the problem. Crop and join
carried the same latent bug: crop would have launched 33 blocks over a ~590k-row
cut, and both would have refused every canvas under their bands' real bounds.
All three tiers now count from the operands and treat the passed M as the ceiling it
is -- y longer than the ceiling is refused, equality never demanded. The reference
and host tiers take the count from geom through band_rows; the device wrappers take
it from y's rows and pass that count in the kernel's M slot, which the kernels' own
operand-row guards make safe. OPS.md says the rule once at the head of the tiled
encoder section: an M written in a shape is an operand's row count, the ranged M
argument a ceiling only.
The host gates missed the bug precisely because they drove an exact M. ref_test's
three vtile cases now pass the band's bound -- 33, 33 * 256 * 256, 320 * 320 -- and
demand the same exact output, plus short-operand cases that must refuse E_SHAPE
under the over-declared ceiling; r4d_selftest drives the same bounds on device.
Verified: ref_test 264 cases, device vtile plan 4 / crop 8 / join 5 / gather 2 /
stitch 8 all exact, full ctest 123/123; and the FL2VA render that used to die in
tiled encode now runs its 25 steps with both keyframes visible in the decoded clip.
Co-Authored-By: Claude <noreply@anthropic.com>
8a6a118 gave the rms_mod family an optional trailing colmap -- sequences that share
one modulation cell read the shift/scale (and gate) table through that cell's COLUMN,
so the prompt's vision-pad runs share the video cell's row across non-contiguous
boundaries. It taught the device kernel and libref's implementation to follow the map,
but the operand itself reached only the driver's issue: none of the three operand
tables listed it. The schema is what the loader and the engine check against, and all
three declaring libs must agree, so the battery's first serve died at step 1 --
`rms_mod_quant_i8 ... issued with 10 operands; the op's schema declares 9`.
All three tables now list `colmap` as the trailing optional operand of rms_mod and
both quant producers (past every other arch's last operand), and libref's shape
describers answer an explicit skip for it -- the sweep passes no map. libavx's
rms_mod_run was missing the feature outright: it now reads the tables through the
map's column and drops the `s` and `g` row-count checks when a map is bound -- the
table is sized by columns, not by sequences -- while the map's own bound stays the
issuer's. OPS.md's rows and prose regenerated against the dumped schemas.
Verified: ref_test full suite (the rms_mod sweeps run mapless through the new skip),
rad-avx-check on the plain and quant rows, the device rms_mod and rms_mod_quant_fp8
cases, ops_doc, and full ctest 123/123; on device a serve that died at step 1 now
boots and renders the keyframe tasks end to end.
Co-Authored-By: Claude <noreply@anthropic.com>
vae.py's tiled_encode cuts a picture bigger than tile_size (256 px, 16
latents) into overlapping tiles, encodes each tile alone, and blends every
tile's RAW moments with its raw top and left neighbours -- top first, then
left, never an already-blended neighbour -- into the whole latent canvas.
GroupNorm normalises inside the volume it sees, so the tile seams are
observable: our port ran the whole canvas through the trunk at once, and a
photo or keyframe over 256 px a side drifted from the reference's look.
Three ops, libref/avx/r4d alike. vtile_plan lays each tile's geometry rows
the way vae.py splits -- round-robin slack, and one short tile on an axis
no longer than a tile. vtile_crop cuts the picture's pixels tile-major.
vtile_join blends the tile-major moments into the plain pass's b_eq2 with
vae.py's weights, every product and sum rounding through x's dtype. The
split carries one structural gift: with the slack fully distributed,
start[last] = len - tile, so every band is exactly a tile, and a short
band exists only in the single-band branch -- whose axis has no neighbour
to blend against. The join can therefore fetch the left neighbour always
at the full tile width while own and top fetch at the owner's own column
width, and vae.py's min() clamp inside blend is provably dead code.
step_venc_tiled runs the plain trunk once a tile: pixels from b_vtile,
moments out to one slice of b_eqt, the tile's six level geometries read
back off b_tplan (PERSIST) through raw pointers, exactly as every clip's
geometries come off enc_geom_d. The arena packs by declared lifetime, so
op_ve_q moved ahead of the trunk and the tiled ops sit last: b_vtile must
span op_ve_pix's first read to op_vt_crop at the tail and b_eqt must span
op_ve_q to op_vt_join, bracketing every trunk op the tiled pass re-runs.
b_vtile and b_eqt size tile-major at the declared tile cap; a picture
splitting past the cap step-fails by name. Clips never tile -- their
volume forces each side back to kEncMaxSide. OPS.md documents all three.
Verified: ref_test 264 cases (plan pins the round-robin overlaps {6,5,5}
and a short lone row with column neighbours; crop walks a short band at
ratio 4; join checks a 6x9 canvas with uneven round-robin splits point by
point, and a 32x32 eighths-exact f32 blend that must land bit-identical);
rad-avx-check scalar/avx/avx2 on all three ops; device r4d_selftest plan
4 / crop 8 (f32+bf16) / join 5 cases ok. Full ctest 123/123. ABI
unchanged at 28.
Co-Authored-By: Claude <noreply@anthropic.com>
The reference's _cond_video_rows runs every visual conditioning latent through
x = aug x + (1 - aug) z at VISUAL_COND_TIMESTEP 0.999, its generator restarted
per item, while audio conditioning is untouched (its aug is 1.0, a no-op). We
staged the clean latent instead, so every image-, keyframe- and reference-
conditioned render started from un-augmented conditioning.
New op cond_aug: x = f32(f32(a x) + f32(oma z)), a the aug parameter and oma
the f32 of the double 1 - aug -- the reference subtracts in double and rounds
once -- with z the (seed, stream) normal stream at element k n + c on stream
2, the reference's noise never sharing the generator that fills x. Seed words
0-1 of the video's seed, per-item restart by per-row offset. Issued once at
the end of step_venc over the conditioning rows: staging once at encode-build
time is equivalent to the reference's per-call restart because each item's
rows are exactly its own, and the driver's build_encode now re-stages the
seed, where a stale lane's words used to ride through.
Reference RNG is MT19937 and ours Philox, so the noise is distributionally
faithful, not bit-exact. ABI unchanged at 28. Device: r4d_selftest 0 failures,
cond_aug rows 1.13e-9/4.42e-8 rel_l2 against libref.
Co-Authored-By: Claude <noreply@anthropic.com>
The merge took libref's older conv1d_f32 case list over the PIN commit's:
five stride-2/4/8 success cases came back on top of the entry that refuses
them. The contract is the PIN's — the strided form lives on the bf16 rows
(the DAC encoder it serves runs there) and the f32 vocoder is stride 1, so
r4d_rad_conv1d_f32 refuses a stride or an explicit pad as a dtype choice,
and the refusal cases (even k, stride without pad, two sequences, f32)
stand. The perf path never noticed: it sends strided upsampling to
conv_t1d_f32, which owns that form at f32.
Device-verified: all eight surviving conv1d_f32 cases ok filtered
(rel_l2 <= 1.6e-6 against the bound of 2e-5).
Co-Authored-By: Claude <noreply@anthropic.com>
A stage copy is handed to the DMA queue and normally waited for by the next
kvstage_wait or consumed by kvstage_next. A staged pass can end with a list
still in flight. The transition back to the ring then clears the residency
maps, and the first ring pass refills layer 0 from the host mirror; a list that
lands after that refill leaves res calling another layer's bytes resident --
the same silent wrong output the clear exists to prevent, now sticky for layer
0 until the next prefill.
Wait the list out before the memsets. Normally nothing is in flight. Also
correct the comment on the slots < blocks guard: it is the invariant that a
stage exists (bringup gives a stream whose ring covers its context no mirror,
no resolve and no stage), not an identity claim -- a stage row is per layer and
always starts at offset 0.
Measured after the change, exact compose flags, ring 32768, spec 0 and 3:
four rounds of seed -> arithmetic -> passcode -> colors -> json each, 15:55 on
every round and the 3k passphrase on every turn.
The reference modulates by a per-token TAG: token_tags_from_embeds_info tags
every image embed span (with one flanking token on each side) 0 -- video --
inside the prompt, while audio pads keep tag 1 (parallel PR #236, point 3).
Our port modulated the whole prompt span as text, so every reference photo's
pad tokens read the text ada projection where the reference reads the video
one. The tags arrive in the prompt itself and nothing else carries them, so
the denoiser could not know, and the look drifted with the reference count.
The driver now writes each image item's token span into a tail of ref_tab --
one count, then {start, length} per run, audio items excluded (the reference
tags images only). The tail rides inert through the pack and ref_parts, and
is present exactly when the reference table is, so an i2va request keeps its
old bytes. ref2va_mod_groups grows a runs argument: it cuts the prompt at the
runs' edges and gives the pad pieces the VIDEO cell -- the video projection
on the video-schedule block; the prompt's own timestep row never changes,
only the projection.
Cells stay few however many photos interleave, but groups no longer equal
cells: two prompt pieces separated by a pad share one cell non-adjacently.
So the merged-group output gains a per-group column map, and the modulated-
norm kernels -- libr4d and libref alike -- accept an optional trailing
colmap (slot 9 quant, 7 bf16, past every other arch's last operand) that
redirects sequence -> table column, relaxing the row-count checks it binds.
rad_arch_video_mod_segs exports boundaries then map, the plugin stages both
only for a reference request -- the plain path still stages boundaries alone,
byte-identical -- and the half-split keeps its single video row by taking
the target's column instead of the last one. max_ref_segs now bounds the
DISTINCT CELLS, its old meaning was the group count. ABI 28; no struct's
shape moved, the layout table is re-stamped.
Co-Authored-By: Claude <noreply@anthropic.com>
RadBatch::mm_embd holds the image rows at rank 0 and zeros at every other
rank. The rows went in after the all-reduce of the token lookup, so at more
than one rank every rank past 0 wrote zeros over its image rows, and the
ranks ran on different residual streams from layer 0 on.
A staged pass copies whole layers into the pool at block-id identity: block b
of layer l goes to base + b * block_bytes. The ring addresses its slots at
base + l * slots * block_bytes + s * block_bytes, so the stage row of a later
layer is the ring row of an earlier one. The copy never touches `res` or
`slot_block`, so every block the map still calls resident names bytes that some
later layer has since overwritten.
Block ids are recycled between requests, so this is not theoretical. The second
request's prefill writes its mirror and -- gated on `res`, which is still valid
from the first request -- its ring slots; the rest of the layers' stage rows
then overwrite those slots. The first decode trusts `res`, skips the resolve,
and reads another layer's, or another request's, KV. Fluent, no fault.
Measured with --kv-resident 32768 on 2x16 GB gfx1201, exact compose flags:
ring off: an arithmetic probe answers 15:55 on every round;
ring on (before): 15:55, then 16:40 for rounds 2-4, on spec 0 and spec 3;
ring on (after): 15:55 on every round.
The same sequence previously answered a 3k system passphrase as Q97/Q&A and an
unrelated weather question with the previous request's filler text.
Clear `res`, `slot_block` and `slot_state` when the binding leaves the stage
view for the ring, for streams whose ring is smaller than their id space. The
first ring pass then resolves every live block out of the mirror -- the cold-map
path the first request already takes -- and the ring is self-consistent for the
decode steps that follow. One memset per prefill, not per step. A stream whose
ring covers its id space is left alone: there the staged bytes and the ring's
bytes are the same bytes at the same offsets.
Tests: kv_window_test 8/8, p4b_kv_ring_test 3/4 (one skipped: no in-tree test
kernels in this build), sched_test 142 cases green. arch_test has 15
pre-existing graph-pin failures on this tree, identical with and without this
change. The 47-case streaming battery is clean on both ring arms (spec 0 and 3).
The reference feeds the vision tower the same resized tensor it hands the
video VAE: an anchor's identity and its pinned latent are the SAME pixels.
Our port showed the tower the source file at the `match` area instead, so
a keyframe whose native aspect differed from the canvas reached the two
channels differently (parallel PR #236, point 5).
A keyframe now decodes once, onto the exact output canvas, in a pre-loop
that owns every FIRST/LAST_FRAME part: the pixels fill enc_pixels for the
VAE pin as before, and the frame itself rides to the prompt block, where
the anchor loop hands it to the tower through the new IMultimodal
prepare_frame -- implemented by the bridge as Processor::image_from, which
smart-resizes and patchifies the caller's pixels exactly as a prepared
file's would be. A reference picture is unchanged (tower `match`, encoder
grid); the two never share a request. The encode loop's keyframe branch is
gone: its pixels were built above, one decode for both consumers.
Co-Authored-By: Claude <noreply@anthropic.com>
Two findings from #236's author, both confirmed against the reference:
The <Picture k> ordinal for endpoint keyframes was fixed by ROLE (first = 1,
last = 2), so an l2va request presented its sole frame as <Picture 2>. The
reference numbers its presentation by PRESENCE (a last-frame-only request is
its picture ONE) -- as this server's own ref2va photo numbering already does.
The parse keeps the role's provisional ordinal; the count check settles it
once every part has arrived (parts may come in either order). fl2va is
unchanged: with both ends, roles and positions agree.
kMinChunks carried a stale 'EXPERIMENT: short-chunk test' enum (4) from a
cheap-clip verification battery, letting every request go under the model's
trained 5.17 s floor (7 chunks). Restored; the file's own '5 to 15 seconds:
7 to 20 chunks' comment describes the real bound.
Co-Authored-By: Claude <noreply@anthropic.com>
The per-layer table is vocab-sharded like the token table. Its lookup is now
reduced the same way, before the pad rows of image positions go in. The rest
of the branch is replicated, so the junction that closes it folds in no
all-reduce. The prefill overlap stays off with the branch. Four ranks stay
refused.
Declare the HYV3 graph with a private attention helper and existing kernels/layouts. Support per-head Q/K normalization, sigmoid-correction routing, the dense-first schedule and TP1/TP2 independent arm reductions with FP32 combine. Add graph, format and plugin tests without calibration or decode optimizations.
Use the existing RadChatFormat fields for the outer tool-call section, name separator and tagged values. Cover grammar, template replay, streaming at every truncation, section boundaries and OpenAI response lifting; leave the supports_reasoning adapter unchanged.
Carry the native FP8 release scalar K/V descales into metadata, reject invalid scales, and support conversion-time decoding of HYV3 GGUF source tensors. Add source metadata and block-decoding regressions.
Avoid empty-payload fwrite, retain the JSON embedding value during iteration, and release fake pinned allocations between Flash-Next redeclarations. Test-only fixes used by the HYV3 sanitizer run.
DenseFP8 takes `mapped` as declare()'s argument since bdb37d5; the member the plugin set was no
longer read, so each modulation slice's COPY map was declared twice and the plugin refused to
declare, in rad-convert and in the engine alike. The plugin now passes it, and the member goes,
so a caller that still sets it fails to compile instead of failing at declare.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With --kv-resident N and --num-speculative-tokens > 0, any prompt under
qsa_exact_to (~2051 tokens) emits digit spam at 65-140 tok/s instead of text;
the same prompt with speculation off is correct, and the same prompt at 61k
tokens with speculation on is correct.
The attention chooses sparse-or-dense with
T == batch->n_seq || qsa_exact_to <= 0 || reach > qsa_exact_to
where 'T == n_seq' is the decode-step test. A verify window carries
n_seq x (1 + n_spec) rows, so that disjunct is false; on a short context
reach > qsa_exact_to is false too, so the pass takes the DENSE branch, which
reads a block id out of the block table as a pool address. On the stage view
that is the addressing (identity); on the ring the pool is a window of slots,
so the launch reads another layer's blocks. The branch's only guard,
kv_stage_layer(), is a no-op on the ring and its result was discarded, so
nothing failed and the text stayed fluent.
The dense path is now refused whenever the group is ring-addressed: a stream
whose ring is smaller than its id space, on a pass that is not staged. A
stream whose ring covers the context keeps the dense path, where ids and slots
coincide. The dense branch also fails the step by name if it is ever reached
with a ring bound and no selection to resolve, so this cannot stay silent.
Measured on 2x16 GB gfx1201, ring 32768, spec 3: a 63-token prompt is coherent
at 63-78 tok/s (was digit spam) and a 4.9k-token prompt is unchanged at 67
tok/s. Suites: arch_test 181 cases, mem_test 184, sched_test 142,
kv_window_test 8, p4b_kv_ring_test 4, all green.
TENTATIVE FIX for a silent wrong-output bug: with --kv-resident N and
--num-speculative-tokens > 0, any prompt under qsa_exact_to (~2051 tokens)
streams digit spam at 65-140 tok/s instead of text, while the same prompt with
speculation off is correct. Measured, and traced:
* the attention chooses "sparse (resolve) or dense (read the block table)"
with `T == batch->n_seq || qsa_exact_to <= 0 || reach > qsa_exact_to`
(arch/common/rad_block_attn_gated_fp8.h). `T == n_seq` is the decode-step
test, and a verify step is n_seq x (1 + n_spec) rows, so it is false.
* short context, so `reach <= qsa_exact_to` is also false: the pass takes the
DENSE branch, which reads a block id straight out of the block table as a
pool address. That is right for a staged pass (identity view) and
meaningless on the ring, where the pool is a window of slots.
* the dense branch's only guard, kv_stage_layer(), is a no-op on the ring: it
returns 0 when the binding has no stage, and the call discards it.
* so the verify pass reads ring stripes holding another layer's blocks. Fluent
garbage, never a fault -- and the drafter's own rounds take the sparse path,
so acceptance still looks plausible.
The dense path is now refused whenever the group is ring-addressed -- a stream
whose ring is smaller than its id space and whose pass is not staged. A stream
whose ring covers the context keeps the dense path, which is correct there
(ids and slots coincide); the arch test that pins "below qsa_exact_to is dense"
still passes for that shape, which is how the predicate was narrowed.
Verified on 2x16 GB gfx1201, qwen3.8-next-flash-fp8-iq4r-moe, --kv-resident
32768 --num-speculative-tokens 3 --max-num-seqs 2:
63-token prompt coherent, 63-78 tok/s (was digit spam)
4 923-token prompt coherent, 67 tok/s (unchanged)
arch_test 181 cases, mem_test 184, sched_test 142, kv_window_test 8,
p4b_kv_ring_test 4 -- all green.
Known gaps, deliberately left for the follow-up: no byte-exact spec-on vs
spec-off gate has been run (only read-back quality), GLM-5.3's MLA path is
untested, and the draft window crossing a page boundary is untested.
main moved the arch fingerprints (PLE, split-KV decode attention, the tune
rows); the values here are main's for every case both sides pin, and the
branch's own bf16-KV case is kept with its hash left for the run to state.
The node is a pure HTTP client, so ComfyUI's VRAM only contends with
radiance's when both run on the server's box. Headless-radiance setups
(the normal layout: client UI on its own GPU, node pointed at a LAN
server) have idle cards on the server and boot --max-loras 2 fine.
Scope the recommendation to shared machines in node tooltip, README,
and GUIDE; PR body updated out-of-tree.
Co-Authored-By: Claude <noreply@anthropic.com>
Measured on the flagship serve (MiniMax-H3 dasiwa-fp8, TP2, rank 16): an
adapter slot is 265 MiB a card and EXACTLY one slot of elastic slack
survives the video arena after KV takes the rest. --max-loras 2 boots only
when nothing else holds VRAM (an idle ComfyUI on the box itself holds
~1.7 GiB); otherwise startup stops at 'vram_kv resolved to 0 MiB'. Lowering
--max-num-batched-tokens is not an escape for a video generator -- the auto
value is a floor (the largest denoise step must fit the arena) and the
declare refuses below it (verified live).
Written where a stuck user or their agent will grep it: the node's lora 2
tooltip (names the failure string), a README 'LoRA slots and VRAM' section,
GUIDE's --max-loras bullet, and the PR's Known limits. Recommendation:
serve with --max-loras 1; go to 2 on idle cards.
The wait's overall budget is the node's own timeout input (default
1800 s); the 30 s was the give-up-per-single-GET limit. A saturated
server should have to miss two straight minutes of tiny status replies
before the client errors out.
`rebalance` takes a preset's name beside true/false: "balanced", "detail" and "subtle" are
comfyui-krea2-conditioning's presets with renormalize on at multiplier 1, "legacy" is true
(ConditioningKrea2Rebalance's defaults, about 9x the taps' RMS). The node renormalises by
s = sqrt(sum m_t / sum w_t^2 m_t) per prompt, m_t tap t's mean square; the plugin holds s as a
constant per preset, m_t averaged over twenty prompts through krea/Krea-2-Turbo's text encoder
(scripts/krea2_rebalance_calib.py: balanced 0.44109, detail 0.35702, subtle 0.84759; per prompt
s stayed within 1.7 % of it). The gains are fixed per tap, so the presets reuse #187's
chan_affine into te.h2 with their own `mul`, one declared op per preset and tap.
The preset rides in RAD_GEN_COND_REBALANCE_PRESET, bits 8 to 15 of cond_opts beside
RAD_GEN_COND_REBALANCE, which a plugin declares when it has presets; the driver accepts both
bits, and the server refuses a preset's name on a model whose rebalance declares none. A row the
plugin does not know scales nothing. Enum values only, so no ABI bump.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 3 s poll must stay -- a plain HTTP client learns nothing unsolicited
(the API pushes no step events) and the progress bar/completion detect
need it -- but the CONSOLE LINE now rides the step counter: printed when
(steps_done or status/progress) moves, or every 30 s as a keep-alive so
encoding and stalls never go silent. A 26-step job logs 27 lines instead
of ~135 near-duplicates, mirroring the server's per-step RAD_INFO rhythm.
The pace tracker keeps sampling every poll regardless of printing.
At 3 s polls a 12.7 s step shows up as ONE increment between two adjacent
polls, so the per-increment delta read as the POLL interval -- a constant
"3.0 s/step" on every slow job (reported live: server log said 12.72).
The anchor now waits until two or more steps are visible and divides the
elapsed window by the steps in it; the EMA still tracks the draft->refine
re-price within a couple of windows, and the encode warm-up never rides
into the first rate (anchor starts on the first step DONE, not job start).
Also _fmt_secs: minutes and seconds each rounded INDEPENDENTLY, so 175 s
printed "3m 55s" and 119.5 s printed "1m 60s" -- now round to whole
seconds once, split with integer ops.
The old eta extrapolated whole-job progress, which folds the encode
warm-up into the average and drifts badly once a latent-upscaled job
switches grid mid-run (draft steps are cheaper than refine steps). The
node now mirrors the server's per-step log client-side: a _PaceTracker
measures seconds-per-step between polls from the steps_done counter and
smooths it (EMA ~40% new) so the number follows the phase change; the
eta multiplies the remaining steps by that pace and marks the decode
tail as extra. Old servers (no steps_done) keep the progress-based eta.
Help + README updated.
The V4 tile's store (storeV4) wrote dim octets 8 rows = 96 dwords apart, so the octets a wave stores at once
shared banks (4-way on 32 banks), and on k6_v4 each tile's V fetch ran as three exec-masked rounds, each issued
after the previous one returned, the scale pair packed right after its loads. Now:
- the V tile is skewed: octet o's rows start 16 (o & 3) + 8 ((o >> 2) & 1) + 128 (o >> 2) halfwords later, so a
store's octets land on distinct banks; the PV read adds the same offset, a compile-time constant a fragment
(V4 at tile 16, contiguous layout, two or more waves; one wave keeps the plain tile, which its LDS budget
needs);
- k6_v4: __builtin_assume(tid < NTHR) and a wave-uniform test for the partial round, so a tile's V loads issue
as one batch, and the scale pair packed at the store, as the prefill kernel does since its own fix. fp8_v4
keeps the tested rounds (batched there, its 4-row steps ran 6 % slower) and its pack.
Bit for bit: the same values in the same LDS cells, read in the same order.
r4d_selftest --perfdecattn on 2x R9700 (265 W), Qwen3.8-27B TP2 rank, k6_v4, sequences x rows x context,
3 interleaved rounds, medians: 1x8x100k 277.0 -> 260.1 us (-6.1 %), 1x8x200k 404.8 -> 377.7 (-6.7 %),
4x8x100k 799.4 -> 753.0 (-5.8 %), 4x8x200k 1733.3 -> 1655.3 (-4.5 %), 8x4x100k 1257.8 -> 1179.8 (-6.2 %),
16x4x41k 996.3 -> 973.4 (-2.3 %). fp8_v4 with the skew alone: -3.6 % (16x4x41k) .. -0.1 %.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
rad-tune skips a (kernel, shape) pair it cannot size: a schema names operands, not extents, and
a tool has to allocate the bytes the kernel will read. For gemm_nt_q the reference describes the
fp8 and the symmetric integer grids and declines every grid with a zero point, because
ref_planes.h joins scale and zero into one operand a RadOpdDesc cannot state. w2a8 is such a
grid, and it is the one the DFlash2 draft head serves, so both of its bands were skipped at
every tune and the served card ran the axis defaults for them.
The extents are not a guess. r4d_rad_layout_w2a8 owns them: codes to fragment order, N*K/4 bytes
(r4d.w2a8.frag.g128), and one dword per row and 128 of K joining that group's f16 scale and
integer zero, tile-major, N*K/128 of them (r4d.w2a8.sz.g128). The activation triple is
quant_act_i8's own output -- int8 codes, one f32 scale a row, and the group-major code sums with
rows padded to 16 -- and the grid is asymmetric, so the kernel refuses the case without the
sums. b_ref stays absent; the reference exponent is mxfp4's.
relayout_parity_test is where both sides exist, so the claim goes there: the table's byte total
for b and b_scale against the same hooks' RadLayout.bytes, over libquant's planes, for w2a8 and
for mxfp4a8, whose sizes the table has carried untested since it was written. Writing the
table's K/4 as K/2 fails it with "the table sizes 32768 byte(s), the kernel stores 16384". The
kernel's own guards -- K a whole number of 128-column blocks, N a whole number of 16-row tiles,
the group the stored form has -- are pinned as refusals, and the shape a two-rank draft head
tunes at (M 8, N 124160, K 2560, group 128) is pinned as accepted.
At one or two waves a workgroup (q_len * gqa <= 32: a plain decode step, or the DFlash2 short block's
4-row verify) the 128-workgroup target leaves too few KV bytes in flight for the card's DRAM; twice as
many workgroups reach it. At three waves (an 8-row verify) more workgroups only add contention, so
those keep 128.
Qwen3.8-27B MXFP4 at TP2 on 2x R9700, k6_v4 KV:
- r4d_selftest --perfdecattn: 4 sequences x 1 row over 100k 582 -> 464 us, 1 x 1 over 100k
264 -> 175, 16 x 4 rows over 41k 985 -> 801; 4 x 8 rows over 100k +9 % (kept at 128).
- The server's decode step at speculation 7 (the median gap between steps carrying every sequence,
three rounds): 8 x 41k 34.01 -> 32.48 ms (-4.5 %), 16 x 25k 44.65 -> 43.19 ms (-3.3 %).
The split count already moves with the batch (8 sequences at 256 split as 4 do at 128), so the merge
sees no new partition; not bit-identical to the 128 target at the same batch.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1.12.0 dropped RADIANCE_PREFETCH; the reads are now issued, or not, by prefetch_beside's own switch.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The window keeps lane 1's concurrent buffers live only across it. A weight read into the cache
(prefetch_beside) names no buffer, so it touches nothing the window protects: it may run on lane 1
outside the window (a DFlash2 drafter's reads come after the trunk's window), and it leaves no window
work for lane 0 to join. runtime_test covers it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
As qwen35_fp8 has them (prefetch_beside, rad_arch.h): behind the o GEMM, beside the attention
block's all-reduce, gate|up's leading 24 MB are read into the on-die cache; behind the down GEMM,
beside the feed-forward's, the next layer's q; the drafter's all-reduces take the same
(Dflash2::Config::prefetch). Decode steps of up to 32 rows, none on a step with a prompt's rows,
only at more than one rank; RADIANCE_PREFETCH=0 declares none.
TranslateGemma-27B MXFP4 + DFlash2, TP2 on two R9700s, no speculation, two rounds, x1 / x4 / x8
tok/s against none (56.8 / 182.0 / 325.0): 8 MB 63.3 / 203.1 / 354.9; 12 MB 63.0 / 202.6 / 354.9;
16 MB 63.5 / 203.9 / 356.6; 20 MB 64.1 / 204.0 / 359.4; 24 MB 64.4 / 206.4 / 359.3 (+13.4 / +13.4 /
+10.5 %); 32 MB 63.1 / 201.4 / 351.9. With speculation 7 (three rounds, greedy, medians) x1 / x4 /
x8 / x16 158.1 / 409.0 / 592.0 / 710.8 -> 177.3 / 428.4 / 592.3 / 717.6 (+12.1 / +4.7 / 0.0 /
+1.0 %). Bit for bit: a prefetch reads weights only.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
As gemma4_bf16 does (prefetch_beside): at two or more ranks, on decode steps of up to 32 rows, gate_up's
first 12 MB is read into the on-die cache beside the mixer's all-reduce and the next layer's first
projection's beside the feed-forward's; the DFlash2 drafter's reads take the same 12 MB.
Qwen3.8-27B MXFP4 + DFlash2, tp 2, 2x R9700: no speculation x1 61.2 -> 67.9 tok/s (+11 %), x4 225.0
-> 251.2 (+12 %), x8 403.7 -> 438.6 (+9 %), x16 650.8 -> 668.1 (+3 %), x32 +0.8 %; speculation 7
x1..x16 +0..+2 % for the trunk, the drafter's reads x1 +6 % (median of eight rounds); prefill
unchanged. The size and ceiling sweep is in the comment by kPrefetchBytes. RADIANCE_PREFETCH=0
declares none: arch_test's pipe-off case now sets it and still meets the serial graph pinned before
either existed. qwen35_w8a8 builds the same source; the routed (MoE) trunk takes no reads.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A test-only mode of the two-rank exact all-reduce (drain 4, set by
R4D_AR_TEST_LATE_PUSH=1 in the launcher, not in any tuning table): every block
publishes its flag before its push, pushes about 20 us later and stores its check
word as a release, since no flag release follows to write the bytes back. The new
case runs the 32-round sweep of ar_oneshot_2rank_exact and its host twin under it.
Without the push check the readers sum their slots' previous contents (16.5 million
of 18.5 million elements wrong on the device row, 12.9 million on the host twin);
with it every sum is exact.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A two-rank all-reduce or gather pushes its bytes into the peer's slot over PCIe P2P,
drains its stores and then publishes a release flag; the peer reads the slot once it
sees the flag. On 2x R9700 the bytes do not always land before the flag. With reads
streaming beside the all-reduce (prefetch), a greedy reply differed from one server
start to the next.
A probe in ar_rmsnorm_quant_fp8 compared, right after the handshake, a plain load of
the slot with a system-scope load and with the same word 100 us later: in about 1
launch in 1000 the reader saw the slot's previous contents, and the new bytes arrived
about 1 us later, sometimes more. Pushed bytes wait in the writer's L2 until a
system-scope release writes them back: with the flag sent before the push (a test
mode) and nothing after it, they stayed invisible for the whole kernel (49 ms). The
flag's release does write them back, but the writeback and the flag store reach the
peer by different paths, so the flag can arrive first. A stronger drain on the writer
(drain=1), PCIe relaxed ordering off on both cards and an HDP flush on the reader did
not change that; acq=1 hides it only by delaying the reads (and costs 12-33 % of
decode).
The writer now sums a per-dword hash (MurmurHash3's finalizer over value and index)
over what it pushes and stores the block's sum, salted with its handshake value, into
the peer's check word for (slot, block): two parity slots of fine-grained words after
the flags. The flag's release that follows writes the pushed bytes back. The reader
reads the check word, sums the same over the bytes it is about to read and, until the
two agree, takes an acquire fence, sleeps briefly and reads again; a push that never
lands traps after 2 s. A stale element and a stale check word both disagree, so the
order in which the two land does not matter. No value changes.
Kernels: ar_rmsnorm_quant_fp8 (exact and 6-bit wire), r4d_ar_oneshot_2rank_exact,
r4d_ar_hc_write, r4d_ar_gather_hc_write, r4d_ar_gather_2rank,
r4d_ar_oneshot_2rank_wht6, r4d_ar_hc_write_wht6, ar_rmsnorm_quant_i8,
r4d_ar_ln_had_quant_i8. Also: the link gate is released after the check, the exact
and gather launchers round their width to whole waves (the check's wave sum reads all
32 lanes), and ln_had's dynamic LDS ceiling leaves room for the check's static words.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Refs carry their own latent grids, so conditioning is grid-independent and
survives the draft->refine canvas switch; only the pack's video-target
segment resizes. shape_job now lays the pack out twice on a wide+refs job
(draft geometry -> seg_s/mod_seg_s/step_rows_s/lat_v_s + pos_small) and
stage_geom/build_step stage the draft tables while small_now holds. The
arch re-derives the pack from the staged geom, so the plugin needs no
change. Keyframes + upscale now refuse with a message that names the
keyframe and latent_upscale and points at sending the frame as a
reference image instead.
Host: 2 new video_gen tests (per-phase seg_cu/geom/lat/pos staging, the
by-name refusal). Device (dual R9700 TP2, dasiwa-fp8): 2x at 704x704
completes in 133s vs 212s un-upscaled, same-seed rerun bit-identical in
video and audio, refs held identity through both phases; t2va+upscale
control clean; fl2va+upscale refused by name.
The parts of the series' review rounds that concern the fold, carried over when the series was
split:
- gemm_mxfp4a8_gated_gemv: operand dtypes checked, the activation scale grid read as the gemm_nt_q
rows read it (mx_ascale_grid), row pitches checked against the widths; the arrival counters are
zeroed before any launch reads them (the memset is on the null stream, which the engine's
streams need not wait for).
- The layout hooks refuse an operand the gated row does not have; the GeGLU chain refuses
out_bf16 (its bf16 plane is a temporary there).
- r4d_selftest: the reference plane through the gemv row's own hook must be the same bytes; the
small gated cases at K 256.
- libr4d/README.md and docs/TOOLS.md: the row, and --perfmxd's fold timing.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
One block a 128-column group left the grid at n / 128 blocks (68 at Qwen per rank on 32 WGPs) and
the fold lost to the pair it replaces. Now the gemv row grid and K order, the bf16 product and
row amaxes through the op scratch, an arrival counter per group keyed on the output. Byte for
byte the old fold (selftest, twice into one output); r4d_selftest launch_row sizes scratch.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
TranslateGemma's MLP over MXFP4 runs gate_up, gelu_mul into a bf16 plane and quant_act_fp8 over it
before down. The gated fold now takes act gelu_tanh: gelu_mul's tanh GELU with its constants, the
product rounded to bf16 as gelu_mul stores it, then quant_act_fp8's quantiser (the same arithmetic as
gated_quant_fp8's). Byte-identical to the three-op chain (selftest at M = 1, 4, 8 on TranslateGemma's
per-rank gate_up, the smallest shape and the per-row scale); the replaces-hook gives the chain. The
GeGLU form writes no out_bf16: the chain's bf16 plane is gelu_mul's own output, which the hook cannot
hand to an optional operand, and the shim refuses one.
The gemma3 plugin declares the fold at up to 8 rows when both MLP linears are MXFP4 and no
calibration tap reads the bf16 plane.
TranslateGemma alone, speculation 7, two rounds each: one stream 144.5 / 144.9 -> 151.5 / 150.5 t/s,
four streams (32 rows a step, past the band) unchanged; greedy translations identical.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A decode step on Qwen3.8-27B at TP2 issues 631 kernels a card, and a dependent kernel costs the card
3.5-6.4 us in a replayed graph on gfx1201 however little it does, so launches are about 13 % of a
step.
- gemm_nt_q_gated_mx: gemm_nt_q_gated over an OCP-MXFP4 weight (b_ref after b_scale; a new op, not
an optional operand on the old one). Row gemm_mxfp4a8_gated_gemv: M <= 8, a block per 128-column
group of the gated output, a wave per gate or up tile running all of the gemv WMMA form's partials
in its order, then gated_quant_fp8's epilogue -- byte-identical to gemv + gated_quant_fp8
(selftest, M = 1..8, Qwen's and TranslateGemma's gate_up). The MLP block declares it for a plain
MXFP4 gate_up when a loaded library declares the op (libref does not), so a CPU-only engine takes
the pair. Layout hooks map its b_ref (operand 4) to gemm_nt_q's index, so the weight is stored once.
The fold: 82.5 us against 81 + 4.6 for the pair at Qwen's gate_up, 98.8 against 104 + 4.7 at
TranslateGemma's.
- --perfmxd times gated_quant_fp8 and the fold beside the gemv row at a gate_up shape.
Greedy texts of four prompts, speculation 0 and 3, identical to the production build.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The four compute queue slots the GUIDE names are what amdgpu leaves to user queues while it keeps four of the
card's eight for its own kernel queues. With num_kcq=0 MES maps all eight (compute_hqd_mask 0xf), two engines'
queues fit, and the weight reads beside the all-reduces can stay on. The order the engines create their
second-lane queues decides where MES places them, so the first engine should serve one request before the
second starts. Measured with Qwen3.8-27B and TranslateGemma 27B on two R9700s.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The paged prefill attention rows (head_dim 256, gqa 6) at Qwen3.8-27B's per-rank geometry under TP2: one
sequence whose last Q of CTX tokens are the queries, causal, at fp8, fp8 K + 4-bit V, 6-bit K + 4-bit V and
bf16. A long prompt's prefill step is this at Q = the chunk (or a pipelined piece) and CTX = the tokens so
far, and nothing else times it without a server. Two R9700s at 265 W, 1024 queries ending 41040 tokens:
4.37 / 4.26 / 4.46 / 4.76 ms (fp8 / fp8_v4 / k6_v4 / bf16), 107..120 TFLOP/s.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The tile loop waited out a global round trip every tile with every wave of the workgroup (the only
one on its WGP) stalled: the wide K fetch sat in a branch whose join made the compiler drain every
load in flight right after it, and the fp8_v4 / k6_v4 V scales were packed right after their
prefetch was issued, so it was waited on at once. Now the K fetch is branch-free (the launch's
thread count is stated to the compiler), the scales are packed at the store, and on the fp8 and
k6_v4 caches tile t+1's K is fetched once tile t's last m-tile has its scores (O_KLATE), so the
staging phase between the barriers only widens and stores. Load order only: the bytes are the same
(greedy texts of a server identical, r4d_selftest 8124 ok / 0 FAIL on both trees).
r4d_selftest --perfpaged on the R9700, three interleaved rounds, medians, k6_v4: 2048 queries over
100k keys 25.91 -> 21.47 ms (-17.2 %), over 160k 41.43 -> 33.97 (-18.0 %), over 25k 5.63 -> 5.45
(-3.3 %), 1024 queries over 50k 5.69 -> 5.48 (-3.7 %). fp8: -7.8 % at 100k and 160k, within noise
at 25k and 50k. bf16 (the stated thread count alone): 0 to -3.5 %. fp8_v4 keeps the old order on
all three counts: with them it gained 19 % at 100k but lost 3 % at 25k and 50k.
The gap is widest where the cache no longer holds the KV (k6_v4 at 100k is 70 MB against 64 MB of
Infinity Cache), so the round trip is a DRAM one. Qwen3.8-27B MXFP4 at tp 2, production flags,
cold prefill, three rounds: 100k 3830..3856 -> 3932..3935 tok/s, 25k 5255..5292 -> 5292.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
With only the union raise, "raised to N tokens" always meant "one decode
step's selection". Now that the shipped floor can bind instead, both startup
lines said the wrong thing: --kv-resident 1 reported "a decode step can name
1026 blocks" while carving 8192. KVStreamRing::by_union carries which bound
won, and KVStreamSetup::raised_by_union hands it to the report.
Verified on 2x16 GB: --kv-resident 1 now prints "a ring under 32768 tokens
(8192 blocks of 4) misses more than it saves, so the shipped floor is what the
carve takes", the report line says the same, kv_resident_blocks reads 8192 and
the engine serves.
3.9 said "run 32 768" and 5.1 told operators to size at it, while the code only
raised to the validation union (4104 tokens at 2 sequences, no speculation).
Both now state it as the floor the carve takes: kStreamFloorTokens, the union
applied on top when it is larger, both clamped to the group's context, and the
raised number carried into kv_resolve's declared slot table. Also writes down
what that means at the bottom end: a context under 32 768 tokens streams
nothing at all.
The ring is no longer carved below kStreamFloorTokens, so the tests that used
a 1 024-token context to exercise the streamed path (the fail-safe warnings,
the packed-layout gate, the resolve-for-another-group case, the union ceiling
and the prefix tier's on/off rule) were silently covering the context instead
of streaming.
They now use --max-model-len 65536 --max-num-seqs 2 (8 192 blocks of 16), pass
that context to kvstream_configure/cap_probe, and pin the raised depth where
they used to pin the flag's: the union ceiling test takes sel_pitch 2048 so
the union (4 096 blocks = 65 536 tokens) is the binding bound, and the
fail-safe's "both ops declared" case now expects the 32 768-token floor.
The raise enforced only the validation union -- the largest block union one
decode launch selects, max_seqs x (1 + n_spec) x sel_pitch -- which on the
reference model is 1026 blocks = 4104 tokens. That is the depth below which a
step cannot be served at all, not the depth below which streaming pays: the
measured curve puts the cost point at 24 576 and the shipped value at 32 768
(docs/KV-STREAMING.md 3.9). --kv-resident 1 therefore carved a 4 104-token
ring, and one 7 800-token request took 7 213 misses over 8 decoded tokens.
kStreamFloorTokens (32 768) is now a floor the carve enforces:
* kvstream_ring_shape raises any ring under it, then kvstream_ring raises
that to the union when the union is larger; both are clamped to the
group's context, so a context under 32 768 tokens streams nothing (the
ring covers it and the group keeps the base engine's path);
* RadBuildCtx::kv_resident_blocks carries the raised number into the
declare, because kv_resolve sizes its residency table from it -- a carve
deeper than the declared table is refused by the kernel;
* the startup warning says which bound applied, and KVStreamRing::floor_blocks
keeps the two distinct.
The flag is still the operator's: --kv-resident 65536 stays 65536, and a
context that fits is untouched apart from the 32 768 floor.
The feed-forward at four bits (GPTQ), attention and layers 19-23 at i8a8, on one card; the recipe is
gemma4-e4b-bf16-a4-df.recipe with GPTQ for the int4 linears. Needs main from 248ecf5 (a4, #214).
The fp8 watercolour and oversaturation claims predated the root cause: the velocity
head's norm_out shift/scale table was staged at the narrow pitch argument instead of
the declared row width, landing all zeros at t>0, so both heads ran un-modulated.
Since the staging fix no quant has been seen to band. minimax-h3-w8a8.recipe keeps
the int8 case (uniform grid, no E4M3 448-clamp, closest to the int8-convrot finetune
lineage) without the artifact story; the fried-hunt conclusion in NOTE-REF2VA and the
decoder-dump and keyframe-anchor comments carry the same correction as history.
Also accuracy against the shipped server: GUIDE 5.16 and ARCHITECTURES document
i2va/l2va/fl2va/ref2va (first_frame/last_frame parts, 9/3/3 reference ceilings,
keyframes xor refs) instead of t2va-only; NOTE-REF2VA's stale keyframe-pin pending
claims marked shipped, ticket numbers stripped from its shipped headings, its ABI-24
line qualified; the ComfyUI blurb widens to ~50-60 GiB for the w8a8 containers; and
PORT-REF2VA.md leaves the index -- info/exclude always meant it local-only.
The result column now states the outcome the operator cares about -- "streaming
off" for the three rows where it does not run, "streaming on" for the two where
it does -- and the closing line spells out that both "on" rows mean streaming
works, prefix-cache hits work, and only the RAM overflow tier is gone.
The column named a model; the decision is per group, per run. It now says
"the group that would stream", defines the context limit the row refers to,
and spells out the two sides: no streamed path (dense attention, a windowed
group, a packed fp8_v4/k6_v4 cache), versus a full group with an fp8 (E4M3)
or bf16 cache whose resolve and streamed store both linked.
3.8 gains "When it is on, and when it is off. --prefix-cache-mib vs
--kv-resident are EXCLUSIVE": the one-line summary, the five-row table, and
the note that "streaming" means the engine's answer rather than the flag's.
An entry covers every cached group, and a streamed group's rows are addressed
by the block id its sequence used, in that group's own pinned mirror: a slot
cannot stand in for them and their ids cannot be given up for one. So the
tier is turned off when a group really streams, and its MiB are not reserved.
* KV-STREAMING.md 3.8: the rule, the on/off table (flag absent or 0, ring at
or above the context, an architecture with no kv_resolve, and under the
context with the tier at 0 or above), the three startup lines, what it
costs, the defects it replaced and the tp2 measurement; the host-RAM gate
paragraph no longer counts a tier that will not exist.
* KV-STREAMING.md 4.1: the module boundary names the host tier beside
TierExec's gather, since streaming does not take the prefix cache over.
* GUIDE: the operator line under --prefix-cache-mib, and the streaming
section's budget bullet, which no longer says the tier must be lowered.
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.
Two pins on the rule in core/mem/prefix.cpp:
* an_entry_with_a_streamed_group_is_never_demoted -- demotable() is false,
the tiers are never told about the entry (plan_writeback yields nothing),
drop_clean takes nothing, and trim_sparing evicts it whole: every group's
block comes back, the streamed one included;
* the_prefix_cache_host_tier_is_off_only_when_streaming_is_really_on --
kvstream_prefix_host_off() turns --prefix-cache-mib off only when
cfg.kv_streams is set, i.e. the ring is under the context and the
architecture streams; the flag absent, a ring that covers the context and
a model with no streamed path all keep the tier. Runs through
kvstream_cap_probe, so the three cases are the ones an operator hits.
The prefix cache's host tier and --kv-resident are exclusive, and the engine
used to find that out at the first restore. An entry covers every cached
group; a streamed group's rows are addressed by the block id its sequence
used, in that group's own pinned mirror, so a slot cannot stand in for them
and their ids cannot be given up in exchange for one.
Three defects came from ignoring that:
* the write-back gathered the resident sibling with the streamed group's
block id, so the host slot held another group's row (TierExec indexes
its block vector by gi_, the entry's ids are in groups_ order);
* demotion released the streamed group's ids too (PrefixCache::
release_blocks walks every group), handing the mirror rows the entry
lives in back to the allocator;
* a restore reserved one group's ids against an entry that has two, so
rebind returned RAD_E_SHAPE and the record was dropped -- and
engine.cpp's failure path then released those ids against the wrong
pools.
Measured on 2x16GB tp2, three 44220-token conversations and a replay of the
first after the third displaced it, streaming on: 20247 entries demoted,
8588 restored, replay 0 cached tokens / 16.5s against streaming off's
44160 cached / 0.4s. The copies were pure waste.
Two rules now:
* PrefixCache::demotable() is false when any cached group streams: the
tiers are never told about such an entry (insert), and trim_sparing no
longer skips it as though its copy were in flight, so it is evicted
whole with every group's ids.
* kvstream_prefix_host_off() turns --prefix-cache-mib off at bring-up,
before anything is sized from it, when cfg.kv_streams is set -- the
flag asked, the architecture streams and the ring is under the context.
A flag with no streaming behind it (0, a ring that covers the context,
a model with no kv_resolve) keeps the tier exactly as configured.
On the cards: --kv-resident 32768 reports "no host cache ... so it is off"
and 0 (off); --kv-resident 131072 keeps 2.00 GiB / 38836 entries. The tests
live in the mem test file's own commit; the docs in the docs commit.
Four containers on Hugging Face (keptn): FP8 and w4a8, each with MTP or DFlash2, on four cards.
A compose file and a row in the models table for each; docs/DOCKER.md lists them and the two
NVIDIA-Nemotron-3.5-Bolt-E4B files.
MiniMax-H3 declares no guidance in RadVideoGenDecl (guidance-distilled: CFG
is baked into the weights, one forward a step), so /v1/videos answers any
request that names negative_prompt with "this model takes no guidance".
The box was not inert -- typing into it failed the job. The widget is gone;
graphs saved against the old schema have the value swallowed, not forwarded.
One node drives a radiance server: DaSiWa-style structured prompts, all
five tasks (t2va/i2va/l2va/fl2va/ref2va) with their media sockets, two
LoRA dropdown slots fed from GET /v1/loras mirroring --max-loras 2,
tier+aspect size picking that mirrors the plugin's size law into the node
title, and a live per-step progress line. Placement is a first draft; the
folder is exactly what ComfyUI loads from custom_nodes/.
The reference stretches the first frame to the output canvas, which squashes a portrait
photo pinned into a landscape video (ComfyUI behaves identically). Optional per-request
first_frame_mode: "stretch" (default, the reference's own resize) or "center" -- the
already-implemented cover-crop, previously used only for the last anchor: aspect kept,
the canvas centre-cropped. The latent grid stays the exact target canvas either way, so
pinned rows are unaffected; anything else is refused naming the field.
A waiting client had only job.progress (the steps' share of 0..90) and no
pace, so a long render looked like a hang. The job's thread now emits one
RAD_INFO per STEP -- step N/M, mean s/step and an eta, measured from the
first step's arrival on the steady clock so queue and encode time do not
inflate it -- and the video object carries steps_done/steps_total while it
runs (absent until the first step lands, so a queued object is unchanged).
The rate is a mean across the job; a latent upscale's small steps are
quicker than its refine steps, so the eta is a mean's guess -- the
completion line's breakdown stays exact. videos_test asserts the tally
reaches the finished object (the fake generator lands two steps).
At decode and verify sizes (up to 64 rows) the delta net's a|b projection (gemm_nt, N = 48) is
nearly all launch cost and reads only the norm's output, as the in-projection does: it runs on the
second lane beside the in-projection and is joined back before the convolution reads `ab`. A
prefill chunk keeps one lane: there the projection is real work and the lanes would split the
bandwidth the in-projection uses. An opt-in (GdnFP8::ab_lane) set by qwen35_fp8 only, whose second
lane carries no collectives: +1.1 % one stream without speculation (three rounds each). The same
for k and v beside q|gate in the gated attention was measured and left out (-0.7 %: q|gate is a
full-bandwidth GEMM and they compete).
It costs memory: naming the two buffers concurrent gives the arena a second scratch region and the
bring-up a third queue (Qwen3.8-27B at TP2: arena 534 -> 604 MiB, queues 67 -> 100 MiB a card, KV
752k -> 746k tokens).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Twenty turns of a transcript that outgrows a 32 768-token ring, streaming off
against --kv-resident, a fact planted at turn 2 asked at turn 20; the off arm
must hit the cache and the on arm must stream, or the run is not a reuse test.
Beside another server on the same card the lane-1 read costs more than it gains: the card has
fewer hardware queue slots than the two servers have queues, and the join puts a queue switch
into every decode step.
From arch/gemma3's G3Linear: int8 codes with a bf16 scale per [1 x 128], gemm_nt_q at i8a8
over quant_act_i8g (an activation scale per row and 128 columns). Gemma 4 E4B's activations
carry channels 40-200 times the row median; one int8 scale a row costs most of w8a8's KL
(wikitext-2: w8a8 0.076, i8a8 0.010). q|k|v stay one GEMM; the fused junctions stay off.
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).
A one-frame media -- a reference picture, or an endpoint keyframe -- never
shrinks through the temporal downsamplers (1->1->1->1 against a full clip's
17->17->9->5), so it rides every level alone, and a keyframe must ride the
TARGET canvas: it is resized to the output resolution before the VAE and its
latent rows share the target grid. The deep level buffers only held a full
clip's shrunken temporal volume, which capped a single frame at 5*256^2
(~572-sided) -- 480x736 was refused, 544x736 had died the server with
'venc.l3.in 6256>5120' before cont.36 added the accept-time 400.
declare_venc now sizes each level's rows as max(full clip, kEncOneFrames)
frames at the tile side, kEncOneFrames = ceil(1344*768 / 256^2) = 16, so a
single frame is bounded only by the model's whole canvas (16*256^2 >=
max_area); venc_geom applies the same max() per volume. Multi-frame media are
unchanged (the pixels volume still forces sides <= 256). Levels 2-5 grow
(R 36864->65536, 5120->16384, 1280->4096, 192->1024): about +150 MB arena,
plugin-only -- no kernel, ABI, or container change; the driver's accept-time
check delegates to the plugin export and follows automatically.
Wikitext-2 KL against the HF bf16 reference: bf16 0.0015, w8a8 0.076, w4a8 0.242 (attention and
layers 19-23 int8, feed-forward int4; all int4 is 0.612).
As the reference (Gemma4Model.forward) the token-identity lookup of a multimodal placeholder is the
pad token's row; the context projection reads the scattered image rows.
Gemma 4 E2B/E4B clamp every projection input and output of the tower to bounds the checkpoint
stores. Nine clamps a layer around the fused q|k|v and gate|up GEMMs (the fused parts share
their bounds in NVIDIA's E4B).
A global class with its own v projection (attention_k_eq_v false, Gemma 4 E2B/E4B) named its row
attn_qkvs like the sliding class, and the second declaration failed at w4a8.
The token-identity table embed_tokens_per_layer (scaled by sqrt(n_ple)), the context projection
of the scaled embedding with its per-(token, layer) norm, combined (ctx + tok) * 2^-0.5; in each
layer after the feed-forward add: gate, gelu_tanh times the layer slice, projection, norm, add,
then the layer scalar. With fused junctions j_ma closes the PLE branch instead of the
feed-forward. One rank only.
From layer n_layer - num_kv_shared_layers on, a layer has no k or v projection and attends over
the cache of the last earlier non-shared layer of its class (transformers store_full_length_kv).
Shared layers are not bound to a KV group, so pages count only the layers that write. A null
num_global_key_value_heads falls back to num_key_value_heads.
When a stateful model's cached prefix is host-resident and another request recomputes shared tokens without restoring that entry, PrefixCache::insert can replace KV still referenced by an older recurrent checkpoint. Preserve the first cached copy for snapshot-backed prefixes regardless of tier, while retaining rebinding behavior for non-stateful caches.
Add a regression covering a recomputed shared prefix, the original host copy, and its recurrent snapshot.
Tests: `ctest --test-dir build-gfx1201 -L '^fast$' --output-on-failure --parallel 24` (96/96 passed).
The pins came from the whole series (with the gated fold and the a|b lane); this PR alone pipelines
the 4096-row budget's step to another graph, and with the pipeline off the build is upstream's serial
one, whose pin the off case now checks (main's 0x36da8d762194e24e / 0xe4022daff02ec8bd).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The parts of the series' review rounds that concern the pipelined prefill and the second lane,
carried over when the series was split:
- qwen35_fp8: a trunk whose norms write rotated int8 codes (qwen35_w8a8 where libr4d serves the
`_had_quant_i8g` forms) prefills serially -- the boundary norms on the second lane issue the E4M3
pair only, and before the fix libr4d refused them for the int8 op, failing every one-sequence
prefill step of 1024 rows or more; a pipelined step whose bounds have no storage fails the step
rather than falling back on one rank only.
- The three- and eight-rank overlap all-reduce rows accept every tunable pin their wide rows accept
(r4d_selftest checks it).
- rad_builder.h: the window joins lane 1 into lane 0 at its end only, so an op declared before it
must not be issued again while lane 1 has work pending.
- tests: arch_test for the w8a8 trunk; plugin_test's lane-row comment.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The three- and eight-rank `overlap` rows (ar_twoshot_3rank_exact_lane, ar_twoshot_3rank_ti8_lane,
ar_twoshot_8rank_exact_lane) took the four-rank lane rows' narrow launch for every collective a plugin
issues beside compute: qwen4exp's --prefill-span, gemma4's prefill trunk overlap and the image and
video plugins' second-lane collectives included. That changed a default above two ranks without a
measurement, and a narrow grid can lose there too: where the all-reduce is the longer of the two (a
large message, slow or shared links, seven peers to feed at eight ranks) the step waits on a slower
collective. They now launch exactly as the wide rows by default (tArTs38Lane holds tAr's defaults: the
same grid, the same bits, the same time); R4D_AR_LANE_3_8=1, read once at load, gives them the
four-rank lane's four blocks of 1024. The bits are the same either way.
r4d_selftest checks the defaults both ways (failed before the change: nblocks 4 where the wide rows'
rule is 0). GUIDE §4.7 (with what to set and what it may gain or cost), §4.5, the environment table,
OPS, TP3 and libr4d/README say it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
rad_buf_concurrent held a buffer for the whole program because the planner cannot tell when lane 1
runs. An architecture whose lane-1 work lies in one stretch of its declared ops now declares it, and
its concurrent buffers live across that window and their own uses, so the drafter's and the heads'
buffers share their bytes again. Ctx holds it: an op on lane 1 outside the window fails the step by
name, and the first lane-0 op past it joins lane 1 first when work is pending there. qwen35_fp8 and
gemma3 declare it from the embedding's all-reduce to the final norm. Qwen3.8 + DFlash2 at 64
sequences with speculation: activation arena 633.99 -> 526.32 MiB a card, upstream's exactly (with
the second lane's own scratch region, KV 86208 -> 93856 tokens against upstream's 95520).
arch_test's fake builder applies the window too, so the pinned steps check every plugin touches its
concurrent buffers only inside it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A program naming a buffer to rad_buf_concurrent got two scratch regions of the program's largest kernel
scratch each, though by Ctx::lane1_ rule 3 an op on the second lane touches only rad_buf_concurrent
buffers. Program::scratch_bytes_lane1 is the largest device scratch of such an op (or one naming no
transient buffer); the Arena takes per-region sizes, arena_plan_bytes counts them for the VRAM budget,
and Ctx::issue refuses a larger lane-1 request by name instead of overrunning the region. Qwen3.8 with
its drafter: region 1 0 B instead of 50 MiB (17 MiB without speculation).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
dflash_src ([max_tok, n_taps * n_embd], 100 MiB at a 2048-row chunk) was written on lane 1, so it
had to be a rad_buf_concurrent buffer, held for the whole program. Each piece of a tap layer is now
copied on lane 0 right after lane 0 has waited for that piece's feed-forward boundary, before
anything writes those rows of x again. Same copy, same bytes (pinned steps unchanged); qwen35_fp8
and gemma3. On its own it does not move the activation arena's peak, which other concurrent buffers
set; it is one buffer fewer for the second lane's window (next commit) to bound.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Independent review of fa118d8 / 14fb72c: no defect. Notes taken:
- RADIANCE_PREFILL_PIPELINE takes 1 / true as on and 0 / false as off (the old per-arch switches
took 0 for off; such a value must not leave the pipeline on); the header says that past two
ranks only the two-shot band is narrow and that eight ranks pipeline on the exact wire only; the
note says the switch allows the pipeline (gemma3 may still turn it off); "rad_arch.h" as the other
common headers include it; comment lines rewrapped.
- plugin_test resolves the all-reduce at `overlap` 1 against the real libr4d: the two-shot band
takes the lane row at three, four and eight ranks, exact and ti8; the one-shot band keeps the wide
row. arch_test: every spelling of the switch, off at two ranks in all three; no three-rank arch
case (neither test model's heads split three ways, nor do the real models' KV heads).
- r4d_selftest: gemv_wide's two column tiles at four row tiles and on the per-row scale.
- r4d_selftest: every timed pass is preceded by an untimed one. A fresh process otherwise times its
first pass while the clocks ramp up from idle (up to 1.5x slow, +-30 % between runs); two builds
of the same machine code read 13 % apart until both warmed.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- One switch for qwen35_fp8's and gemma3's pipelined prefill, RADIANCE_PREFILL_PIPELINE=auto|on|off
(arch/common/rad_prefill_pipe.h), in place of RADIANCE_QWEN35_PIPE / RADIANCE_GEMMA3_PIPE. auto
(or unset) pipelines at two ranks, where it is measured; on also at three, four and eight, with a
declare note that it is not yet measured on such hardware; off never. Another value is noted and
taken as auto.
- libr4d: the narrow `overlap` all-reduce rows at three and eight ranks, as the four-rank ones are:
the wide two-shot rows' entry points (exact at three and eight, ti8 at three) at tArTs4Lane's
launch, so the collective beside the other piece's compute does not take the card (a wide one
slows the GEMM beside it 1.45-2.1x and ate the whole gain at two). Bit-identical to the wide rows
by construction; neither launch is tuned on three or eight cards, which this rig does not have.
arch_test: at four and eight ranks a 2048-row step of one sequence is serial unless asked; asked,
it runs in two pieces on every rank with every collective on the second lane at `overlap` 1 and
the embedding's whole (failed before the change: the step stayed serial).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The pipeline is decided before the blocks are declared, the fused fp8 junctions only after them.
Where those then did not resolve (no rmsnorm_quant_fp8, a mixed container), every q|k|v and
gate|up still read the shared pair as a shared linear with no quantiser, and the serial fallback
read whatever the last writer left there. The pair is now handed to each such linear as the
target of its own quantiser (G3Linear::q8_into / s8_into): the fused junctions write it when they
resolve, the unfused step's quantisers otherwise.
- a note says why the pipeline is off when declare turns it off;
- a missing bounds buffer fails the step on both ranks (rad_step_fail) instead of one rank
falling back to the serial step alone.
arch_test: with rmsnorm_quant_fp8 refused at two ranks and 2048 rows the step is serial, every
q and gate|up quantises into the pair it reads (failed before: no quantiser).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
qwen35_fp8's pipelined prefill on Gemma 3's MXFP4 trunk at two ranks: every block runs a piece
at a time on lane 0 (the attention over its own query bounds and positions, the GeGLU MLP), and the
work between two blocks a piece at a time on lane 1 -- the block's all-reduce at `overlap` 1, its
post-norm and the fp8 junction (the add and the next norm with its quantiser), after the last block
the add, the DFlash2 taps and the final norm. RADIANCE_GEMMA3_PIPE=0 turns it off.
- Every q|k|v and gate|up reads one shared E4M3 input pair under the pipeline (the junctions write
it), so the second lane's buffers cost one pair, not one a linear (rad_buf_concurrent keeps them
live for the whole program).
- A window KV group's seqused counts from its rebased first block, so the first piece's cannot be
its position: it is the group's seqused less the second piece's rows, computed on the card by a
new libr4d op, sub_i32 (y = x - s[0], int32; documented in OPS.md, a selftest case). The first
try used the position and faulted on a 12k prompt past the 1024-token window.
- G3Linear and G3JunctionFP8 row-sliced forms; each block's overlap all-reduce.
Bit for bit the serial step: TranslateGemma's KL recordings at chunk 2048 and one sequence a step
(so a document's steps from 1024 rows pipeline) compare equal with the pipeline on and off. Prefill
on two R9700s, chunk 2048: 6k tokens 1.27 -> 1.21 s, 12k 2.48 -> 2.42 s; at chunk 1024 (pieces of
512) no gain, so a deployment wants 2048 (against 1024: -9 % / -7 %). arch_test: a 2048-row TP2
step runs in pieces with its collectives on lane 1 and the shared pair; RADIANCE_GEMMA3_PIPE=0 runs
it serially.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- pipe_ready: past the batch's and the build's own conditions (the same on every rank), a
rank-local failure -- no pinned host memory for the bounds table, or its copy failing -- now
fails the step instead of running it serially. A serial step on one rank beside a pipelined
one on the other issues different collectives on the shared all-reduce instance: a hang or a
wrong sum.
- declare frees the previous build's pinned bounds table before resetting the model.
- NormQuantFP8: the slicing comment back above step(); step_plain() gets its own.
- r4d_rows: the TN axis's help text says the new crossover (M >= 1024).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
At two ranks a prefill step of at least 1024 rows is cut into two pieces of about half
(pipe_rows: rounded up to 64, both in the whole step's band). Every block runs a piece at a
time on lane 0; the work between two blocks runs a piece at a time on lane 1: the block's
all-reduce at `overlap` 1 (the narrow lane rows), then the next block's plain norm, and after
a feed-forward that keeps its add, the add, the DFlash2 taps and the final norm. The fused
all-reduce + norm is not used there: it holds its blocks while waiting on the link and slowed
the GEMM beside it by a third (measured: no gain at all with it).
- GdnFP8, AttnGatedFP8: takes_pieces(); the dense attention gets a two-piece path (each piece
its own rows, positions, slots and query bounds, seeing the cache up to its own end), and
the delta net's piece path takes the caller's normed input (ArPieces::in_ready) and passes
each piece its own context length (positions + r0), so a prompt's first chunk works.
- MlpFP8: slice() split into body() and tail(), and an overlap all-reduce (issue_ar).
- NormQuantFP8::step_plain().
- M-RoPE batches (the vision tower loaded) take it when no token's components differ: plane 0
of rope_pos is then every token's position.
- RADIANCE_QWEN35_PIPE=0 turns it off; a wide prefill step that runs serially says why, once.
Bit for bit the serial step: Qwen3.8-27B KL recordings (k6_v4, wht6) compare equal with the
pipeline on and off, and greedy answers to three long requests (680-41k tokens, speculation 3
with the DFlash2 taps) are identical. 41k-token prefill on two R9700s: 9.00 -> 8.41 s with the
TN crossover of the next commit (-6.6 %). arch_test: the two-rank pin moves; new tests pin the
serial build under RADIANCE_QWEN35_PIPE=0 and the pieces, lanes and overlap of a wide step.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A fresh process otherwise times its first pass while the card's clock ramps up from idle: up to
1.5x slow, and two builds of the same machine code read 13% apart until both were warm. Numeric
cases for gemv_wide's two column tiles a block at four row tiles and on the per-row scale.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The parts of the series' review rounds that concern these rows, carried over when the series was
split:
- gemm_mxfp4a8_decode: the 64-wide slab is chosen by the split the launch runs (a pin or a tuned
point included), as before the register kernel; the header states the split-row bound the rule
applies (ks*M = 1024).
- r4d_selftest: the priority order of the MXFP4 rows is checked (gemv / gemv_wide over decode,
decode_shortk over gemv_wide, decode over tiled); gemv_wide's numeric cases at K 256 and at 56
rows; the M-invariance check names the decode_shortk corner it does not cover.
- Comments: gemv_wide's two-tile condition (N >= 4096, K >= 3072, an even tile count), the
decode_shortk corner's bit change at M = 33, decode_shortk in the list of rows whose state is
keyed on the output.
- libr4d/README.md: the rows by row count, with the measurements behind each band;
docs/TOOLS.md: r4d_selftest and its --perfmxd mode.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Since 1.9.0 --perfmx times the MXFP4 expert GEMM (M, experts, top_k, skew). The dense rows timing
added in this series had taken the same switch and, parsed first, shadowed it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gemv_wide's blocks hold three or four row tiles over the whole K, so on a short K the cross-wave
reduction of a block outweighs its WMMAs, and on a wide N there are many such blocks. Swept over 24
per-rank shapes (Qwen3.8 and TranslateGemma at TP1/2/4/8, 1B/4B/8B-class dense) at 24..64 rows, each
row timed alone: gemv_wide is at least upstream's decode kernel everywhere except N >= 8192 with
K <= 2560 past 32 rows, where it lost by 7..30 % (19456 x 2560 at 64 rows 131.8 us against upstream's
104.5; 16384 x 2048 92.8 / 76.1; 9728 x 2560 74.1 / 67.4). This decode kernel takes that corner:
93.3, 68.6 and 52.5 us. A row of its own (same entry, scratch hook and tunables as the decode row,
priority 59, constraints M 33..64, N 8192..36864, K <= 2560) rather than a rule in the gemv entry,
so the planner's choice stays a table lookup. Narrower N stays with gemv_wide (5120 x 2176 at 40
rows 39.2 against 52.8), as does every shape of the models we serve. r4d_selftest: five numeric
cases over the corner, both activation grids and parts.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The rule was tuned with the weight staged through LDS. Past 64 rows (the multi-fragment register
kernel) it now takes the 128-wide slab always and splits K only while every split keeps 16 slabs,
towards a 48-block grid or, at K >= 8192, regardless, up to ks*M = 512 split rows. Swept every
split 1..8 at both slabs on Qwen3.8-27B's and TranslateGemma-27B's per-rank shapes at 96 and 128
rows (warmed); old against new rule, two repetitions, 80 / 96 / 128 rows:
17408 x 5120 161 / 187 / 215 -> 161 / 175 / 197 us
5120 x 8704 105 / 116 / 160 -> 110 / 116 / 149
6144 x 5120 83 / 97 / 105 -> 80 / 87 / 109
5120 x 3072 71 / 79 / 67 -> 55 / 60 / 69
21504 x 5376 192 / 207 / 228 -> 187 / 200 / 217
5376 x 10752 133 / 155 / 197 -> 132 / 154 / 184
Up to 64 rows the rule is unchanged. A different split changes a split row's summation order, so
these rows' bits move within the selftest's bound (gemm_mxfp4a8_decode: 86 ok).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Measured on smaller models' MXFP4 shapes (r4d_selftest --perfmx, clocks warmed, two repetitions),
two tiles a block lose on narrow or shallow weights -- fewer blocks than the part has units, a
short K a wave: at 32..64 rows 1024 x 2048 +7..30 %, 2048 x 2048 +6..28 %, 2048 x 4096 +4..37 %,
6144 x 1536 at 32 rows +14..30 %. From N 4096 and K 3072 every measured shape gained or held
(4096 x 2048 even; 14336 x 4096 at 64 rows 120 -> 90 us; 4096 x 7168 67 -> 55; the 27B shapes as
before), so the launcher takes two tiles there only. Bits unchanged either way.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Independent review of 675322e: no defect (the double buffers, the ratio timing against the old
kernel including a split starting mid-block and the 64-wide slab, the clamped tile, the empty
split; every variant without spills inside its waves budget). Notes taken:
- the slab rule's LDS formula was the LDS-staged kernel's; say so, and that the DTM 4 arm may no
longer pay (not re-tuned);
- mxd_ratio's comment describes when each kernel publishes the ratio;
- gemv_wide no longer instantiates two column tiles at one row tile (unreachable: two tiles need
more than 24 rows);
- a comment line over 100 columns.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Bit for bit as before, faster where several streams speculate (25 to 128 rows a step):
- gemm_mxfp4a8_gemv_wide carries two 16-column tiles a block from 25 rows. The activation is read
per block, so one tile a block read all of it N/16 times -- 356 MB from L2 at 64 rows on a 27B's
17408-row gate_up, against a 47 MB weight. Each activation fragment now serves both tiles; a
tile's WMMA chain is unchanged. Four tiles spill past 32 rows.
- gemm_mxfp4a8_decode's multi-fragment kernel (17..128 rows) loads each wave's weight words straight
to registers, as the gemv kernel does (a fragment-order word is the WMMA fragment's register), and
double-buffers only the shared activation in LDS: one barrier a slab, the next slab's loads in
flight across this one's WMMAs. Same fold, k-step and slab order, scale carry and epilogue; its
whole output compared byte for byte with the LDS-staged kernel's on Qwen3.8-27B's and
TranslateGemma-27B's per-rank shapes at 17..128 rows, both scale grids, the 64-wide slab, parts
and forced splits (312 cases, an experiment-only selftest case).
r4d_selftest --perfmx with the clocks warmed (a first timed pass from an idle card catches them
ramping up and read up to 1.5x slow), before -> after:
17408 x 5120 32 rows 125 -> 85 us, 64 157 -> 122, 96 205 -> 159, 128 245 -> 214
5120 x 8704 32 rows 75 -> 56, 64 95 -> 75, 128 169 -> 139
6144 x 5120 64 rows 70 -> 57, 128 121 -> 92
21504 x 5376 32 rows 154 -> 111, 64 183 -> 150
5376 x 10752 32 rows 105 -> 68, 64 123 -> 98
At 16 to 24 rows within a few percent either way (unchanged kernels there).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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>
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>
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.
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.
The ref2va heads are the vae/ and audio_vae/ encoders, in every pipeline
directory since the ref2va release -- what a T2VA-era container lacked was the
plugin's declare, not the weights. A reuse with nothing marked changed converts
only the never-declared head weights and copies the rest where they are; the
w8a8 recipe adds that a reuse under it re-quantises the DiT linears on the way,
since a weight copies only at the same encoding.
minimax-h3-dasiwa-fp8.recipe is minimax-h3-fp8.recipe with the modulation rule
dropped -- the same one-line delta minimax-h3-dasiwa-w8a8.recipe carries for the
int8 line. A curve-form checkpoint reads its ada as K=8 table GEMMs, which no
128x128 block quantiser can serve, so the plugin declares those weights plain
bf16 and the recipe must leave them as the checkpoint holds them.
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>
RadDrafterDecl::proposal_pitch defaults to depth for a block drafter and is refused below it (the
short block fills a row's front). arch_test: the qwen35 family's pins now that DFlash2 declares its
short block.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- declare_drafter: a block drafter's proposal_pitch, now the row pitch the engine reads row s
at, defaults to depth (it defaulted to 1, which a pitch-reading engine would take as packed
rows: wrong drafts from the second sequence and a read past the readback) and is refused
under depth. The engine's fallback goes.
- run_block_drafter: hysteresis -- the short block goes on at --draft-short-from decoding
sequences and off only two below, so a load wavering at the threshold does not switch the
block (a new pass shape, the adaptive estimates) every step. Comment: the proposals are for
the next step.
- block_begin's comment: after a long block a short one's reservation stops short of the trunk
step's end; the rejected rows past it land on freed pages with slot -1, which every kv_store
drops. Named as the load-bearing rule it is.
- The --draft-short-from warning names a serial head as such; the arch_test stub returns the
real builder's codes.
- build_test: the pitch's default and refusal.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A block drafter proposes its block whole, so the block's length is paid for every drafting
sequence whatever each verifies. At one sequence a long block pays: Qwen3.8-27B + DFlash2
(block 8, --draft-window adaptive) decodes one stream 135 -> 155-165 t/s against block 4. At
sixteen it does not: block 8 750-790 t/s, block 4 900, its drafter rows and weaker first
positions costing more than the extra drafts bring. --draft-window adaptive alone cannot help,
since it only shortens what each sequence verifies.
- rad_drafter_short_block(b, block): additive export (RAD_ABI_VERSION unchanged); the plugin
declares that its query pass also runs at `block` rows a sequence. Builder validates it
(block drafter, shorter than its own, still proposes).
- --draft-short-from N (default 0 = never): the engine stages the short block once N sequences
decoded in the step just run (Scheduler::decoded_seqs).
- The engine reads the proposals at the drafter's declared row pitch, not at the step's count:
dflash_select writes row s at s * pitch, and a short block fills only a row's front (with the
pitch read as the count, every sequence but the first got the wrong tokens).
- Dflash2: a short block of 4 rows (depth 3) wherever its own is longer: its own convolution and
selector ops at that block (every other op is per row); the query pass picks by T / n_seq and
fails the step on a block it has no ops for. qwen35_fp8 and gemma3 declare it.
- Tests: build_test (the declaration's checks), arch_test (the qwen35 family's short query pass
runs the short ops, a block without ops fails the step; the DFlash2 pin moves), config_test.
Measured (Qwen, speculation 7 adaptive, short block from 4 sequences, against production's
speculation 3 fixed): one stream +15-20 % (kratky) / +9 % (syslog), 4 streams +3 %, 16
streams equal (915 / 906 t/s).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
libr4d's recurrent update and chunk scan already read the state's width off the cache; the plugin
declared it f32 unconditionally because f16 changes the generated text. A deployment may now trade
that: RADIANCE_GDN_STATE_F16=1 (exactly) declares the cache f16, anything else keeps f32, and the
declare log says so. The default does not change.
Lossy. Qwen3.8-27B (MXFP4, TP2), mean KL against the bf16 reference, f32 -> f16:
- k6_v4 KV: chunk 2048 0.040238 -> 0.040005; chunk 64 (the state stored and rounded every 64
tokens) 0.039607 -> 0.040468, top-1 94.07 -> 94.00 %;
- fp8 KV: chunk 2048 0.039171 -> 0.039600 (+1.1 %), chunk 64 0.039327 -> 0.039690 (+0.9 %).
It halves the state pool, its host checkpoints and the state's traffic, which grows with the
decoding sequences. Decode on two R9700s, greedy, three rounds (medians, tok/s, f32 -> f16):
- no speculation: 1 stream 67.1 -> 67.5 (+0.6 %), 4 246.8 -> 253.3 (+2.6 %), 16 708.0 -> 779.5
(+10.1 %); the rounds agree to a tenth;
- speculation 7: 1 stream 222.2 -> 215.1 (-3.2 %), 4 636.9 -> 621.0 (-2.5 %), 16 1223.8 -> 1276.7
(+4.3 %); f16 also changes which drafts the greedy text accepts, and the text and the step were
not separated.
So it is for many concurrent sequences where the KL is acceptable. GUIDE §4.4 has the tables.
arch_test: the state group is f32 unset, at "0" and at "yes", f16 at "1".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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).
The venc_geom cap tested only the pixels volume -- clip * h * w against 17
squares -- but the encoder arena holds five volumes, and the temporal
downsamplers shrink a full clip 17 -> 9 -> 5 while a one-frame clip stays 1:
the deep buffers (5 frames at their side) bind a single frame at
h * w <= 5 * kEncMaxSide^2, a ~572-sided square, not the 17-frame budget.
A 544x736 endpoint keyframe (the workflow-native Flair size) passed the
volume check and then killed the server mid-step: `operand 5 reaches past
buffer 'venc.l3.in': [6256,256] at offset 0, declared [5120,256]`. Check
every volume; the spatial divisor cancels between clip and arena, so the
temporal factors alone decide. 512^2 keyframes, every reference video and
the 256-side pictures all ride exactly as before.
The driver's picture and keyframe branches never asked the encoder at all
(only videos queried rad_arch_encode_geom), so the refusal has to arrive at
accept: probe the geometry for one-frame media and name the size in the
error, instead of a step-time rad_step_fail -- which stops the engine and
takes the server with it.
Co-Authored-By: Claude <noreply@anthropic.com>
The LoRA-runtime refactor moved DenseFP8::declare's `mapped` from a struct
member to a trailing parameter -- the body now gates its map_linear on the
parameter, and rad_builder refuses a COPY name map declared twice. minimaxh3
kept setting the (now-ignored) member, so every full-form container died at
boot on `name map for 'dit.blk.0.ada0.weight': declared twice`. The ada rows
are mapped by map_rows above for both modulation branches; pass the flag so
declare() reads through that map. Curve-form (adaln_t_table) never reaches
DenseFP8 and kept booting, which is why only the ref2va containers failed.
Co-Authored-By: Claude <noreply@anthropic.com>
The reference workflow moved to MP4 as its default and it plays everywhere, so the
webm/webm-av1 containers, the `format` field and the container-aware writer are
maintenance without a user. This reverts them to the pre-webm shape: core/mm/mp4.{h,cpp}
and the Dockerfile/docs are byte-identical to upstream again (the writer's H.264
runtime-discovery and faststart were always upstream's), the ffmpeg build loses
libvpx/libaom/libopus and the webm muxer, and the runtime image loses libvpx9/libaom3/
libopus0. Input-side webm is untouched: media.cpp still demuxes webm/matroska
references, audio endpoints still accept webm uploads, and the decoder set keeps
VP8/VP9/AV1/Opus.
A `format` in a request is now refused as an unknown field.
videos_test drops the WebM case (and the format echo/caps checks), keeps the refusal;
engine_e2e, video_gen and videos suites pass, mm_test unchanged (pre-existing webp gap).
Co-Authored-By: Claude <noreply@anthropic.com>
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>
The parity harnesses already honored COMFYUI_HOME; their defaults, and the docs'
provenance references, now use the mock home. No behavior change: export
COMFYUI_HOME (or pass argv) to point them at a real checkout.
Co-Authored-By: Claude <noreply@anthropic.com>
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>
b_nout is declared with row width kMaxSegs*2*D, but the cond pass staged it
through bcol_at with a narrower pitch ARGUMENT (ncell*2*D) and the step pass
indexed row (lane,step) with that same narrow multiplier. The runtime strides a
buffer operand by its DECLARED row width, so every staging row past the first
landed beyond the consumer's window: the shift/scale table the rms_mod head
reads was ALL ZEROS for every denoise step after the first. Step 0 aligned by
coincidence (staging row #0 == the cell starts), which is why step 0 always
reproduced and hid this. The heads -- video and audio alike -- then ran
un-modulated at t>0: rms(h)*w*(1+0)+0, silently dropping a scale field of std
0.295 per step, inflating the velocity (measured 2.90 vs reference-math 2.05 at
step 1) and baking the fried look into every render.
Fix: stage and consume b_nout at its declared width, the pattern b_ada/b_modg
already use (block modulation was never wrong -- only the head table was). No
kernel, arena, or ABI change; the shared host issue path is fixed with it.
Proof chain: the nout shadow re-cast AT THE KERNEL'S OWN POINTER (the old one
sampled the declared pitch and lied -- zero_frac 1.0 at step 1 pre-fix) shows
cells matching emb(t)@W+b to 2e-3, modality-correct; torch replay on the device
stream: step-1 velocity cos 0.970->0.9975, device std 2.901->2.065 vs 2.051
reference math; device renders (512^2 6s seed 1234, flair FL2VA + T2VA control,
workflow prompt) read frame-by-frame: fried look gone on every arm, pins force,
bitrate 6.75MB->1.88MB at identical settings.
Kept (R4D_DIT_SEL-gated): per-step dump tagging dit_s{K}_*, kernel-pointer nout
shadow, tvid/tarr schedule dumps.
Co-Authored-By: Claude <noreply@anthropic.com>
Both junction kernels (ar_rmsnorm_quant_i8, ar_rmsnorm_post_quant_fp8) send the exact wire only, so
they were declared only on the exact wire. Since TranslateGemma moved to --tp-wire wht6 (19. 10.,
prefill +50 %) its decode ran every junction unfused -- all-reduce, post-norm and junction, three
launches for one -- although a decode step of a few rows goes out exact anyway (under
--tp-wire-min-kb). Now they are declared at two ranks whatever the wire and taken per step where
ar_wire_is_exact(T); a wider step keeps the lossy all-reduce, unfused. A fused step is bit for bit
the unfused exact one (the kernels are byte-identical to all_reduce).
arch_test: under a lossy wire an MXFP4 trunks decode step folds its junctions all-reduces, a
prefill chunk above the floor does not.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
lm_wmma_kernel held at most four 16-row tiles a wave, so past 64 rows the launcher made passes of 64
and read the fp8 head again for each. With MH = 2 the workgroup's eight waves split into two M halves
of four tiles over 64 weight rows that share one staged tile: Qwen3.8's per-rank head (124160 x 5120)
at 128 rows 3059 -> 1984 us, TranslateGemma's 3242 -> 2036 us; 65..128 rows -33..-39 %, 160..256
-26..-37 %, 64 and fewer unchanged. Same scale blocks, WMMAs and K order per output: the same bytes.
r4d_selftest: the heads' numeric cases at 65..150 rows, --perf times the head up to 256 rows, and
R4D_PERF_ONLY=<row> times one row alone.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Carried from the series' review rounds when it was split: numeric cases for the plain kernel at a
whole row of blocks (TN=4 forced and by the rule from 1024 rows, TN=2 at the 64-wide slab), the
plain kernel's comment, and libr4d/README.md's account of the row with the measurements behind
TN=4 from 1024 rows, the slab-ahead weight load and the thin last row.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The block is 256 rows at every M, so a block the M edge cuts ran its padding rows' WMMAs on clamped
copies of the last fragment (half the only block's math at 129 rows). M whose last row holds 1..160
rows (under 1024 in all) now runs a two-body kernel whose blocks of that row skip the WMMAs of their
fragments past M: same-session A/B over 12 shapes, M 129..160 -8..-20 %, 320..384 -2..-16 % (Qwen
gate_up at 320 rows 402 -> 339 us, TranslateGemma's 513 -> 441). Every other M runs the plain kernel,
whose body declares its own LDS, so its ISA is the old kernel's instruction for instruction: guarding
inside the one kernel cost full blocks 1..15 %, handing the body the LDS by pointer 2..8 %. Per output
byte the fold, the WMMAs and their order are unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Each slab used to load its weight words and exponents, wait for them, unpack them to LDS and only
then compute, so a DRAM round trip stood in front of every slab's unpack. The words a thread stages
are now loaded into registers right after the staging barrier, a slab ahead, and fly across the
slab's WMMAs (+1 VGPR at TN=4, no spills). Same fold, same WMMA order: bit for bit.
r4d_selftest --perfmx, warmed, at 1024 rows (a pipelined prefill's piece): Qwen3.8 gate_up
804 -> 768 us, down 443 -> 417, ssm_in 396 -> 384, ssm_out 249 -> 231, attention q|gate
306 -> 318; TranslateGemma gate_up 1063 -> 1029, down 651 -> 617; at 2048 rows 0..-4 %. Loading the
A fragments a slab ahead too (+38 VGPRs) was slower everywhere. End to end (three alternating
rounds against the production image): Qwen 41k prefill 8.57 -> 8.28 s (-3.4 %); TranslateGemma 6k
and 12k unchanged at 0.1 s; KL 0.040237.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
TN=4 wins from 1024 rows on (r4d_selftest --perfmx, a rank's weights: Qwen3.8 gate_up
17408x5120 1105.6 -> 1080.8 us, down 5120x8704 618.5 -> 599.1, TranslateGemma gate_up
21504x5376 1395.0 -> 1273.8, its down 5376x10752 793.6 -> 799.6; 1536 rows better on all four;
512 and 768 mixed). It matters to the pipelined prefill's 1024-row pieces and to TranslateGemma's
1024-row chunks. Same bytes: Qwen's KL recording and TranslateGemma's KL (0.054628) unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A client that deleted a conversation, or compacted it past a prefix, knows the
rest is dead before --prefix-cache-ttl does. DELETE /sessions/<label> (or
?label=, ?id=<engine id>) walks the session's chain from the tip inwards like
expiry: VRAM blocks to the pool, the host copy with them, the session's
snapshots to the store. ?keep_tokens=N keeps the chain's start in whole blocks.
Blocks another stored session shares (the system prompt) and blocks a live
request reads stay and are counted apart; the row is cut at the deepest block
that stayed, so a later release reaches it. A request of the same conversation
in flight is 409. IScheduler::release_session beside reset_prefix_cache,
PrefixCache::release_session over the tiers' session table (find_sessions,
shared_prefix_blocks, cut_session). Counters released{entries,snapshots} on
/sessions and /stats, prefix_cache_released_total{what} on /metrics.
Three host checks of where GLM's MLA split by rows can part from the split by heads:
- the f32-scale E4M3 GEMM gives a run of rows and a slice of columns the whole product's bytes
there, so q_b and o at full width over a rank's rows match the head form's slices;
- a TP8 step of 300 rows: each rank's run, placed as the all_gather places it (rank r's 38 rows
at r * 38, the last 34), lands on its rows;
- row by row on a prefill chunk past the DSA budget, bit for bit against the paired union tile:
the 16-head tile gives the union's first rows exactly and differs from its second rows in
about 0.1 % of their outputs by one bf16 step; the rows kernel differs in about 0.1 % of every
row's outputs, by the same step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From GlmTp::kSplitRows each rank runs its run of the step's rows (GlmTp::run_of: ceil(T / world)
rows, the last run shorter) through q_b, absorption, attention with all 64 heads
(mla_attn_rows_bf16), expansion and o, and an all_gather of whole runs takes the all-reduce's
place. The latent cache and the DSA selection are whole on every rank, so nothing is exchanged
before the attention; each rank sends its run to seven peers, half the bytes of the two-shot
all-reduce, through the same exchange instance. In a 4096-row chunk at 16k of context a rank's
attention drops from 14.0 to 3.9 ms a layer on the kernel bench. The price is q_b, kv_b and o at
full width on every rank: 120 MiB a layer, 1.29 GiB a card over the 11 trunk layers, and about
0.1 GiB of activations; the MTP layer keeps its heads. The full-width weights are whole views
(RadWeightDecl::source) of blk.N.attn_q_b, attn_kv_b and attn_output, the head form's container
entries, so they take the stored encoding (fp8a8f32, bf16) and need no name map; LinearFP8 gets
`stored` for that, served by its block-fp8 branch only, and LinearFP8::step writes a run of rows
from a given output row.
The head form stays the default, unset or RADIANCE_GLM_MLA_ROWS=0, and declares none of it: that
graph is the one before this change, byte for byte (the pinned hashes). The row form is not
bit-identical to the head form, and GLM-5.3 turns that into a measurable divergence: over a
43k-position KL corpus at TP8 (English prose, German prose, code) the row form scores a mean KL
of 0.033 against the head form (median 0.004, top-1 agreement 93.5 %), with greedy text
unchanged. The projections are not the cause: q_b and o over a rank's rows give the head form's
bytes (r4d_emu), and o summed as eight rank partials in the all-reduce's order
(RADIANCE_GLM_MLA_ROWS=2, a test form, GlmMla::Form::rows_sliced_o) scores 0.032. The
attention's rounding is: the rows kernel parts from the paired union tile in about 0.1 % of
every row's outputs by one bf16 step (the union pairing sums a pair's second row in another
order), and the 16-head tile, which parts in the same share of every second row only, halves the
KL to 0.015. A bit-identical row form would run the union tile eight times a row over its own
group of eight heads, without this kernel's gain, or need a rows kernel with the union's
arithmetic; neither is here, so the form is opt-in.
Measured on eight R9700 at Gen5 links, the same build: a 20k-token prefill 5074 tok/s in the row
form against 4270 in the head form, BetterBench prefill at 22k 4984 against 4151, single stream
181.8 against 180.2 tok/s, eight streams 468 against 454.
glm5next_test declares the block at one to eight ranks and checks the full-width views and their
sources, the fp8a8f32 GEMMs, the gather's bound against the all-reduce's, each rank's operands
at 300 rows (runs of 38, the last 34 at eight ranks) and the head form at 255; the o-slices
form's eight GEMMs and seven adds; the model's counts and the TP8 pin under
RADIANCE_GLM_MLA_ROWS=1 (0x1d378152c40f8834 / 0x82ed1094dbf4b637), with the default pins
unchanged; and the row rule against both formulas it replaced. plugin_test resolves every band
of every op the row form adds at eight ranks against libr4d, with no card.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
An optional `y0`: rows [r0, r0 + rows) of the input land at row y0 of the output instead of at
row r0, so a rank's run of a step's rows can go to a buffer sized for the run. Unset, every
branch issues what it did.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A third mla_attn row, at 64 heads. A workgroup takes one query row and all its heads, four waves
to each group of sixteen, and loads each 16-token key chunk once for all of them, where the
matrix row loads it once a tile of sixteen. The scores are K Q^T, tokens as the tile's rows and
heads as its columns, so a head's running maximum and denominator stay in its lane; the waves of
a group each take a quarter of the latent's dot products and add the four partials in one order,
and the probabilities reach the value product through a permlanex16 swap instead of LDS. The
next chunk's keys are fetched into registers while the current one is multiplied, two barriers a
chunk. A row's bytes do not depend on the other rows of the batch. Under 32 rows the launcher
runs the matrix row's kernel; r4d_mla_rows_pin_form, a test hook, pins the element-wise key load,
32 heads a workgroup, the rows kernel at any row count, or the matrix row's kernel at every row
count (the form a KL measurement needs to tell this kernel's share of a row split's difference).
Measured on gfx1201 (r4d_selftest --perfmla, one sequence past the DSA budget at 16k of
context, 513 blocks): 512 rows x 64 heads take 3.9 ms, 35 TFLOP/s, against 12.3 ms on the
matrix row, and the 4096 rows x 8 heads they stand for in a TP8 prefill chunk 14.0 ms on the
paired union tile. Against the wave row the output stays within the matrix row's tolerance
(max abs 2.4e-4 at 513 blocks).
r4d_selftest checks it against libref at 1 to 33 rows, 32 and 64 heads, every fill and both key
loads, and times it against the matrix row (--case mla_attn_rows_bf16, --perfmla at 64 heads).
r4d_emu_mla runs it on the host against an f64 softmax, its forms bit for bit against each
other, a run of rows against the same rows of the whole batch, and a mixed TP step (decodes, a
verify window, a prefill past the budget, a fresh chunk) split by heads over the matrix row and
by rows over this one, at runs that do and do not divide the step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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.
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>
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>
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>
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>
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>
77ef8f0 flipped the three ff.net.0.proj map_rows sites (dit/refiner ffn_gate_up,
vae ffn_up + bias) to identity because the container bytes were "gate-second"
against a gate-first CPU reference. That reference was circular: it read
CONTAINER rows through comfy's gate-first `_swiglu_eager`, so it agrees with
whichever order the container carries. The checkpoint's own library settles it:
ff.net.0.proj is diffusers' SwiGLU (diffusers/models/activations.py,
`hidden, gate = proj(x).chunk(2,-1); hidden * silu(gate)`) — VALUE first, gate
second — transformer AND VAE (autoencoder_kl_minimax_h3 builds its FFNs from
the same FeedForward). `silu_mul`/`gated_quant_fp8` gate with the FIRST half,
so the convert must swap. The swap was load-bearing.
Device evidence (task #64): every render of the identity-map container
(minimax-h3-dasiwa-w8a8-gatefix.rad) — including the pinned FL2VA frame-0 — was
a full-frame grid of ~16px tile-scrambled colour squares, while the original
swapped container on the SAME binary renders coherent video with both pins
forced (cmp45/FINAL_t2va512.mp4, FINAL_fl2va512.mp4; frames read by eye).
Aggregate metrics (luma 81, clipHi 0.1%) were perfectly normal on the
scrambled output — only vision caught it, and the cont.25 "device-verified"
claim was metrics-only.
Reverted maps verified by byte round-trip: rad-convert with the restored
recipe and --reuse minimax-h3-dasiwa-w8a8.rad writes 3273/3273 tensors
byte-identical to it. Kept: the R4D_DIT_SEL-gated decoder shadows + driver
readback, the trailing-optional operand arity fix (43a6768), and the ABI-24
table regen (3f0f4ef) — all still valid. minimax-h3-dasiwa-w8a8-gatefix.rad
stays only as the documented bad artifact; the good container remains
minimax-h3-dasiwa-w8a8.rad. The fried look itself stays OPEN: the restored
renders are coherent but still over-bright vs the reference. Docs cont.26
supersedes cont.25.
Co-Authored-By: Claude <noreply@anthropic.com>
Root cause, byte proof, reconvert recipe, device A/B (clipHi 37.8->0.1%), the final
velocity parity (cos 0.9886 / std ratio 1.071 supersedes cont.24's block table), and
the two pre-existing red tests fixed on the way (timestep_embed arity since e28cf86;
the ABI layout snapshot since 9d67df3).
Co-Authored-By: Claude <noreply@anthropic.com>
abi_layout_test has been red since 9d67df3 bumped RAD_ABI_VERSION to 24 without
regenerating the snapshot, and the row file never listed Batch.sampler or any of the
trailing debug fields (dbg_ve_*, dbg_dit_*, dbg_vd_* — 61 rows missing from the
snapshot). Verified purely additive: no previously-listed field moved or changed size,
both growths are fields past the old struct ends. kTableAbi 24.
Co-Authored-By: Claude <noreply@anthropic.com>
e28cf86 made timestep_embed's curve `table` an optional WEIGHT operand but left the
arity check demanding exact equality with the schema, so every sinusoidal issuer —
qwenimage21, minimaxh3's full-form path — died at step 0: engine_e2e_test has been red
since that commit. The check now accepts a count at or above the last REQUIRED operand
and nulls the dropped schema slots, which is what rad_abi.h promises ("an absent
optional operand is a null RadTensor.data") and what every shim already branches on
(r4d_opt(), rad_args_have(), libref's finish(); the curve kernel still requires the
table when curve > 0). Only TRAILING optionals: an omitted optional before a required
operand would shift positions, which is the miscount the check exists to catch.
Co-Authored-By: Claude <noreply@anthropic.com>
Three map_rows sites reordered ff.net.0.proj rows so the gate landed SECOND, while
silu_mul / gated_quant_fp8 gate with the FIRST half (comfy's _swiglu_eager — the
reference that produced the ground-truth clips — chunks gate-first). Every DiT,
refiner and video-VAE-decoder FFN therefore computed silu(up)*gate instead of
silu(gate)*up: the block-0 device internals dump measured the FFN down-projection at
cos 0.49 against the reference while attn/to_out sat at the bf16 floor, and renders
came out over-bright with 37.8% of pixels clipping high. The maps are now identity
(checkpoint order) at all three sites; quant scales follow because they are computed
from the mapped rows. TE blocks were never affected (separate gate/up concat,
already gate-first).
Reconverted with --reuse (707 tensors / 803 weights): minimax-h3-dasiwa-w8a8-gatefix.rad.
Byte check flips in every class (vae relFro 1.7e-3 vs 1.24 swapped, bias exact, dit
sign-match 0.989 vs 0.484, ref fp8 2.6e-2 vs 1.37). Device A/B 512² 6s seed 1234:
clipHi 37.8% -> 0.1%, luma 136 -> 81 (reference 86), T2VA control clean; step-0
velocity vs the full CPU reference cos 0.9886, std ratio 1.071 (was a 7.6x gap) —
the W8A8 quant floor.
Kept: the R4D_DIT_SEL-gated decoder parity shadows (dbg_vd_* decl fields + driver
readback) that localised the fault.
Co-Authored-By: Claude <noreply@anthropic.com>
The per-block window verdict showed the block stack faithful to its quantization
floor (cos 0.98 -> 0.78 smooth decay over blocks 0-19, cascade at 20), leaving
the 7.6x step-0 velocity-std gap pointing at the FinalLayer. Dump its two own
operands so a CPU replay can judge them without the trunk: norm_out's modulated
stream over the first 256 video rows (bf16 -> f32 cast shadow) and lane/step's
shift|scale table row. The driver writes them as dit_hn.f32 / dit_nout.f32
after the existing slab files.
Replay verdict (compare_head.py, dasiwa-w8a8 dump): the table's video cell
equals t8 @ norm_out.linear + bias to the bf16 floor (relFro 1.5e-3, no silu --
the curve form bakes it, a_temb.x aliases b_temb), and the checkpoint head
reproduces the device velocity exactly (row cos 1.000000, affine 1.0000). The
head and its modulation are faithful; the vel-std gap is a harness-side
statistic, not a device op.
Co-Authored-By: Claude <noreply@anthropic.com>
The first replay verdict (dev vs ref step-0 velocity) came back decorrelated
(cos -0.45, affine relFro 0.89) -- the fork is somewhere in the 50-block trunk,
and the modulation interface is EXONERATED against the checkpoint (dev_mod
cross-check: every block's cell = ada_w_block @ the step temb + bias, cos
1.0000, std ratio 1.000; weight order [video,text,audio] for stream cells
[text,audio,video]). To say WHO diverges and WHERE, declare_dit (env-gated) now
also casts the stream's first 64 rows into [L, 64, D] f32 PERSIST after every
block -- the same rows and ordering point the next block's norm reads -- and
the driver reads it back as dit_blk.f32. 69 MB, one cast op, no fingerprint
lost: the CPU harness gained the matching window stats (win64std) + ref_blkwin.
Co-Authored-By: Claude <noreply@anthropic.com>
The DaSiWa overlay ships its modulation curve as a precomputed table (adaln_t_table
[1025,8]): timestep_embed gains a curve mode -- y[m] = the table linearly sampled at the
timestep, no sinusoid, no MLP -- in the HIP, AVX and ref tiers, and the arch drives the four
timestep rows (video, audio, and each re-embedded with its reference pin) through it with the
ada projections as plain bf16 K=8 lines. The dasiwa-w8a8 recipe carries the overlay.
Device-verified at 512: T2VA, I2VA and FL2VA complete clean and the T2VA re-run is
bit-identical; the fried look PERSISTS on the exact finetune the reference clips rendered
from, which kills the checkpoint-style theory and pins the fork to Radiance's forward.
For the value-parity localisation: R4D_DIT_SEL (env, driver and plugin) declares f32 PERSIST
shadows of the stream entering block 0, the timestep table and the step-0 modulation, and the
driver reads those plus the velocity head back on a plain request's step 0 into
R4D_ENC_DUMPDIR, for the CPU reference DiT replay to diff against.
Co-Authored-By: Claude <noreply@anthropic.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
#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>
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>
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>
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>
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>
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>
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
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)
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>
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>
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>
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
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
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
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
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
Judge slice 31 FAILed a91bf44 and the operator's thumb confirmed it: the
request table still locks under a phone drag. The media-query override
listed bare .hold, but the base '.hold { overscroll-behavior:contain }' is
defined LATER in this file -- equal specificity, later rule wins the
cascade, so the override matched and lost. The .pbody half won (its base
rule is earlier), which is why the page scrolled some of the way but the
request block did not.
Fixed by specificity, not by moving the block: '.body .hold' outranks the
base '.hold' regardless of order, and the media query stays co-located
with the other breakpoint rules per this file's convention. The graph
modal (.ginfo .pbody) deliberately stays contained: it is an overlay the
user scrolls on purpose, and chaining out of it into the page behind is
the wrong feel.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Two operator findings from live phone use:
- Scroll trap: nested scrollers (the request/batch card bodies and .hold)
carry overscroll-behavior:contain, set deliberately for the desktop wheel
so a scroll over the request table does not move the page behind it. On a
phone that containment traps the thumb-drag: the card scrolls, bottoms
out, and the page refuses to chain -- the operator's 'scroll halfway, then
use the sides for traction' symptom is exactly that, the margins being the
only place with no scroller under the finger. Narrow screens now restore
overscroll-behavior:auto so the scroll chains to the document; desktop
containment is unchanged.
- Caption: the Speculation panel's live figure reads 'conditionally
accepted' (displayed uppercase by .cap), naming the ratio's basis on the
face of the panel. README's reference to the same figure follows. No test
asserts on either string (checked before editing).
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Slice 23 refuted my 'survive a failed write' claim in the primary geometry:
a write fails at the cap, the cap check's out.tell() FLUSHES the dirty
buffer and raises OUTSIDE the handler -- the poller dies with a traceback
and no exit summary, exactly the terminal state the cap was supposed to
prevent. Fix: on a failed write, drop the dirty buffer and reopen; the cap
check is wrapped so a size check can never be the thing that kills the
poller.
Can-fail verified with a real EFBIG geometry (RLIMIT_FSIZE 5 KB, cap 104 B,
live engine): the pre-fix code dies 'OSError: File too large'; the fixed
code completes the run, 16 rotations, exit summary printed, rows counted.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Operator ruling 2026-10-20, on the three real-time figures: the decode-step
headline, the acceptance tile, and the Speculation live figure.
The defect was the FREEZE. Each of these held its last value while the lane
did nothing, so a stale number kept wearing a current name -- a reader
checking the dashboard at rest read a measurement of work that was not
happening. Judge slice 10 named the failure mode in review.
The fix follows the page's own convention rather than inventing one: every
other live figure on this page shows 0 when the lane is idle (tps() renders
0 as "0", and the engine publishes 0 rates when nothing runs), so 0 IS the
idle signal here. The dash stays reserved for a quantity that has no value
at all -- no draft head, no engine attached.
- Decode step: the tile reads this window's step time; a window with no
decode steps reads 0. The engine's own best/recent floor figures below it
are the engine's windows and stay put.
- Acceptance tile: drafted nothing this poll -> 0. Dash only when there is
no draft head at all.
- Speculation live figure: same condition, same 0.
Sparklines are unaffected: setMetric() pushes nothing for a null sample, so
history stays honest across idle gaps. The restart path needs no special
case -- a restart poll has no delta, so it reads the idle 0 -- and the
pooled-ring clear inside accWindow stays, so a pre-restart pair never pools
with a post-restart one.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Non-gating findings from the Tasmania judge fan-out (reviews/judge/):
- HELP text on radiance:decode_step_seconds_best/_recent said 'seconds per
token'. It is a window mean of STEP times, and with speculation a step
emits several tokens, so the two differ by the accepted-per-step factor --
the wording invited a comparison that is wrong by exactly that factor.
Now says PER STEP and names the conversion. No test asserts on HELP text
(server_test parses it into d.help and never reads it), so this is a
documentation-only change to the exposition, not to the value.
- noteSample gains a argument; acceptance passes win=false. Its
winAt["accept"] ring was written every poll and read by nobody --
acceptTriple takes highest from extAt and recent/now from accPool -- so it
was a second copy of the same samples that a reviewer reasonably mistook
for a second figure.
- RECENT's '15 s at the 500 ms poll' is true only while the quantity keeps
updating; acceptance samples only when it drafts, so its 30-sample span is
30 UPDATES, minutes under sparse drafting (slice 01). Comment corrected.
Diff is 16 insertions / 7 deletions across two files, read line by line
(scripted sweep -- no test would have caught a wrong anchor).
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Auditor gating fix 2 (Qwen 27B, AUDIT-qwen-20261020.md §6), confirmed by
judge slice 05. An append-only recorder with no cap is a disk-full timer:
at 1 poll/s the /stats payload runs to hundreds of MB a day, and the
terminal state was an uncaught OSError traceback with no exit summary.
--max-mib (default 256) rotates keeping 5 generations; rows carry their
own timestamps so the chain stays readable in order. A failed write is
now counted and the poller survives to report it. dt_s moves to the
monotonic clock -- a wall-clock step could make it negative and every
consumer dividing counters by it would inherit the step; t stays
wall-clock because it is a timestamp, not a delta.
Can-fail check run against the live engine: --max-mib 0.00002 produced
17 rotations with generations capped at .1-.5 and no rows lost. Does not
touch the engine or the page, so the running image is unaffected; this
lands for the PR and for whenever statsdump is wired in.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Two judge slices (Tasmania 27B, :8101) independently found what the auditor's
pass at 1505ef2 missed: accWindow pushes {ratio, dr, da} but acceptTriple read
d.r/d.a/last.r/last.a -- accPrev's names, a different object. Every pooled sum
was undefined, so the acceptance detail line was frozen at 'highest X% - recent
-' in the PRODUCTION page since 1505ef2. The headline was unaffected, which is
why it looked alive. Fixed to d.dr/d.da/last.dr/last.da.
Also from the judges: the Speculation 'Average' bullet printed 0% for an
undefined lifetime marginal (no drafts yet), breaking the panel's own rule that
0 reads as failure -- now a dash. The comment above it cited a 'GUIDE' that does
not exist; it now cites the README section, which is re-landed here (dropped in
the rebase onto v1.9.0) with the worked example corrected: 56/75/77 implies
43.4% marginal, not the 44% previously claimed.
New test the_pooled_acceptance_ring_reads_the_names_accWindow_writes holds both
sides of the ring contract to the same names -- it fails on the exact bug above,
which no C++ test could see because the page JS is never executed here.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Auditor Qwen (27B, :8788) returned SHIP-WITH-FIXES; this is gating fix 1.
accPool was push-only, so after an engine restart up to RECENT=30 delta
pairs from the dead process pooled with the new one's and biased 'recent'
-- largest exactly when a restart is likeliest to change acceptance.
Restart detection now also watches uptime_s going backwards, which catches
the case backward counters cannot: a backgrounded tab whose accPrev froze
while the new process drafted past the old one's lifetime total, giving a
positive bogus delta. On either signal every pooled ring is cleared and
the accept headline + Speculation figure dash for that poll instead of
freezing a dead process's ratio. Also drops the dead accDelta/ACC_WIN
left by the pre-pool design and corrects the stale '10 s' comment.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Full-suite build of the production branch FAILED 1 of 96: dashboard_test
every_field_the_page_reads_is_one_the_routes_emit reported the page reads
draft_positions[].length/.push/.shift. Cause: that test extracts every
'p.<field>' inside update() and asserts each is a field /stats emits --
p is the page's conventional name for a draft_positions element. My pooled
ring buffer reused p for an array, so its own methods were read as engine
fields. No logic error; a naming collision with the test's contract.
Renamed to 'ring' in update() and acceptTriple(). The gate worked exactly
as designed: rc=8, flip aborted, lane stayed on stock.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
Math audit before the production roll (op request): triple()'s recent
averaged per-poll ratios, but polls carry unequal draft counts, so quiet
polls weighed as much as 500-draft polls. Live c8 replica measured the
skew: avg-of-ratios 65.7% vs pooled 54.7% -- 11 points, growing with
burstiness. The tile now keeps a per-concurrency ring of delta pairs and
reports sum(accepted)/sum(reached) for recent and now; highest stays the
full-session extreme. Speculation panel headline unchanged (it is the
newest window ratio, which is a per-poll quantity by definition).
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
metrics: export radiance:decode_step_seconds_best/_recent (omitted until measured)
scripts: statsdump.py -- /stats to JSONL verbatim recorder
Base: pr/decode-floor tip 14c5c8a (PR #142 content). Rebase onto v1.9.0 owed at
review time: upstream dashboard.cpp moved +87 lines in 1.9.0, expect conflicts.
NOT pushed, NOT merged. Turnstone review pending (Qwen busy).
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
(cherry picked from commit 4a8b8fabdd834f8eb59320e1945471a8caff47c9)
Merging main brought 1.10.0's own 24 -> 25 bump, byte for byte the same two lines this
branch carried (abi/rad_abi.h's RAD_ABI_VERSION and the layout test's snapshot constants),
so the merge made those files identical to main and the PR's diff fell from 49 files to 47.
What is left is a version number that names two different layouts. main's 25 grew
RadGeneratorDecl (aux_max_tokens, sigma_grid, min_tokens, aux_tokens), RadStep's
conditioning tensors and the tokenizer's RAD_PRE_* constants; this branch's grew
RadBuildCtx by the trailing cvec pointer, which is that struct's offset 112 of 120. Both
trees said 25, and core/plugin/loader.cpp compares nothing but that number, so the one
direction that matters -- an engine from this branch loading a plugin home built from
1.10.0 -- was accepted: qwen4exp reads ctx->cvec at declare (qwen4exp_fp8.cpp:951) out of
an eight-byte-shorter struct, past its end, and treats whatever follows as a direction
table. The PR's own note, that an engine from here refuses an older home and names the
stale .so, was no longer true for the release it now merges.
26 it is, with the layout table and the snapshot constants saying so. ABI 25 keeps
meaning what shipped.
Discovery's third path, <home>/vectors/<arch>-control-vector.gguf, was the one an operator could
never rely on: it existed, but nothing filled it, so a deployment had to fetch Cudecnik's package
and rename two files before the switch was worth anything. The published file is small (483 KB),
specific to this architecture and width rather than to any one quant, and unchanged from upstream,
so it belongs with the other things the home ships next to architectures/ and kernels/.
CMake copies the GGUF and its JSON into the built home (and installs them under the data dir), which
means a missing file is a configure error rather than a silently missing feature. Discovery order is
unchanged, so the per-container and per-directory sidecar paths still win when an operator places one.
The directions are a derivative of Qwen3.8-Flash-Next and are not ours to relicense: they stay under
the Qwen Community License 1.0, whose text now sits beside them (data/vectors/LICENSE.qwen-community-1.0.txt),
is recorded in NOTICE, and is installed to share/doc/radiance/third_party/qwen-community.LICENSE. The
Apache-2.0 grant covers the loader and the kernels, not the directions.
The feature is still opt-in -- without --control-vector the file is never read -- and the request
default is still off, because what this particular vector removes is a safety behaviour.
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.
The graph is declared once, so whether the projection op exists cannot follow a per-request
switch. It follows a startup flag instead:
--control-vector off load the vector found for this model, requests default off
--control-vector on the same, requests default on
--control-vector disabled load nothing (also the default with no flag)
`disabled` declares no op, so an unprojected request costs the stock model's launches rather
than 41 empty ones; a request that asks for the vector is refused by name and the admin route
answers 404. `off`/`on` keep the per-request switch and the dashboard default.
Measured four ways on one box (stock, disabled, off, on -- one boot each, six 4,096-token answers,
speculation off): decode 85.1 / 86.1 / 83.7 / 82.8 tok/s. `disabled` is the stock graph, so there
is nothing to pay; `off` pays the 41 launches, `on` pays the projection. KLD mode serves no
request to carry the switch, so `--control-vector on` is how the projection itself is scored;
config_test covers the three states and the absent default.
GUIDE 4.10 carries numbers instead of assertions: the first-token table over 18 policy prompts
(stock / off / on inside one boot, KL over the union of both top-20 lists), the engine's own KLD
metric over eight boots a side (off 0.021-0.075 mean KL, median 0.044, against unmodified stock's
own floor of 0.019-0.095, median 0.046; permutation p=0.96), and the finding that the boot-to-boot
spread is bimodal (~0.02 or ~0.08 mean KL, top-1 ~96.5% or ~92.5%) and wider than any neutral-text
effect the switch has. The measurement runs are what took the space; the result is one table and a
paragraph about what can and cannot be claimed from this box.
libavx's README transcript is refreshed to 1.9.0's counts (924 checked per ISA level).
The loader stored a norm for every direction in the file, and the plugin declares
an op wherever a layer's scale is nonzero, so `layer_range` (4..44, the package's
own selection) reached only the range checks and the log line: the engine steered
all 47 directions -- 94 hc_project instances in the declared graph where the
sources and the docs say 41. The scale is zeroed outside the range now, which is
what RadControlVector documents ("a zero scale means this layer is not steered")
and what llama.cpp's patch does (its tensor is absent outside the range).
cvec_test asserts it for the default and for a JSON-stated range; --debug-graph
shows 41 a rank.
The direction table is also taken back out of the VRAM budget
(VramFacts::held_out). It is allocated in declare(), before vram_budget_resolve
reads free VRAM, so without the term the pools are planned around bytes the
program never sees. On this box the split came out identical either way
(claimable 12.92 GiB in both), so the term is a guarantee by construction rather
than a fix for an observed miss -- and it keeps a deployment that merely offers a
vector on the same plan as one that does not.
Reading the field's own name last made a null canonical value win over a
non-null alias (JSON null leaves the parsed bool untouched, so it became an
explicit off) and made a malformed alias fail a body whose canonical field was
valid. The loop now walks the field first, skips absent and null keys as the
rest of the parser does, and stops at the first one it finds: the field wins,
null means "the deployment's default", and the alias is only read when the field
is not.
server_test covers both -- a body with both spellings, and a null field with the
default on -- and cvec_test pins n_dirs, which the startup line now prints.
Stale text that outlived the fixes around it: the deleted unit's filename in
libr4d's gated-residual comments, hc_project missing from that unit's header,
"THE SPEED PROJECTION" heading the page's control-vector code, ABI 22 comments
beside a table that says 23, a projection_test header crediting rad-kbench with a
case it does not have, a comment stating the wrong scale arithmetic, a duplicated
<cstring>, and GUIDE's "off in all cases" (the admin switch flips it). libavx's
README transcript is refreshed from a real run (807 checked, at every level).
And the test the alias order needed: a body carrying both `control_vector` and
`experimental_speed_projection`, with the field's own name winning.
The direction table is indexed by layer (row 0 unused) and sized n_layers, so a
file carrying direction.<n_layers> passed the range check and then wrote one
row past `dir`, and a package JSON whose range ended at n_layers read one past
`scales`. Both bounds are exclusive now, and cvec_test covers each: direction.48
of a 48-layer model, and a JSON range 4..48 on the same model.
The startup line printed `n_layers - 1` as the direction count -- the published
file's count, but wrong for a file carrying fewer directions; the loader records
what it read and the line prints that. Also drops an unused <cstring>.
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.
The route's own comment, server.h and the dashboard's page all say a deployment
without a vector answers 404, and the page uses exactly that to tell "no vector
here" (hide the panel) from "not signed in" (show it, disabled). The handler
answered 501 instead, so such a deployment showed a panel claiming the vector was
present. The route now assembles the same 404 the server uses for a model it does
not serve, and the case that had no coverage -- a deployment without a vector --
checks it. The unreachable 405 arm goes: only GET and POST are registered.
The device kernel did not implement the operation core/cvec.h states, in two ways
found with a card probe (one row, n 2560, hc 4, through the plugin's own entry
point):
- it offset the direction by the stream (`v + blockIdx.y * v_ld`, with v_ld
falling back to n), so each hyper-connection stream was projected along a
NEIGHBOUR layer's direction -- rows of the table the caller never named, and
past its end when the range ends at the last row. libref and libavx both use
one v for all streams, as the package's JSON does;
- its block reduction used `__shfl_down(acc, off, 64)` under a 64-lane "wave"
bookkeeping, but gfx12 runs wave32 and nothing sets -mwavefrontsize64, so half
of each 64-group's partials never reached LDS: one application left h.v at
0.45 where the operation leaves 0.
Now one workgroup per (row, stream), the direction read once per stream, and the
reduction is the house one (r4d_wave_sum, a partial a wave in LDS, kWaves 32).
The entry refuses a [hc, n] direction table by name instead of reading it as one
direction a stream.
The kernel moves into the gated residual's unit (r4d_hc_bf16.hip), which already
has kWave/kThreads/bf2f/f2bf and the hc_common operand checks: one file fewer and
89 lines fewer than the standalone unit, and no duplicated reduction or conversion
code.
Measured through r4d_rad_hc_project after the change: each stream's h.v ends at
1e-3..6e-3 (bf16 rounding; rel_l2 1.6e-3 against the operation computed in
double), a row with `on` 0 changes 0 of its 10240 bf16 values, and a [hc, n]
table is refused. ctest -L fast: 80 of 82, the two failures environmental
(videos_test needs FFmpeg, ops_doc needs gawk, absent from rad-toolchain).
cvec_test writes control-vector GGUFs and checks what loads and what must not: the published shape,
the package JSON setting range and scale, a wrong architecture or width, a gap in the range, a
non-controlvector file. projection_test pins the per-row mask (a mixed step projects one
conversation and not the other) and launches libref's hc_project against an independent computation,
including the untouched disabled row. ref_test gains the operation's behavioural case, its
vocabulary entry and a sweep geometry.
The field is per request, with the deployment's runtime default when absent, and a deployment with
no vector refuses 'true' by name rather than serving the stock model. Strata's
`experimental_speed_projection` is accepted as an alias.
The dashboard's Model view carries a "Control vectors" panel with the switch for that default;
GET/POST /admin/control-vector is its endpoint, behind the API key like every other route. The state
is in /stats and /server_info. Nothing here reloads the model: the directions are uploaded once and
each step carries a per-request mask.
The panel stays visible when the page has no API key, with the reason, instead of disappearing --
a control that vanishes because the page has not signed in reads exactly like a build without the
feature.
`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.
HcProject in arch/common/rad_block_hc.h owns the block: its per-token switch buffer
(`projection_on_rows`, a derived buffer), the per-layer op and the issue point. The plugin declares
it with one call per layer and issues it with one call after the feed-forward write -- the place
llama.cpp's build_cvec(res_hc, il) sits in the qwen4exp graph, in both the serial and the pipelined
step. An unsteered layer, or a deployment with no vector, declares nothing and issues nothing.
h[s] -= scale * (h[s] . v) * v for each of the hyper-connection streams s
llama.cpp's --cvec-mode project semantics: the dot is per stream, because the patch applies it to
the [n_embd, hc, tokens] view where mul_mat(v, cur) reduces over dim 0. v is one layer's unit
direction (f32), scale is the norm its file stored, and 'on' is a per-row int32 switch: a zero row
is skipped without a read or a write, so an unprojected request is byte-identical to a deployment
with no vector loaded.
libref is the oracle and the host fallback, libavx carries it at every ISA level, libr4d (one
workgroup per (row, stream), LDS reduction) serves the card. docs/OPS.md gains the row and the
operation's three facts.
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.
A card whose PCI BAR spans less than its VRAM was refused at startup, because the kernel argument ring is written by the host and the runtime maps such VRAM PROT_NONE. Instead, place the ring, and a recorded pass's argument blocks, in a pinned host memory pool and grant them to the card, as HIP's own launches do; every dispatch then reads its arguments across the link. A card whose BAR spans its VRAM keeps its arguments in VRAM, unchanged.
RADIANCE_DEBUG_AQL_HOST_KARGS forces the host-memory path on a card that needs no fallback, to measure the cost.
Probe the expert encoding as qwen4exp does, declare the rotated input pair, set the GPTQ
calibration tap, and read expert sources stacked or per expert.
- ActFP8::q8_rot marks fed codes as rotated. NormQuantFP8 declares (ar_)rmsnorm_had_quant_i8g and
GateQuantFP8 declares gated_had_quant_i8g when an activation is fed and rotated. LinearFP8 takes
fed codes on an i8a8h weight only if their rotation is the weight's.
- The MLP no longer writes the bf16 silu product when the down projection is fed.
- qwen35_w8a8 feeds the normed input and the FFN activation only where libr4d declares the ops
(at TP2 the all-reduce form too), so the CPU graphs are unchanged.
A decode step's had_quant_act_i8g launches fall from 288 to 64; the 64 left quantise the attention
and delta-net outputs. The codes are the same bytes. On 2x R9700, against 1.9.0 with the RTN
container:
- KL rows are identical, and greedy answers are byte-identical at TP2 and TP1, with acceptance
unchanged.
- TP2: 33.98 -> 32.87 ms a decode step, 111.2 -> 114.9 tok/s.
- TP1: 55.81 -> 54.59 ms, 62.7 -> 64.1 tok/s.
- Prefill: +2%.
arch_test pins the unfused chain where the ops are undeclared, and the fed path where they are
(had_quant_act_i8g 8, rmsnorm_had_quant_i8g 16, gated_had_quant_i8g 8). The every-op-declared graph
hashes are re-pinned.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An i8a8h linear quantises its own input from the bf16 plane with had_quant_act_i8g, so a decode
step of the int8 Qwen3.8-27B issues 288 of them after the norms and the silu product. These three
device ops write those codes from the producer instead:
- rmsnorm_had_quant_i8g and ar_rmsnorm_had_quant_i8g (exact and wire=6): norm_quant_row gains an
HI8 form, r4d_fwht_wave<128> and then quant_group<I8>, on the lane mapping, rotation and rounding
had_quant_act_i8g uses.
- gated_had_quant_i8g: the gated kernel's existing ROT && I8 instance, which the shim refused.
Each writes the bytes its producer followed by had_quant_act_i8g writes. They are ops of their own,
not a flag on the fp8 forms, as gated_had_quant_fp8 is: a rotated and a plain quantiser must not be
substitutable. n % 128 == 0; device only, so a graph falls back to the pair where they are not
declared.
r4d_selftest checks each against its pair byte for byte (plain, with the residual add and the
residual it leaves, and the gated product) and that each refuses E4M3 codes. The all-reduce form
is skipped like ar_rmsnorm_quant_fp8, since it needs a peer rank.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The decode timeline shows sample_temp at ~10 us a step on the 31B at tp 4: a launch over every
row's whole vocabulary shard (up to 256 workgroups a row) whose rows all return at once, since a
greedy request under a split vocabulary has temperature 0 and a plain sampled one 1, and the
kernel leaves both as they are. Sampler::run now issues it only when a chain row has another
temperature; every other row's logits are untouched either way, so the tokens are the same. The
request check's note on greedy chain rows now says when run() issues the stage.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Counter blocks: the per-(stream, output) counter blocks of the fp8a8 split-K finisher (split_ctr),
the gated delta-net conv (ru_conv_ctr), the mxfp4a8 decode GEMM and the hc mix are zeroed with
hipMemset, which queues on HIP's null stream and returns before it lands. The engine launches on
queues of its own that need not wait for that stream, so the first launch on a new block could run
beside its own zeroing: a split-K finisher counting arrivals while the memset reset the count gives
that one launch a wrong output. r4d_moe.hip's router counters and the all-reduce's IPC allocations
already wait; these four now do too (hipDeviceSynchronize, once per block).
Seen as a greedy reply that differed on the first request of a freshly started 31B DFlash2 server
(2 of 13 fresh starts on 4x R9700, 2026-10-17; every later request matched): the drafter's fp8a8
GEMMs take split_ctr blocks on their first launch, and a draft that differs moves the verify blocks,
whose rounding the target's greedy choice can feel at a near-tie. No value changes otherwise.
Weight transfers: resolve_weight puts the mover's `ready` wait on the issuing lane's stream, but
remembered the generation it waited on per weight for the whole context. A weight resolved first on
lane 1 then had its wait on lane 1 only, and the lane-0 GEMM resolving it next skipped its own and
could read the slot before the copy landed. The Gemma 4 26B-A4B's dense arm is such a weight: a
decode step issues it on lane 1, beside the routed arm, and an overlapped prefill on lane 0.
waited_gen_ is now per lane, one record for each of the context's two lanes (set_lane admits 0 and
1 only), indexed by lane_ like the other per-lane state: at worst one more stream wait. Inert where
no transfer is in flight (static weights, the 31B on four cards); it matters wherever weights
stream.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge: the 31B's global layers merge their split-KV partials in merge_body
(r4d_attn_paged_window.hip), one wave a row, four splits at a time into one accumulator chain:
~9.4 us a layer on 4x R9700 in the decode timeline. Each group's loads went out only after the
previous group's FMAs, so a row paid one L2 round trip a group. Group g + 1's loads now go out
before group g's FMAs (two register groups in turn; 175 VGPRs at head_dim 512, no spill). The FMAs
and their order are unchanged, so the bytes are too.
The prefill kernel: attn_wmma_kernel (the 31B's global layers at prefill, ~1.1-1.5 ms a 1024-row
slice on 4x R9700) does three things a tile that change no byte:
- fp8 V widens to its f16 pairs with v_cvt_pkrtz: every e4m3 value is exact in f16, so the pack's
rounding and f16_bits' clamp (unreachable under 448) leave the same bits, for 2 instructions a
pair instead of ~10.
- A tile wholly inside [lo, hi) and, causal, at or before the block's first position is visible to
every valid row, so it takes its scores without the per-key masks.
- With an fp8 cache, a wave whose rows all kept their running max (corr exactly 1) skips the
rescale of O^T: x * 1 = x.
One-card microbenchmark of the three with the skip on both caches (the kernel against the shipped
one, random operands, a 1024-row slice at the end of the context): head_dim 512 gqa 8 fp8 cache
1481 -> 1295 us at context 4096, 657 -> 531 at 2048, 2220 -> 1785 at 6144; head_dim 256 gqa 2 fp8
675 -> 544, bf16 589 -> 511. Every output byte-identical to the shipped kernel's at all four
instantiations (512/8 and 256/2, fp8 and bf16). The skip measured ~4% at head_dim 512 with an fp8
cache, but with bf16 its split loop ran ~10% slower than the fused one (1634 against 1427 us at
context 4096; v_cvt and the interior path alone: 1318), so bf16 keeps the fused loop.
fp8x16_f16, left with no caller, is removed.
The pack is f16x2_exact: v_cvt_pkrtz on gfx12, f16_bits elsewhere (the host SIMT emulator,
tests/r4d_emu, compiles this unit as C++), the same bits since neither rounds a value exact in f16;
r4d_emu_attn passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On gfx1201 a launch whose wavefronts fall in the last 32 before a multiple of 2048 (every wave slot
of the R9700's 64 CUs x 2 SIMDs x 16) runs about five times slower than the same work one workgroup
wider, whatever the kernel does. A launch-count sweep on one card (2026-10-17): 256-thread
workgroups take 27.6 us at 253 to 256 of them and 5.2 us at 252 or 257, for a norm, an LDS-only
kernel and a plain copy alike; 128- and 512-thread workgroups hit it at the same wavefront counts.
An empty kernel does not, and moving the data does not move it.
The 31B lands on it: qkv_norm_rope at a tp-4 verify is 16 rows x 16 heads of 8 wavefronts, exactly
a full card (21 us a call against ~6 expected; kbench's one-card 4-row point, 256 workgroups, 17.4
us against 5.3 at 8 rows), and a drafter's 256-row head norm through rmsnorm likewise (21.9 us).
r4d_cliff_rows(rows, per_row, waves) is the row count to launch: `rows` when clear of the window,
else the first count past it. qkv_norm_rope, rmsnorm and rmsnorm_p launch that many and return at
once in a row at or past the real count, so every result is the same bytes. r4d_selftest's
qkv_norm_rope case gains 8 rows of the head-256 class (32 heads a row: 256 workgroups, padded).
The window's two numbers are the R9700's, named as such in r4d_common.h, and apply on every target
libr4d builds for (RDNA4 only). They are not derived from the device: no other card has been
measured, and HIP's multiProcessorCount counts WGPs, not CUs, on RDNA. On an RDNA4 part with fewer
CUs a launch padded here costs one idle row and gives the same bytes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The kernel re-read its row from memory in each of three passes, each behind a barrier, so a
row cost three dependent round trips: 11 us a launch at any height on gfx1201 against a 4.2 us
launch floor. Every pass partitions the row the same way, so at 1024 threads (M <= 32, n <= 8192)
each thread now loads its own columns of the branch row, the residual and both gains in one go
and keeps them in registers; only the fragment-order store crosses threads, through LDS as
before. Same sums in the same order and the same per-element arithmetic, so the same bytes.
8.2 us a launch in a four-card microbenchmark at 1, 4, 8 and 16 rows of 5376.
The row gains a reg axis (1 the new form and the default, 0 the old), and the selftest checks
both forms against the unfused chain at M=8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gemma4TextScaledWordEmbedding multiplies the looked-up rows by `embed_scale.to(weight.dtype)`,
which is sqrt(5376) rounded to bf16: 73.5. gemma4_bf16 multiplied the trunk's embedding by the
unrounded 73.32, and the assistant head's entry, which reads the trunk's embedding module, did the
same. The first layer's norm hides a 0.25% scale, but the residual stream every later layer adds to
does not. arch/gemma4 has taken the bf16 value since it was written (53.0 at 2816).
Both now take embed_scale(n_embd), the bf16-rounded value. arch_test's two checks of the scale
expect 73.5, and its three pinned gemma4_bf16 graphs move with the `mult` they record; no other
model's pin moves.
On 4x R9700 at tp 4 the replies move against main's, as a 0.25% scale on the residual stream
would (7 of 7 long prompts, drafter off). A drafter trained on the reference's hidden states
tracks the corrected stream better: z-lab's DFlash drafter (the next change) accepts 2.88 tokens a
step over seven 2-6K-token prompts against 2.71 with the scale unrounded, and 5.21 against 4.91 on
a code prompt (270 against 259 tok/s).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a_mover_gives_back_every_event_and_device_byte compares the process's KFD VRAM after two
identical runs. Each stream is a hardware queue, and KFD gives every queue a context save area
(the topology's cwsr_size + ctl_stack_size, 29.3 MiB on a 64-CU RDNA4 card) that can be released
a few milliseconds after the queue is destroyed. A reading straight after the test's streams are
torn down sometimes still held it: on 2x R9700 the check failed about 1 run in 5, by exactly
30765056 bytes, and polling showed the figure back within 10 ms.
settled_vram reads process_vram every 10 ms until 100 ms pass without a change, for at most 2 s,
and both readings use it. The warm-up run and the 2 MiB + 4 KiB allowance stay. Back to back on
the card, place_test -perf_ passed 17 of 20 runs before and 20 of 20 after; the host backend
passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ar_rmsnorm_quant_i8_4rank is the wide family's exact four-rank one-shot with the junction (the
residual add, the sandwich norm and the int8 quantiser) as its epilogue, as ar_hc_write_4rank is
that one-shot with hc_write. The reduce is the standalone exact all-reduce's arithmetic element by
element (fp32 from zero, ranks ascending, one rounding to bf16), so the reduced row matches it to
the bit, and the junction is rmsnorm_quant_i8's over that row. It shares the standalone
all-reduce's transport and instance and ends the engine's link hold itself, as docs/TP4.md asks of
a new collective row.
Every block takes one handshake, a system-scope release by its first thread and a system-scope
acquire by every wave. Both fences are needed: on 4x R9700 behind an EPYC root complex, dropping
either left the readers with stale scratch on nearly every element. `nblocks` 2 and 4 (fewer
handshakes, each block owning several rows) are tune points, off by default.
r4d_selftest's case of the same name holds every rank's reduced row, residual, output, codes and
scales byte for byte to all_reduce followed by rmsnorm_quant_i8 on four cards, at 1, 8, 40 and 97
rows of 5376 and 64 rows of 2816. r4d_selftest is now installed in the image, so a card box can run
the rows' checks without a build tree.
At four ranks a 31B decode step issued 121 standalone all-reduces, 119 of them followed by a
separate norm launch. The plugin now declares ar_rmsnorm_quant_i8_4rank for steps of up to 4 rows
(kAr4FoldRows), where it serves every junction but the last layer's feed-forward one: a decode step
issues 2 standalone reductions. Taller steps, every speculative verify among them, issue the pair
(the all-reduce, then rmsnorm_quant_i8): a one-shot sends three times the message a rank, and at 16
rows the standalone all-reduce's exact two-shot beats the fold's per-row handshakes.
On 4x R9700 (the w4a8 container, tp 4, two rounds): plain decode 90 / 90 / 89-90 tok/s against
86 / 87 / 86 for code / prose / story, and 85 against 82 after a 6442-token prompt, +4.7%; a
DFlash verify at 16 rows measured 300 tok/s on the pair against 276 on the fold, hence the band.
Both paths give the same bytes. Where no library declares the fold, every step issues the pair.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Image-conditioned MiniMax-H3 (I2VA/L2VA/FL2VA = first_frame/last_frame) rendered
over-saturated / posterized while T2VA was clean on the same container. Root cause:
the reference conditions a keyframe TWICE -- a vision-tower anchor (clip.tokenize
images=[kf] -> <Picture N> soft-tokens in the text conditioning) AND a VAE-latent pin --
but Radiance did only the VAE pin for endpoint keyframes. The absent semantic anchor
left the DiT reconstructing the frame from low-level VAE pixels alone -> posterize /
black-outline / oversaturation.
Route endpoint keyframes through the existing vision-tower media path, so they produce
<Picture N> anchor soft-tokens in addition to their VAE pin (the reference's dual
channel). No new kernels, no ABI / arena change: build_cond stages r->media generically
and the arch scatter is the generic op_mm.
- videos.cpp: keyframe index = <Picture> ordinal (first=1,last=2); stable-sort keys
by kind before merge; run the prepare+placement loops for FIRST/LAST_FRAME as well
as IMAGE (area-matched tower form, aspect-kept; the exact-canvas VAE pin is a
separate, unchanged second encode); budget wording covers keyframes.
- video_driver.cpp: a towerless container no longer refuses a keyframe request (skip
FIRST/LAST_FRAME in the "needs a vision tower" scan) -> pin-only path runs; the
encodes guard still requires the VAE encoder and now labels a keyframe correctly.
Device A/B (uncensored w8a8, TP2, seed 1234, 512^2): prompt tokens i2va 27->291,
fl2va 1560->2088 (the +256 / +2*256 keyframe vision tokens + labels), t2va 27->27.
T2VA output is bit-identical across binaries (text path untouched). Image-conditioned
output diverges (cos 0.77/0.80): the realistic I2VA mid-frame recovers foliage
structure (blobs -> trees), softens outlines and shadow detail toward the clean control;
FL2VA gains semantic adherence (prompted "wings spread" now renders). Endpoint-pin
cosine unchanged (0.971 / 0.988 / 0.980, at/above the 0.985 bar). No budget reject.
Tests: fl2va keyframes now feed the tower and still pin the ends (index 1/2, token
stream with both vision blocks); towerless fl2va pins-only; driver-level keyframe
conditions through the tower and needs no tower. NOTE-REF2VA.md #8 closed.
Co-Authored-By: Claude <noreply@anthropic.com>
Radiance's video denoising had only first-order Euler. The DaSiWa reference
workflow samples MiniMax-H3 with res_multistep + simple, so add it as a second
order option, exposed as a `sampler` field on /v1/videos (default euler).
New op `flow_res_multistep` across all three kernel tiers (device==avx==libref),
closed form reusing the driver's per-step scalars:
x' = r*x + hb1*den + hb2*x0, den = x + sigma*v, r = sigma_next/sigma
order 2: h=ln(sg/sgn), h_last=ln(sg_prev/sg), r_s=h_last/h,
hb1=(1-r)(1+1/(2 r_s)), hb2=-(1-r)/(2 r_s)
hb1+hb2 == 1-r, so it collapses to Euler when x0==den. Order 1 (Euler) is forced
at the first step, the first full-size step after a latent upscale (stale
history), and the last step (sigma_next==0); order 2 otherwise. The previous
denoised estimate persists in new PERSIST buffers b_vx0/b_ax0. Verified equal to
k-diffusion sample_dpmpp_2m to 5.6e-17 on three sigma grids.
- ABI 23->24: trailing int32_t sampler on RadVideoGenBatch; RAD_SAMPLER_EULER=0
/ RAD_SAMPLER_RES_MULTISTEP=1 in rad_runtime.h.
- driver: R_SCHED region widened 6->16 f32 ([0..5] Euler, [6..10] video coeffs,
[11..15] audio); step_dit branches on V->sampler.
- server: `sampler` string field ("euler"/empty, "res_multistep", else
invalid_request_error with the supported list); echoed on the job object;
capabilities advertise video_samplers.
Tests: rad-avx-check 816 + 451 hand-built, 0 fail (left-assoc grouping matches
ref/device at tol 0); r4d_selftest --case flow_res_multistep_f32 f32|bf16 x
order {1,2} exact, both INOUT pitch gaps untouched.
Device-verified (TP2, fp8 container, 256^2/2s/10-step, seed 1234 identical):
both samplers complete clean 73-frame h264; outputs differ (branch genuinely
consumed, not ignored); bad value rejected; field omitted -> euler. res_multistep
renders warmer/higher-contrast than euler -- a tone lever, not an over-exposure
fix. The euler default path is unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
/v1/videos now emits webm (VP9+Opus) and webm-av1 (AV1+Opus) as well as mp4.
docs/DOCKER.md gains a "Video output: MP4 and WebM" section covering what the
ffmpeg stage must enable, the runtime shared libs (libvpx9/libaom3/libopus0) the
rootfs ldd-chroot gate pulls transitively (they are link-time deps of libavcodec,
not dlopen), the BSD/no-GPL license posture, the graceful mp4-still-works path,
the 32k->48k Opus resample, and no-card verification. Fixes the stale
"three encoders" comment in the Dockerfile header.
Co-Authored-By: Claude <noreply@anthropic.com>
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.
A `format` field chooses the container a generated video is written in:
mp4 (the default, H.264 + AAC, unchanged) or webm (VP9 + Opus) or webm-av1
(AV1 + Opus). Old-hardware users -- this box's CPU is Zen 3, AVX2 only --
get the browser-friendly WebM the DaSiWa workflow ships without a fragile
client-side re-encode, and both webm codecs so either a VP9-friendly or an
AV1-parity file is available.
core/mm/mp4.{h,cpp} become core/mm/video_out.{h,cpp}: Mp4Writer generalises
to VideoWriter with a VideoFormat enum, branching the muxer, the video
encoder (libx264/libopenh264 for H.264, libvpx-vp9, libaom-av1/libsvtav1),
the rate-control options and the audio codec. Opus encodes only at 48 kHz,
so a WebM soundtrack is resampled to 48 kHz with libswresample (the model's
is 32 kHz); the encoder is fed packed FLT at its fixed frame size, AAC keeps
the planar FLTP path at its own rate. faststart and the shift_data reader are
MP4-only; WebM writes forward. Each codec/muxer is runtime-discovered and a
missing one fails open() with a message naming it, so the mp4 default always
works.
videos.cpp parses `format` (mp4|webm|webm-av1, mp4 default, refusing any
other name), threads it to the job and the writer, serves the file under the
matching content-type and a .webm/.mp4 Content-Disposition, echoes `format`
in the object, and advertises video_formats in the capability block.
The Docker FFmpeg build gains libvpx/libaom/libopus and the webm/matroska
muxers (all BSD, so the LGPL posture holds) and their runtime libraries.
Verified host-side: the videos_test webm case writes a real VP9+Opus file
(completed on libvpx-vp9, EBML magic + content-type + disposition checked);
a standalone writer harness produced mp4/webm/webm-av1 at 512x512 with stereo
32 kHz audio -- ffprobe reports h264+aac@32k, vp9+opus@48k and av1+opus@48k
respectively, and all three decode in software on this AVX2-only box.
Co-Authored-By: Claude <noreply@anthropic.com>
b025018's W8A8 DiT path unfused the norm: rms_mod wrote a bf16 plane and
each int8 linear re-quantised it. That bf16 plane grew the activation arena
14.41->15.54 GiB, which left vram_kv=0 and the server aborted at startup.
Mirror the E4M3 path instead. rms_mod_kernel gains a third quant mode (i8),
sharing r4d_q8.h's q8_top/q8_pack4 with the int8 quantiser, exposed as the
new rms_mod_quant_i8 op; the block's modulated norm now writes a_hm's int8
code pair directly (a_hm is q8_fed, so qkv/gate_up read the codes with no
per-linear quantiser) and a_hm carries no bf16 plane. ActFP8::cq()/cs()
resolve the pair by trunk format, so the norm producer and both step issues
collapse to one path. LinearFP8's int8 guard now demands the bf16 plane only
when it quantises itself, matching the fp8 branch, which never required it.
Arena is back to fp8 parity (243 buffers, vram_kv 938 MiB); the container
serves at TP2 and renders all five task types device-clean.
Co-Authored-By: Claude <noreply@anthropic.com>
--mm-max-patches now says that a pass is not one tower invocation (8 tiles
per weight read at most, 4 at the 64 grid with the default pass), and the
Unlimited-OCR section explains the pass-per-geometry queue, the measured
TTFT ladder, the activation cost of batching, the tuning order and the
decode batching limit. Link the converted container
(Aijuus/unlimited-ocr-bf16) from the model table and the guide.
- sam_attn: tile queries and hoist the relative-position dots; the tower
drops from 0.44-2.09 s to 0.10-0.36 s per tile.
- processor: split OCR patch/LUT staging across rows, then make both bicubic
passes and the LUT append AVX2 (bit-exact, 1.15-1.38x host preprocessing).
- tower: batch the DeepEncoder across every tile segment of an encode pass.
Patch embed, the 12 SAM blocks, neck, the 24 CLIP blocks and the projector
run once per batch of up to 8 tiles (4 at the 64 grid); sam_attn and
attn_dense stay segment-independent through B+1 cu tables, and position
tables are host-staged PERSIST planes. B == 1 emits the old graph.
Fix the newline layout: the reference expands image_newline over every map
row, while the copy read past the one-row vector; with a multi-tile batch
that made the trailing cells live data and the decoder dropped the text at
the right margin of every line.
- attn: instantiate attn_paged_qrow at head_dim 128 (bf16 and fp8 caches) and
read OCR's q slice of the fused q|k|v plane in place, keeping the dense cast
as the fallback when the library does not serve the qrow row.
- tests: h128 attention emulator cases, a batched-tower arch test, an AVX2
bit-identity test, and a 15 s arch_test CPU budget for the image.
Measured through the router at 256 tokens: 8-page TTFT 4157 -> 1327 ms, 640
page 608 -> 284 ms, 8 concurrent pages 17.6 -> 4.26 s wall; decode unchanged
at ~344 tok/s. Parse gate 0.9901 text / 1 px on the deployed image.
The denoiser's linears were E4M3 with fp8a8 activations. Three mantissa bits
band the smooth per-token activations that carry image detail (a watercolour
look) and the 448 clamp clips highlights (oversaturated colour). int8 is 126
uniform levels per group with no clamp, at the same one byte a weight, so the
container footprint and served memory are unchanged; iu8 WMMA runs at the fp8
rate. A quarter of E4M3's error on the activations that were the fidelity limit.
Serve the fp8 and the new int8 containers from one plugin, told apart by
probing one trunk linear (linear_is_w8) before the activation code planes are
declared. There are no int8 forms of the fused producers (rms_mod_quant_fp8,
gated_quant_fp8), so for the int8 trunk the producers come apart: plain rms_mod
writes a bf16 modulated-norm plane and each int8 linear quantises that plane
into its own codes (LinearFP8::i8's quant_act_i8g), and the gate is a bare
silu_mul. The attention's own quantiser already emits int8 (QuantFP8 q8_fed),
so o_proj reads those codes directly. A trunk read entirely by int8 linears
declares no E4M3 code pair (ActFP8::declare_qs fp8_pair=false), freeing arena
the KV cache needs.
data/recipes/minimax-h3-w8a8.recipe converts the DiT linears to symmetric int8
on a per-row 128-column grid; reuse the fp8 container and list only the
transformer.* tensors as changed.
Co-Authored-By: Claude <noreply@anthropic.com>
Follow-up to the link-bound finding: tried --embedding-placement vram to
take the 1.45GiB/rank embedding read off the gen4 x8 link. It resolves to
VRAM but starves the KV cache: static weights fill the whole per-card
weight budget -> every MoE expert streams + vram_kv=0 MiB -> startup
aborts (invalid argument). So the shipped embedding-in-ram default is the
trade that keeps VRAM for KV+experts; forcing it to vram trades a small
streaming cost for a catastrophic one. No rows produced (aborted before
VRAM claim). Cards stayed 61MB.
Co-Authored-By: Claude <noreply@anthropic.com>
Removed the 215W cap + −75mV undervolt, re-ran bench2.sh. Uncapped vs
capped: ~2% at 6s, 5.3% at 12s (207→196), noise elsewhere; busy=100% on
519/528 samples. Conclusion: TP2 diffusion is NOT SM-clock-bound — the
gain is small because the step waits on the gen4 x8 fabric (all-reduce +
embedding/encoder reads over the link), which doesn't shrink with core
clock. Corrects the earlier note that implied the cap was a major
long-row handicap; the sol 12s gap is not the power cap — the link cap
is. Leaving the box at 215W costs ~5% worst-case on diffusion.
Co-Authored-By: Claude <noreply@anthropic.com>
The fused q|k|v GEMM writes one plane, so the q operand is a column slice
whose row pitch is q_dim + 2*kv_dim. libr4d's attn_prefill_h128_gqa1_fp8kv
reads q only contiguous and refuses the slice with RAD_E_STRIDE, which aborts
the step and stops the engine on the first prefill. attn_paged_qrow would read
the pitch in place but has no h128 row (only head_dim 256/512), so lift the
slice into a dense [T, q_dim] buffer with a cast after rope, as gemma4 does.
The 2a1ca01..f308216 range's 45 review findings (12 performance, 33 quality)
are applied: ABI 23 for the RadBatch append, the fused q|k|v projection, the
batched patch-embed GEMM and pitched layout copies, the sam_attn w-dot hoist
with an alignment-gated vector row path and NaN poisoning for malformed
segments, the fused quick_gelu act, and the R-SWA/scheduler/drafting gates.
Quality items: stale comments corrected, env reads hoisted, the ngram_window
negative refusal, the parts-form chat template instruction, the whitelist
fallback warning, and the segmented R-SWA refusal of the fixed/runtime window
mix.
The 3.2 MB generated resample header becomes a 9.6 MB little-endian blob
(tests/data/golden/uocr_resample_golden.bin) read by a small loader;
resample_golden.py emits and round-trip-verifies it.
One perf-med item (AVX2 bicubic passes/LUT patch staging in the processor) is
left as the follow-up the review itself recommends; the code says why.
Verified: ninja -C build-review -k 0; host ctest 89/89; GPU r4d_selftest
0 failures, kbench/kbench_moe and the card tests pass.
LibreChat sends the picture followed by U+FFFC (an object replacement
character) as the text part, so the turn looked non-empty and the parser
instruction was not supplied; the model then emitted a one-word preamble
before the layout. Treat U+FFFC like whitespace and drop it from the
rendered prompt, and default the instruction for any picture count.
Render only the last user turn and supply the reference parser instruction
when that turn carries no text, so clients that send a bare image (or
system/history text) no longer get a prose preamble before the layout.
Mount the template directory read-only at /chat-templates.
One card via RADIANCE_GPU, --tp 1 --max-num-seqs 8 --max-model-len 32768,
--kv-cache-dtype fp8, the vision tower on the card (the default placement)
and --gpu-headroom-mib 96. About 7 GiB of VRAM, so the other service in
this directory is stopped first.
The lossless-webp round-trip test failed on this host because FFmpeg's
native VP8L decoder rejects valid palette-coded libwebp streams (the
system ffmpeg 8.0.1 CLI refuses the same bytes; libwebp/PIL decode them).
The test now validates the RIFF/WEBP/VP8L container and tolerates exactly
that 'Invalid data' refusal with a visible note, while other decode errors
and wrong pixels still fail. media.h records the consumer-side caveat.
A 16000x1024 picture's 16-tile line takes two passes, 10+6: the earlier
chunk ends at its last tile, only the last carries the newline column,
only the real 4x4 separator is flagged, and the placeholders still equal
(10*cols+1)*10 + 273.
The pass packer now keeps a view and its one-cell separator in one pass, and
RadBatch carries each segment's grid host-side (enc_seg_h/enc_seg_w) so the
DeepEncoder no longer reads device coordinates to pick a geometry. The tower
lays out a line of n tiles as kMap rows of n*kMap features plus one newline
cell, accepts an earlier chunk of a longer line, and emits the learned
view_seperator for an explicit 4x4 separator rather than any square segment.
The device sam_attn resamples a rel_pos table that is not 2*tile-1 rows on
read (the 127-row global tables serve a 40-grid block as 79), matching
libref/libavx. The n-gram ban gains the reference's optional whitelist
(5th operand, OAI keys, generation_config alias) with range/dtype checks.
Gates: tiled e2e stage cosines 0.9994-1.0, det/text 0.9901 with every
coordinate within 1 px; two-page 0.9917 within 2 px; device selftest
sam_attn (incl. 127->79) and ngram whitelist (1344 columns) 0 mismatches.
DeepEncoder (arch/common/rad_block_sam.h): the checkpoint's SAM ViT-B/16,
neck and CLIP ViT-L/14 producing its 16x17+1 row layout, with a new
`sam_attn` op for the windowed, zero-padded SAM attention and its
decomposed relative-position bias (libref oracle, libavx kernel, libr4d
kernel and selftest). The plugin declares the tower when the container
records `radiance.encoder`, and splices its rows over the placeholders
after embed_lookup.
BOS: the chat path adds BOS when the rendered template does not already
start with it. This checkpoint's template is a bare concatenation and its
tokenizer states add_bos_token, so without it every position was off by
one and the det boxes came out wrong. A media run's placeholders shift
with it.
R-SWA: RAD_KV_RING, paged like a window group but with a per-sequence
floor armed at admission. adv_groups now computes the same clamped
seqused and modulo ring slots the builder stages; the mismatch read the
block table's -1 padding and faulted the card. Prefill stays causal;
prefix cache, checkpoints and speculation are off for the group.
Sampling: sample_ngram_ban in libref/libavx/libr4d and the host chain,
the request knobs, and the container's generation config (35 over 128).
Processor: the checkpoint's grid/mode selection, its tall-last tie order,
Pillow's bicubic pass order, and goldens generated from its own code.
Tools: --mm-max-patches auto-detection accepts a tower stated as per-width
tables under vision_config.image_size, and rad-convert records
radiance.encoder.
Verified: tower stages match the checkpoint's code (rows cos 0.9998), the
device sam_attn selftest is within tolerance, the R-SWA device repro
returns text, a GPU e2e reproduces the reference's first det block, and
the host suite is 88/89 (known webp decode baseline).
The text side of Unlimited-OCR: a 12-layer, 1280-wide decoder, 10 query heads over 10 KV
heads at head_dim 128, a dense layer 0 and 64 routed experts (top-6, softmax, no
renormalisation) plus one ungated shared arm in layers 1-11. arch/unlimitedocr_bf16/
carries its own plain-Llama bf16 attention, the shared MoE block in its bf16
external-input mode, and the tied LM head; data/recipes/unlimited-ocr-bf16.recipe is the
bf16 passthrough convert. core/format/checkpoint.cpp learns n_routed_experts, so n_expert
is read from the checkpoint's own key.
The router is issued as one op rather than a selection and a sort: libref gains
router_topk_scatter and router_gemm_topk_scatter (the second with the shared expert's
one-column gate at N = 1), libavx composes both from its router/gemm/scatter kernels, and
both get sweep geometries and the gate-absent/gate-present tests.
libr4d had no head_dim 128 leg at ratio 1, so every attn_paged band of this geometry
resolved to no kernel and the server refused to start on device.
r4d_attn_paged_h128_gqa1.hip instantiates the generic body at GQ 1 for both legs; the
rows and the selftest cases come with it.
Device numbers, one R9700 (gfx1201, HIP 7.16), bf16 weights and KV, no reference-kernel
fallback: a 523-token prompt prefills at 35.0-35.8k tok/s (15 ms) and a 4043-token prompt
at 54.2k tok/s (75 ms); decode is 351-354 tok/s (2.82-2.85 ms/token) at short context and
315 tok/s at 4k. r4d_selftest is 0 failures; the host suite is 86/87, the miss being
mm_test's lossless-webp decode, which fails on this box in code this change does not touch.
Endpoint keyframes are resized to the target canvas and their latent rows share the TARGET grid
(ref2va_build), so they must VAE-encode at output resolution -- but venc_geom had a flat
h,w > kEncMaxSide(256) reject, so I2VA/L2VA/FL2VA failed at any output above 256 with "the video
encoder refuses a reference at 512x512 over 1 frames". The flat cap is a crude proxy for the real
limit: the encoder holds one clip's pixels sized for a kVaeClipLength(17)-frame clip at 256
(Rmax=17*256^2). Replace it with clip*h*w <= 17*256^2 -- a multi-frame video ref is unchanged
(clip=17 forces each side back to 256), while a one-frame media fits at up to sqrt(Rmax) per side.
No buffer, kernel, or arena change: a 512^2 keyframe (262k rows) is a third of the existing budget.
A first relax then faulted ("cast n=128 at M=262144 outside band") because the encoder's debug
shadow casts (op_ve_cindbg / op_ve_ldbg / trunk / nout -- write b_vcin/b_vl/b_vtrunk/b_vnout, read
only under R4D_ENC_SEL) were issued on EVERY encode at a PF[] plane range a 512 frame overflows.
Gate them on R4D_ENC_DEBUG (the env the readback already uses): a no-op for the production latent,
and it stops paying for debug work on every encode.
Device-verified: FL2VA 512x512 and I2VA 512x512 12s complete clean, server survives, no band fault;
host vae_geom/video_gen/videos/ref2va_pack/encoding tests green.
Co-Authored-By: Claude <noreply@anthropic.com>
One keyframe path serves three DaSiWa modes: first_frame pins output frame 0,
last_frame pins the last frame, and the gap is diffused. A keyframe is pure
attention conditioning -- its VAE latent rides as a pinned (update=0) cond row
at its frame's time position, faithful to comfy/ldm/minimax/model.py where
keyframe latents are img_update==False rows. The sampler is untouched; the step
merely widens to carry the extra cond rows.
- server (videos.cpp/iface.h/adapters.h): first_frame/last_frame form parts ->
VideoRefMedia::FIRST_FRAME/LAST_FRAME; kf_task validation (i2va/fl2va need
first, l2va/fl2va need last); keyframes are mutually exclusive with refs;
encoder_image_canvas(cover=LAST) sizes the anchor.
- driver (video_driver.cpp): keyframe pass issues a RAD_ENC_IMAGE Vencode per
anchor (slot = ++ref_tab[1], ordered), appends ref_tab key triples
{frame(0|frames-1), video_t=1, audio_t=0}.
- arch (minimaxh3.cpp): ref_parts emits keyframe cond parts FIRST; the step
scatter admits kR2VCond/kR2VCondAudio rows.
- tests: video_gen_test keyframe-completes-widens-the-step-and-pins-the-ends
(2x Vencode at slot 1,2; widened step; seg_cu/lat_cu/ref_tab pinned); fake_pack_ref
lays keyframe rows (nk=0 byte-identical to before); videos_test keyframe API.
Device-verified (TP2, seed 9999): FL2VA completes a valid 73-frame MP4+AAC; pins
are consumed (fl2va != same-seed t2va) and force the endpoints (frame0 vs anchor
0.687 pinned vs 0.460 un-pinned; last 0.719 vs 0.521). Fidelity follow-up (not
function): anchors ride as pins only; the reference also feeds them through the
TE as vision tokens, so a prompt that contradicts the anchor lets text win --
full endpoint parity vs a golden needs TE-anchor tokens (#10/P6 bucket).
Co-Authored-By: Claude <noreply@anthropic.com>
Chaining already works via ref_video; the FL2VA exact-pin is an alternative
mechanism whose fidelity claim has no golden on this box, and its wiring lands
in the shared step_dit — so it is left pending rather than blind-changed.
Co-Authored-By: Claude <noreply@anthropic.com>
Record the fixed-shape TP2 wall-clock (plain 256/3s/25st=12s, 512/3s/25st=38s,
full-shape ref2va 256=93s / 512=121s). Encoder value-parity half of P6 is done;
the dual-vs-two-singles claim is documented as blocked on the external Hermes
sol-attn ComfyUI baseline (the 590/315 rows are stock-attention floors that
include queue wait), not on anything in this branch.
Co-Authored-By: Claude <noreply@anthropic.com>
In step_venc the ResnetBlock shortcut conv (op_sc) was issued after norm1
(op_n1), but on a shortcut level norm1 normalizes the input `in` IN PLACE
(nb = E.in), so the 1x1 nin_shortcut residual was fed silu(norm1(x))
instead of the raw x the reference uses:
ResnetBlock3D.forward: x = self.nin_shortcut(x) # raw, before any norm
return self.conv2(h, pre_norm=norm2, residual=x)
This shrank the residual term on every shortcut level (cout != cin, i.e.
levels 1 and 3), producing the ~0.49x structural deficit that accumulated
down the video/image VAE trunk. Reorder op_sc to read `in` before op_n1
overwrites it -- an op reorder, not a kernel change; it corrects the SHARED
trunk so the image encoder's fidelity is fixed too.
Localised by a frame-0 per-level bisection: R4D_ENC_SEL=all now dumps
frame-0 f32 shadows of every level's post-resnet output v_lv[0..4].a
(dbg_ve_l0..l4, a 9-buffer host slab) alongside the existing tail, and
ref_venc_parity.py --evcl0..--evcl4 compares each against the reference
level output on the device's own staged pixels. The std ratio walks to the
exact entry point -- conv_in 0.999, L0 0.999, L1 0.455 (first shortcut
level) -> every level 1.000 after the fix, tail nout/q48/q2 to the bf16
floor (relFro ~4e-3, affine 1.000). Device-live: a single-image ref2va
encode generates clean with the fix loaded.
Co-Authored-By: Claude <noreply@anthropic.com>
Adds a fourth R4D_ENC_SEL=all shadow — the norm_out INPUT (v_lv[5].a, level-5 trunk) as an
f32 PERSIST cast twin (b_vtrunk), via a new trailing RadVideoGenDecl field dbg_ve_trunk (no ABI
bump) + layout rows + a 4-readback "all" slab (trunk|nout|q48|q2). ref_venc_parity.py gains
--evctrunk (whole-volume vs per-frame GroupNorm discriminator) and --expand/--zeropad (single-frame
temporal tests).
Device-anchored golden comparison on a 256x256 image exonerates, one by one: input normalization
(byte-identical affine + IMAGENET consts), norm_out (faithful, relFro 1.6e-3), GroupNorm extent
(device already per-frame; #20 closed), temporal handling (reference frame0 std flat 8.986 at N=1..17
under both replication and zero-padding vs device 4.40), a single multiplicative gain (nout differs
0.57 non-affinely after per-group norm => structural), and weight precision. The gap is a structural
~0.49x spatial-trunk deviation (conv_in/resnet/spatial-downsample), NOT confined/golden-fixable, so it
is documented precisely and left open — no shared-kernel edit. Host tier green.
Co-Authored-By: Claude <noreply@anthropic.com>
Rewrite the superseded "shared final-norm / encoder-norm-kernel scale fault"
narrative: the audio ~0.37x under-gain was a pre_block norm1/norm3 swap (a
wiring bug), now fixed and device-verified. Records that the shared LayerNorm
kernel is demonstrably fine (audio matches using it), which kills the
"one norm damps both families" hypothesis; the video/image (conv3d) encoder has
no pre_block and remains a separate, open divergence (with the GN-extent gap
#20 stacked on it). Keeps the pre-fix measurements as labelled history.
Co-Authored-By: Claude <noreply@anthropic.com>
The reference AttnProjection (comfy/ldm/minimax/audio_vae.py:267) computes
proj(norm3(x)) + attn(norm1(x)), then + mlp(norm2(·)). The two 2048-wide
LayerNorms are not interchangeable: norm3's affine |w|mean is 0.60, norm1's
0.27, so the projection branch carries most of the block's magnitude (std 6.6
via norm3 vs 0.4 for the attention via norm1).
The device had them wired the other way -- it staged norm1 into the projection
and norm3 into the attention (qkv). Feeding the small-affine norm1 to the
projection shrank it 6.6 -> 1.8, collapsing the pre_block output and every
audio latent downstream to ~0.25-0.27x the reference.
Fix: stage norm1 for the attention (feeding p_op_qkv) and norm3 for the
projection (feeding p_op_proj). Both LN ops are the same ln(...,2048,b_apb->
b_aln3) kernel, so only the consumer wiring changed -- no kernel touched, no
re-convert (norm1.*/norm3.* weights are already loaded correctly).
Also adds a gated read-only R4D_ENC_SEL=amb readback (dbg_ae_amb = b_amb, the
f32 mean_proj input): the bf16 b_ax2 readback lags the arena and dumps garbage,
so b_amb is the reliable pre_block output used to localise the gap. Inert when
R4D_ENC_SEL is unset.
Device-verified (seed=7 tone, minimax-h3-ref2va-fp8, warm TP2): pre_block out
b_amb std 1.65 -> 6.43 (ratio 0.25 -> 0.97); final latent b_enca std 0.23 ->
0.546 vs reference 0.588 (ratio 0.39 -> 0.93), affine slope 0.385 -> 0.923,
R^2 0.975 -> 0.989. Host tier green (abi_layout/arch/ref/videos).
Co-Authored-By: Claude <noreply@anthropic.com>
Architecture refutes the "per-level attenuation compounding" reading: both encoders
TERMINATE in a normalisation that re-writes activation scale (video norm_out=venc_gn
before conv_out/quant_conv; audio pre-block norm1/2/3 LayerNorms before proj/mean_proj).
A GroupNorm/LayerNorm output has std ~= its per-channel gamma regardless of input, so
any gain accumulated in the encoder BODY is erased before the latent is emitted. The
~0.37 can therefore only originate in the FINAL norm's affine application or the final
conv/linear: video norm_out(gamma)->conv_out->quant_conv; audio norm3(gamma)->proj->
mean_proj. The two families' scale differing slightly (0.385 vs 0.369) is simply those
final chains differing per arch.
Re-explains encoder-confinement cleanly: the DiT uses RMSNorm (rmsnorm_op), the encoders
use GroupNorm/LayerNorm kernels (shared with the latent upscaler) -- a defect in those
kernels is invisible to the DiT's RMSNorm path, consistent with the DiT generating
correctly. Narrowed confirming step recorded: dump per-channel std of norm_out output and
conv_out/quant_conv output (and audio norm3/mean_proj) -- post-final-norm std ~0.37 pins
the norm affine/kernel; ~1.0 with collapse only after conv_out/quant_conv pins those
conv weights. Not blind-fixed (shared with live image/plain + upscaler paths).
Also records a SEPARATE real fidelity gap found while localising (task #20): the device
GroupNorm reduces statistics over a level's whole clip volume, but the reference
TemporalIsolatedGroupNorm normalises per frame. Exactly neutral for the single-image
parity measurement (T=1) but it biases real multi-frame video reference encodes -- what
DaSiWa actually feeds -- as a shape change stacked on the 0.37. Recorded, deliberately
not touched (shared kernel; whole-volume pooling may be an intentional temporal choice).
Co-Authored-By: Claude <noreply@anthropic.com>
Fit a single global affine dev_sorted ~ a*ref_sorted + b to both encoders' value
distributions (both harnesses now print it):
audio (conv1d): a=0.385 b=+0.009 R^2=0.975 relFro 0.79 -> 0.062 after affine
video (conv3d): a=0.369 b=+0.159 R^2=0.912 relFro 0.65 -> 0.114 after affine
Two entirely different encoder networks both reduce to ~0.37x the reference with
R^2 0.91-0.98 -- near-perfect linearity. This overrules the earlier "not a single
scale" and "suspect the strided conv1d temporal reduction" readings: a conv-reduction
or structural transform bug would not collapse to a clean global scale. The device
encoders compute the right SHAPE of latent, damped to ~0.37x amplitude. The scale is
~0.37 for both but not bit-identical (0.385 vs 0.369) => not one shared post-multiply,
but a fixed per-level attenuation compounding over each arch's own depth.
The DiT generates correctly on the same fp8 path and the same normal kernels, so this
is not a global kernel/quant fault -- the under-gain is confined to the encoder pass.
Prime suspect: the encoders' per-level / per-frame GroupNorm (the per-frame CS in
{8,4} template) applying a near-constant sub-unit gain that compounds level-over-level,
or an encoder-path dequant scale mismatch the convert round-trip does not see. If it is
a fixed encoder-norm gain, a fix is confined to the encoder path and never touches the
DiT's norms -- which is why this is worth localising rather than shipping. Not
blind-fixed (encoder kernels are shared with the live image/plain encode paths).
Confirming step is cheap and read-only: dump one encoder block's GroupNorm input AND
output on-device, check whether output std is a fixed fraction of the reference GN.
docs/NOTE-REF2VA.md point 4 corrected (the superseded "not a single scale" clause) and
the affine table + encoder-specific-under-gain hypothesis recorded.
Co-Authored-By: Claude <noreply@anthropic.com>
The audio half of the #14 strict numeric value-parity was already measured and
found to diverge. This measures the OTHER half — the conv3d_ndhwc video/image
encoder, a separate kernel family — the same device-INPUT-anchored way, and it
diverges too, with the SAME signature.
New harness tests/data/ref2va/ref_venc_parity.py:
- Does NOT import comfy.ldm.minimax.vae (that drags comfy attention -> an aiter
JIT build that fails on this box), so like vae_geom/gen_golden.py it
AST-extracts just the encoder classes + the _normalize_pixels /
_encode_moments methods, execs them on torch alone, and loads the REAL fp16
minimax_h3_video_vae_fp16.safetensors into encoder+quant_conv (decoder
excluded; the encode path has no attention). --selftest validates the
reshape / normalisation / sorted metric with no device involvement.
- Device stores b_evc PATCH-FOLDED (op_ve_fold: 24ch x 2x2 = 96-wide rows) and
per-channel-normalised. The fold is a pure bijection and the norm is
per-channel, so the value MULTISET of the device slot region matches the
reference's normalised latent regardless of fold order; the harness compares
the two SORTED value vectors. This is immune to re-deriving the fold's
(t,h,w)+channel packing — the mistake that once cost a bogus audio reading.
- A single reference IMAGE is the cleanest case (encode()'s T==1 branch, one
clip, exactly one latent frame), so keep-first/last is moot; the harness
refuses T_pad!=1.
Two inert, R4D_ENC_DEBUG-gated dumps added to core/gen/video_driver.cpp (the
staged pixel buffer + enc_geom, next to the existing audio ones) so the
reference can be fed the device's OWN staged input and only encoder math can
differ. Zero-touch when R4D_ENC_DEBUG is unset.
Result on a 256x256 gradient picture: sorted relative Frobenius 0.65, device
latent std 0.44 vs reference 1.15 (~2.6x under-spread), max-abs 4.26. DIVERGED
like the audio path.
The finding is the SHARED signature: audio collapsed std 0.59->0.23 (~2.6x) and
video 1.15->0.44 (~2.6x) across two entirely different kernel families, AND for
BOTH families the latent-normalisation constants are byte-identical to the
reference (kVaeLatentsMean/Std vs LATENTS_MEAN/STD max rel-diff 0.0). So the
collapse is NOT the norm constants and NOT audio-specific — this refines the
earlier "suspect the strided conv1d temporal reduction" note. Localising it
needs stage-by-stage activation dumps on kernels the live image/plain paths also
run through, so the kernels are deliberately NOT blind-fixed. The device
encoders remain content-live and deterministic (cont.3/5/19): self-consistent,
so conditioning is genuinely live; only reference-matching OUTPUT fidelity is
open (= #10 / P6).
docs/NOTE-REF2VA.md point 4 records the video-half result and the sharpened
ruling-out of the normalisation constants.
Co-Authored-By: Claude <noreply@anthropic.com>
The device stores a slot's stereo latent channel-major with per-channel row
stride MAXA=625 (ch1 at base+625), not contiguous after ch0; the harness sliced
contiguous rows and thus compared reference-ch1 against device zeros. Fix the
slice to vstack the two channel blocks. With the correct slice the audio encoder
measures relative Frobenius 0.79 / corr 0.67 / device std 0.23 vs ref 0.59 — a
real encoder-network divergence, not fp8 precision (unbiased, floor ~1.6e-3),
not preprocessing (device-input-anchored), not the reference export (97 shared
encoder tensors bit-identical to the HF source), not the norm constants
(identical). Recorded honestly in NOTE-REF2VA: measured on audio; video/image
VAE is a separate kernel family, not yet measured; functional conditioning is
unaffected; kernels deliberately not blind-fixed.
Unblocked by the on-box torch env. ref_aenc_parity.py loads the reference HF audio
VAE (fp32) under ComfyUI's --cpu branch (no GPU context — the TP2 server holds both
cards), and compares the device's b_enca normalised latent to the reference encode()
run on the device's OWN staged enc_samples buffer. Device-input-anchored => removes
every decode/normalise/pad confound; a kernel bug shows gross, a correct fp8 port
shows at/below the ~1.6e-3 convert quant floor. --selftest validates the reshape /
slot / metric logic without a device (perfect->0, temporal-misalign->0.24).
Driver side: extend the R4D_ENC_DEBUG scaffolding to raw-dump the staged enc_samples
(host buffer at stage time) and the b_enca / b_evc readback to R4D_ENC_DUMPDIR.
Inert unless R4D_ENC_DEBUG + R4D_ENC_DUMPDIR are both set; host tier green.
Reference model.py re-baked golden.json byte-identical (no reference drift).
Re-baking golden.json under the on-box torch env (comfyui-rocm10-venv, torch
2.13.0+rocm) came out byte-identical, proving: (1) the reference model.py has not
drifted, and (2) the pack keyframe/cond golden is NOT stale or torch-blocked —
pack_golden_fl2va / _chain already assert kR2VCond layout bit-exact and pass. So
#8's PACK layer is reference-verified; only the engine consumption (driver keyframe
staging, step_dit cond scatter, tail input) is unwired. Corrects point 3's 'pack
keyframe rows remain unimplemented' and point 4/6's 'this host has no torch' (the
encoder value golden is now actionable, not blocked — not yet produced).
Wall-clock per job on TP2/dual-gfx1201 (empty queue, completed_at-created_at):
plain 256/512, step/duration/resolution scaling, and the full DaSiWa reference
shape (4 img + video + soundtrack + standalone audio). Conditioning cost is the
widened sequence, not the encoders. Self-contained scaling figures, NOT a
ComfyUI parity claim (parity = open, needs reference stack).
Acceptance test #5 on dual gfx1201/TP2: one request with 4 images + a video +
its soundtrack + a standalone audio is accepted and completes clean; changing
only the standalone audio at a fixed seed changes BOTH output streams, proving
the full-shape denoise consumes the audio reference (not just its count).
PLACEHOLDER AUTHOR — re-author before any push. Do NOT push.
Co-Authored-By: Claude <noreply@anthropic.com>
The gap note still asserted a defect the device probes disproved. All three
reference kinds (image, video, audio) are device-verified live + content-sensitive
+ deterministic on a warm-server fixed-seed content-control; the earlier
'video/audio give byte-identical output, encoder collapses' claim was a
measurement artifact (raw-MP4-byte comparison + a cold-start pair). Continuity
chaining is drivable today through the ref_video path (a control shows the tail
conditions scene B); the kR2VCond keyframe-pin mechanism stays open (FL2VA
exact-pin, reachable via image refs). Strict numeric encoder value-parity is
environment-blocked on a torch-less host and was never the claim.
PLACEHOLDER AUTHOR — re-author before any push. Do NOT push.
Co-Authored-By: Claude <noreply@anthropic.com>
Follows the merged-cell pin (c725a2d). That commit proved reference IMAGE
conditioning consumed on device; reference VIDEO and AUDIO were plumbed
through the pack and step but still refused at submit — only their decode
and encoder-enqueue were missing. This lands them.
Server (videos.cpp): `task ref2va` now decodes `ref_video_N` and
`ref_audio_N` (and a video's paired `ref_video_audio_N`) into encoder form
via the mm encoders and enqueues them as Vencode/Aencode passes, instead of
the old image-only decode loop that rejected them. A soundtrack is folded
into its video's row (the `audio` word), matching how the pack lays that
pair. Caps stay <=9 images / <=3 videos / <=3 audios.
Driver (video_driver.{h,cpp}): the encode queue `enc_q` now carries VIDEO,
VAUDIO and AUDIO items in presentation order; `ref_tab` stamps each
reference's latent counts straight from the encoder geometry (rad_arch_encode_geom:
a video's frame count eg[24]=its total latent frames, its soundtrack's eg[12]),
so the pack's ref segments are sized by the encoder, not hand arithmetic.
processor.{h,cpp}/iface.h/adapters.h gained the media decode entry points.
Arch (minimaxh3.cpp): step_dit scatters reference rows into the packed step —
picture/video via op_vin from b_evc, audio via op_ain from b_enca, at each
segment start, targets last. A bounds audit confirms the scatter reads exactly
the slot region the encode pass wrote this job (eg[24]=lat = the pass's
written row count = the pack's segment size; no stale-neighbor read).
DEVICE-VERIFIED on dual gfx1201 / TP2, warm server, fixed seed, comparing
DECODED stream md5 (never raw mp4 bytes — the muxer stamps a field): all three
reference kinds are DETERMINISTIC (a rerun of one reference is bit-identical,
including raw bytes) AND CONTENT-LIVE (a different reference at the same seed
gives different output video AND audio). Image (content tokens), audio
(tone/noise/880 distinct) and video (refv_a vs refv_b: both streams differ)
each steered the generation. An earlier "the video step is nondeterministic"
note was a measurement artifact — it compared raw mp4 bytes and straddled the
one-off cold-start outlier; the warm decoded-stream probe is bit-reproducible.
Debug scaffolding (R4D_ENC_DEBUG, 4 trailing RadVideoGenDecl fields + a pinned
driver slab + an FNV digest in done()) is entangled in these files. It is
env-gated and zero-touch when unset; STRIP IT BEFORE ANY PR.
tests: video_gen_test/videos_test/server_fakes cover the video/audio enqueue
paths; abi_layout_rows adds the new trailing rows; ref_audio_sensitivity.py is
a standalone host golden harness (audio reference separates 4/4), not a ctest
case. Host tier green (only mm_test's pre-existing webp demuxer gap fails, and
the GPU card/kbench tests fail solely on VRAM contention with a live server).
NOTE-REF2VA.md updated: continuity tail (#8) remains unimplemented; strict
numeric parity vs the ComfyUI CPU reference remains open.
PLACEHOLDER AUTHOR — repo has no git identity; re-author before any push.
DO NOT PUSH this branch.
Co-Authored-By: Claude <noreply@anthropic.com>
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.
The glm5next section of ARCHITECTURES.md (geometry, traps, KV groups, linears, tensor parallelism,
the MoE decode fusions, measurements), the conversion and the four RADIANCE_GLM_* variables in
GUIDE.md, the README's models table. deploy/compose/glm53-flash.yaml serves the container on eight
R9700s with the expert plane resident and the native MTP layer drafting, with the flags of the
measured run.
Co-Authored-By: John McDonough <18016200+JohnCMcDonough@users.noreply.github.com>
An architecture plugin for GLM-5.3-Flash (45 layers, 4096 wide) from its Quark MXFP4 export: four
mHC residual streams; KDA layers and full layers with absorbed MLA behind the DSA indexer; a MoE
block of 288 MXFP4 experts (top 8, sigmoid routing with a correction bias and route_scale 2.5) and
an ungated shared expert; clamped SwiGLU; the block-fp8 attention and MTP weights at their f32
scales; and its native MTP layer as the drafter. Under tensor parallelism experts shard by width,
MLA by whole heads, and the f32 router and index-head projections split their columns from 256 rows.
The MoE block's decode fusions are on by default (RADIANCE_GLM_ROUTER_FUSE,
RADIANCE_GLM_SWIGLU_QUANT, RADIANCE_GLM_GATHER_INVERSE; 0 restores the separate launches, byte for
byte). Its tool-call format is derived from the chat template, as for the other models.
data/recipes/glm53-mxfp4.recipe decodes only the combined MLA projection to bf16; every other
weight keeps its stored encoding.
arch_test declares the model at one, two, four and eight ranks and lints its steps: the mHC
connections, the routing's f32 path, the head-complete MLA shards, the indexer's cache pages and
tail ring, KDA's local heads, the expert geometry at TP4 and TP8, that the sizing declares give
the real graph at every arena level, where the decode fusions replace their launches, and, with
the fusions off, a pinned graph and step hash.
Co-Authored-By: Nunze <lorenz.lamping1@web.de>
New blocks: mHC (rad_block_mhc.h), KDA and its state (rad_block_glm_kda.h,
rad_block_kda_state.h), absorbed MLA over a latent cache (rad_block_glm_mla.h,
rad_block_mla_latent.h), the DSA indexer and its paged key cache (rad_block_glm_indexer.h,
rad_block_dsa_cache.h), the correction-bias router (rad_block_glm_router.h), and rad_tp_split.h:
a replicated f32 projection computed column-split over the ranks and all-gathered, so every value
is the replicated one's bits (from RADIANCE_GLM_TP_SPLIT_ROWS rows, 256 by default).
The shared blocks gain what GLM's checkpoint stores, each off unless a model asks for it:
- LinearFP8 reads a block-fp8 weight whose scale plane is f32 (dtype fp8a8f32), and the import
check accepts that form beside bf16 scales.
- GateQuantFP8 serves a clamped SwiGLU (swiglu_clamped), optionally fused with its quantiser.
- MoeFP8 takes MXFP4 experts (format 8) and block-fp8 experts with f32 scales (format 9), the
sigmoid router with f32 weights, an ungated shared arm, the router/scatter fusion and the
sort's inverse handed to the gather (moe_scatter_inv, moe_gather_inv) where they resolve.
- The MLP's gated fold excludes the forms it cannot serve (f32 scales, a clamped product).
share_test checks that KDA's convolution weight shards per head across its three parts at TP4.
The device rows for GLM-5.3-Flash's ops, at its geometry and at TP4 and TP8 slices:
- mhc_pre / mhc_post / mhc_contract, and mhc_pre_partial / mhc_pre_finish, which run mhc_pre's
own projection and finishing kernels with its chunk-sum order, so the pair is byte-identical
to mhc_pre at n 4096, hc 4, chunk 2048.
- kda_update_k128_v128_bf16, one, two or four value rows a wave, both state forms.
- dsa_pool_fp8, dsa_query_fp8 and dsa_score_fp8 (fp8 WMMA, 32 heads of 128).
- mla_attn: a matrix row whose WMMA tile holds a query's heads, or pairs eight heads of two
neighbouring queries over the union of their page tables, above the wave row; mla_project
with up to eight rows a thread or wave.
- gemm_nt_f32 and router_sigmoid_topk in tiled and one-wave-a-row forms; gemm_fp8a8_f32scale
and moe_gemm_fp8a8_f32scale read f32 block scales in place; moe_gemm_mxfp4a8 decodes e2m1 into
exact E4M3 bytes for fp8 WMMA, with an expert-major decode form and a wide prefill form.
- swiglu_clamped, and the device-only fusions of GLM's MoE block: swiglu_clamped_quant_fp8,
router_sigmoid_topk_scatter, and moe_scatter_inv / moe_gather_inv, which pass the gather's slot
table from the sort instead of rebuilding it.
moe_gather takes f32 routing weights in its column-per-thread kernel. The sort and the gather
kernels move from r4d_moe.hip into r4d_moe_sort.h and r4d_moe_gather.h, so the fused router and
gather instantiate the same code.
Every form that replaces another gives its bytes: tests/r4d_emu runs the kernels on the host
(test_f32, test_fp8f32, test_kda, test_mhc, test_mla, test_moefuse, test_moemx), r4d_selftest
compares them on a card against libref and against each other, and plugin_test pins the
mla_attn band. docs/OPS.md states what libr4d serves.
Co-Authored-By: John McDonough <18016200+JohnCMcDonough@users.noreply.github.com>
The reference and CPU forms of the ops GLM-5.3-Flash's graph needs, with their schemas and shape
hooks: mhc_pre / mhc_post / mhc_contract and the column-split pair mhc_pre_partial /
mhc_pre_finish; swiglu_clamped; gemm_nt_f32 (bf16 activation, f32 weight and result) for the
router logits and the indexer's head gates; router_sigmoid_topk (correction-bias top-k);
kda_update with per-channel decay and both state forms; dsa_pool, dsa_query and dsa_score; and
mla_attn and mla_project for absorbed latent attention. moe_gather takes f32 expert weights beside
bf16, and fp8a8f32 joins the dtype list. docs/OPS.md states each op.
ref_test checks every op against hand-computed cases, avx_check_hand the CPU forms against
libref, build_test the indexer cache's page size.
Co-Authored-By: Nunze <lorenz.lamping1@web.de>
qsa_select ranks max(score, 0) and treats a score at or below -1e30 as dead: QSA's block scores
are sums of relus, so the clamp changes nothing there. GLM-5.3's DSA indexer weights its heads by
signed gates, and its block scores can be negative; ranked through the clamp, every negative block
ties at zero and the selection is wrong. `signed` 1 ranks finite scores as they are (-0 tying +0)
and treats nonfinite ones as dead; absent or 0 is the ranking as it was. libref, libavx and libr4d
take it together, since the three declare one schema. docs/OPS.md; tests/r4d_emu/test_qsa.cpp
runs both rankings against the reference.
With a lending cache the staging region (two buffers of one layer's off-card experts) always came
out of the cache, which left a large-context MoE model short of its configured coverage. Expert
residency above the host pool's floor now pays first; the cache pays only when the experts are at
their floor, and an expert with no other home is never evicted for it. The startup report names
whichever paid. mem_test (prefill_staging_*).
The floor a KV pool must keep for one --max-model-len request came from a separate plan at
max_seqs 1. A hybrid model's recurrent and conv slots are fixed per configured sequence and stay
allocated while one request is active, so that plan undercounted and the pool it allowed could
not hold max_ctx. The floor is now pool_mib_for_tokens over the real plan's groups. mem_test
(hybrid_context_floor_accounts_for_all_configured_state_slots).
GLM-5.3-Flash's Quark export is MXFP4 throughout except the layers it excludes, attention and the
MTP layer, which it keeps as 128x128 E4M3 block-FP8 with F32 scales and names in
layer_quant_config. Every nonempty override map was refused. Each override is now checked: MXFP4
(fp4, per_group 32, e8m0) or block-FP8 (fp8_e4m3, per_block 128 128) passes, anything else --
including a null or empty weight, which flattening used to drop -- is refused by name.
The expert counts read n_routed_experts and n_shared_experts as DeepSeek-style configs spell them
(GLM-5's included). checkpoint_test covers both spellings, the mixed export, and the refusals.
The note_ready comment claimed "the page divides by this figure", but the
submitted dashboard does not divide by startup_s (the payback formula that did
was removed). Reworded to describe the actual risk: a zero cost would price
every restart as free in any payback formula that divides by it.
Dropped CHECK(gap_pct >= 0) in the decode-floor drift test: recent >= floor
holds by construction (floor is the min of the window means, recent is one of
them), so the check can never fail. The load-bearing assertion is the adjacent
CHECK(gap_pct < 3).
Authored at: Tasmania Qwen 3.8 27B Dense XHigh (level not visible) via Open WebUI
(cherry picked from commit 98429a9b15d7da1aa0e644cbd7e519d1bf33d797)
100% would claim a sustained floor the ~500 ms poll window cannot
confirm, and would read as a bug the moment a fast stretch briefly beat
the 32-step floor. Cap at 99 and show it with a tilde: "now ~99% of
best" says "at your best" without overclaiming. Anything slower still
reads a plain percentage of the floor.
Operator-directed 2026-10-18.
Authored at: Tasmania Qwen 3.8 27B Dense XHigh (level not visible) via Open WebUI
(cherry picked from commit 7c35068e60d8a7baf61483e4d2a6452d71e0bc6f)
The tile's detail line gained a third figure in 4fe6ff1 (now X% of best)
and a 100% cap in e083a2d; the GUIDE still described only the two engine
figures. Document the percentage: 100% is the fastest, anything slower a
percentage of it, capped at 100 because `now` is a ~500 ms poll mean while
`best` is a 32-step window mean, and keyed by concurrency above c1.
Authored at: Tasmania Qwen 3.8 27B Dense XHigh (level not visible) via Open WebUI
(cherry picked from commit 7263163748b98c1e5b5c9d4fa3e7fe8fed924678)
`now` is a ~500 ms poll mean; `best` is a 32-step window mean. A fast
stretch shorter than a window can therefore read faster than the recorded
floor, which the ratio printed as >100% -- "105% of best", which is a
contradiction: if it beat the best, the best should have moved.
The engine only ratchets the floor on a completed 32-step window, so a
sub-window blip is not a new record. Cap the figure at 100: a live window
at or above the floor reads "100% of best" (at your best), and anything
slower reads a percentage of it. The "best X ms" figure is unchanged.
Operator-directed 2026-10-18.
Authored at: Tasmania Qwen 3.8 27B Dense XHigh (level not visible) via Open WebUI
(cherry picked from commit e083a2d606c2194539bd0640916fb0ae0852962e)
The suffix was a ratio of time (100 * lastStepMs / ref): the fastest step
read 100% and anything slower read ABOVE 100% -- 18.75 ms against a 15 ms
floor printed "125% of best". Slower meant bigger, which is backwards.
Flipped to a ratio of speed (100 * ref / lastStepMs): the fastest reads
100%, anything slower reads a percentage of it (the same pair now reads
80%), and the figure can never exceed 100% because ref is always the
minimum. The "% of best" label now says what it shows.
Operator-directed 2026-10-18; live-verified on the Tasmania lane
(best 33.73ms / recent 35.76ms -> "94% of best").
Authored at: Tasmania Qwen 3.8 27B Dense XHigh (level not visible) via Open WebUI
(cherry picked from commit 6540ff811addc15288e6fcaa09b37b6c82ee7ebb)
The drift line carried a percent-of-best suffix that left with the drift
verdict on 10-18. Restored as a raw ratio, keyed by concurrency: a c8 step
against the fastest c8 step this process has done, never against the
single-stream floor (that cross-read is what made the old line lie about a
batch arriving). No threshold, no colour.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
(cherry picked from commit 4fe6ff1c838d67b642cc12782ce6a441368c3d76)
The five-rung chain that produced step_ns_decode_best/recent: the raw min that
latched 1.16 ms, the two guards refuted by measurement before being built, the
phase gate that passed 38,820 checks and failed live, window averaging that kept
a 10%-low floor, and the advisory whose premise — step time ratchets with engine
age — survived a day of watching zero observations. The advisory was deleted,
not tuned: the gap it priced is operating load (3-11% on a healthy lane), and
the payback formula assumed a permanent gain the lane never offered.
Written for the next contributor tempted to add a gate, a smoother, or a verdict
here: each rung's temptation was to add mechanism, and each rung's cheap move
was to measure the premise first.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI
(cherry picked from commit 9260f8e646c95aa8537d5e632a948bc54653c2ba)
The tile now shows two engine figures and no verdict, so the guide says what
they are: window means of 32 single-sequence steps, best the lane's most
favorable moment and recent its current one. The load-bearing sentence is the
one nobody can derive from the numbers: a gap of a few percent up to ~11% is
operating load on a shared card, not degradation, and not a reason to restart.
That claim is measured, not stylistic — the live lane held a flat floor while
its recent window moved 3-11% with what else the machine was doing.
Cross-references rad::DecodeFloor and the devlog for how the interpretation was
tested and withdrawn.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI
(cherry picked from commit 604617bd72b7360d3855acac5e96d82e51ef91b7)
The decode step's detail line now shows two figures the engine measures itself: the
fastest single-sequence decode window this process has run, and its most recent
one. Nothing is asked of the reader -- no ruler to type, no panel to open -- and
no conclusion is drawn.
Both come from the engine rather than the browser because the browser cannot
produce either well. A tab only sees the steps taken while it is open, and a floor
learned from a lane that was already degraded says "at your best" forever. The
engine sees every step and knows the concurrency of the step it timed.
Single-stream on both sides of the engine's own measurement. The floor is a
single-sequence window, so the engine keys it to one row: a decode step at eight
sequences is a different measurement, and reading it against a single-sequence
floor would report a batch arriving as a slowdown. On an engine too old to emit
the field, the page falls back to the fastest single-stream step this tab has
seen.
This commit previously also priced a restart, and that clause is removed here
after being built, deployed, measured, and refuted on live traffic the same day.
It compared the floor against the recent window, called the gap drift, and
computed a payback from startup_s. The gap is not drift. On a healthy shared lane
the floor held flat at 14.79 ms while the recent window moved between 15.2 and
16.5 ms -- 3% to 11% -- tracking what else the lane was doing: it froze when the
lane went idle and rose on a fresh short request, so it was neither context
length nor engine age. The payback formula assumes a restart's improvement is
permanent, so following it pays the measured 49 s bringup and re-drifts within
minutes; the line was advising a restart every 12 to 19 minutes forever, for a
gain that was never there. What floor-vs-recent actually measures is the distance
between the lane's most favorable moment and its typical one.
An earlier version of this clause also compared the engine's floor against a
median of the browser's per-poll means -- two instruments over different sample
counts, disagreeing by pure order statistics on a flat engine, a measured 7.7%
phantom drift. That is why the two figures shown now are both engine window means
of one stream at one size. They are honest numbers; only the interpretation was
withdrawn.
A verdict can return once someone observes what none of this data shows: step
time rising with engine age and staying up. Every excursion measured was load.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI
(cherry picked from commit 2eaf32201cb1a8c45857dfbb509a12acaa9ee216)
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)
The dashboard's restart advice needs a reference the degraded engine is read
against. Asking a human to type a ruler is fragile (a stale or mistyped number
silently mis-advises) and cannot see steps taken while the dashboard tab is
closed. The engine sees every step and knows the concurrency of the exact step it
just timed (plan_.n_seq_decode), so it can keep the reference itself.
Records two figures over single-sequence decode steps: the floor (the fastest
window mean this process has measured) and the current (the most recent window
mean). Both are window means of one stream at one size, so the advisory compares
like with like. A min, not a max: drift only raises the CURRENT step, so the
reference a degraded engine is read against is its own demonstrated floor.
Single-sequence on purpose -- a decode step at eight sequences is a different
measurement, so keying the floor to one row keeps a batch arriving from being
misread as drift. A mixed step is excluded by the phase gate even when it carries
one decode row: that row shared the step with a prefill chunk an order of
magnitude dearer.
Why not a raw min over step brackets: step timing is host-side, and with
pipelining on the next forward pass is issued behind the current step's commit.
Behind a step with long host work -- a prefill chunk, or a decode step that saves
a KV checkpoint -- the decode pass is finished before its own bracket opens, so
the bracket holds readback and commit and no GPU work. It is a real step
advancing a real token, so no token-count or predecessor-phase guard catches it.
A raw min latches that degenerate on the first occurrence and never recovers:
measured live 2026-10-18 on a TP2 R9700 lane, 1.16 ms against a 15.55 ms mean on
the first request after bringup.
Why averaging alone is not enough: these degenerate brackets are not rare. At the
observed ~1.4% rate a min over hundreds of windows reliably lands on a
degenerate-heavy window, and the floor sits ~10% below the true floor -- still
phantom drift, because the engine can never reach a floor that was an artifact.
So a candidate is rejected BEFORE it enters a window when it is under half the
running mean of accepted steps: degenerate brackets sit at ~9% of a real step and
real single-sequence steps at ~96%, so the populations are ~10x apart and any
threshold between them separates them -- 0.5 is the midpoint of that gap, not a
value tuned to one distribution. Filtering at the step level is essential; at
this rate a degenerate dilutes inside a 32-step window to ~0.91x, which no
window-level threshold would catch.
The first window is recorded by neither figure. The rejection gate needs a
window's worth of accepted samples before it can judge one, so the first window
is un-gated by construction; recording it lets the floor latch an unreachable
value forever (measured: a 5% degenerate rate put the floor ~2% low through
bootstrap alone). The cost is one window -- about a second of single-stream
decode -- against a 46 s bringup and a 10 s repaint, so it is never observed.
The estimator is a small struct (rad::DecodeFloor) so it is testable on a
synthetic stream: the scheduler fixture runs steps in microseconds and cannot
manufacture a degenerate bracket, which is why the first round of tests missed
this. The tests feed streams laced with degenerate-short samples, assert a raw min
latches them, assert the estimator rejects them and tracks the true floor, and
assert the rejection does not eat real steps.
Emitted on /stats as step_ns_decode_best and step_ns_decode_recent (0 until the
first gated window completes). Trailing zero-defaulted fields on both SchedMetrics
structs plus the adapter copy -- neither struct is ABI-pinned (scheduler<->server
internal), so this is the sanctioned append. Matches the kv_tokens_max
running-extremum precedent.
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (xhigh) via Open WebUI
(cherry picked from commit bf5a803deaa08ae0c2d94e2c3dda0d518c08d9aa)
Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
(cherry picked from commit d1dd050d5165536885840fb485f7041706938f8c)
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>
Ref2VA ref-image conditioning verified on-device: ref step runs all steps no
fault; output differs ref-present vs ref-absent (by log). 6-9 images rejected
cleanly at submit (no engine crash). Merged-cell modulation (<=9) tracked next.
NOTE: placeholder author -- re-author before any push. Do NOT push this branch.
Co-Authored-By: Claude <noreply@anthropic.com>
GLM-5 writes <tool_call>NAME<arg_key>K</arg_key><arg_value>V</arg_value>...</tool_call>: no
prefix of the name's own and no suffix, the name ends at the first argument or at the call's
close. The tagged family now takes an empty name_suffix when name_prefix opens the call (no
call_open): the derivation from the template makes the per-call opener the prefix and its closer
call_end, the grammar takes eps() for the suffix, and the streaming parser finds the name's end
byte by byte (name_stop, name_plausible) and reads the closing tag as the first item of the
body. arg_name_suffix and arg_value_prefix may both be set and are read back to back, so
chat_format_markers keeps both tags. value_newlines comes from a probe render of the template
rather than a constant (GLM and MiniCPM false, Qwen true). The ABI struct is unchanged; its
comments say what an empty name_suffix means now.
chatparse_test: GLM's template serves tools; the derived format equals the one a plugin would
declare; every rendered reply in the corpus reads back as the message it rendered, split at
every byte; and replies that stray from the grammar. Each fails without this change. The Gemma
refusal names call_end.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The template as GLM-5.3-Flash ships it, in cases.json beside the other four, with its goldens from
mkchatgolden.py (jinja2 3.1.6); bos is empty, eos <|endoftext|>, and no media, since no
architecture here reads its pictures. It needs the dotted index (vendor/patches/0021).
Two cases leave it out: an assistant turn with tool calls and content null. The template prints
that content bare ({{- content }} in visible_text), so jinja2 writes "None" into the turn, and the
engine, as llama.cpp's runtime does, writes nothing. The golden would hold the engine to a
template bug; the reply-side tests for this format read those turns instead.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kv_store_fp8v4 / k6v4 and the folds now read v_scale as the fp8 store does (attention already
applied v_descale). Scales are clamped to 8188 (V) and 2112 (K) so 7 or 31 times them stays an
f16: a group gone inf or NaN decodes finite, as E4M3's clamp to 448 does. r4d_selftest adds
decode at ctx 1000 (a partial last block) and q_len 7 (three waves) for both layouts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The flag sets the trunk's cache to E4M3 plus a RAD_KVQ_* layout; a plugin offers the layouts it
serves in its probe and the server refuses any other, naming the plugin. qwen35_fp8 offers both
at head_dim 256, gqa 6, and declares the group at head_dim 200 / 176 (the row's bytes / 2), so
the core sizes pages as for fp8; a drafter's cache stays fp8. Qwen3.8-27B on two R9700s, KL
against bf16 on 17 long documents: fp8 0.039963 (518,800 tokens of KV), fp8_v4 0.040076
(664,400), k6_v4 0.039965 (755,184); prefill and decode at fp8's speed. ABI 23: two trailing
fields, the layout table regenerated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two narrower layouts of an attention cache, a head's dims in groups of 32 with an f16 scale:
fp8_v4 (E4M3 K, int4 V; 25 * head_dim / 16 bytes a token and head) and k6_v4 (int6 K, int4 V;
22 / 16). kv_store and qk_norm_rope_gate_kv_store write them (the folds byte-identical to the
pairs); attn_prefill / attn_decode at h256 gqa6 widen the codes to f16 in a tile's staging, V a
key pair's 8 dims a thread fetched a tile ahead and widened with packed f16 (one rounding, a
dword store holding both keys), K6's high bits laid out so one mask and shift join them to the
low nibbles. r4d_selftest: the stores against an exactly representable set, the folds, and the
attention rows against the inline oracle extended to the layouts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jinja2 reads `obj.0` as `obj[0]`; the engine threw "Static member property must be an
identifier". GLM-5's template tests a tool result with `m.content.0.type`, and the capability
probe swallows the throw, so the template came back as tools=0 tool_calls=0 and every request
with `tools` was refused.
The fix is llama.cpp's ae9afff8, which landed after the lifted commit, taken as it is so the next
refresh drops it. vendor/patches/0021, vendor/UPSTREAM; chat_test
(a_dotted_integer_is_an_index_as_in_jinja2) fails without it on both counts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without perf_event_open in the build sandbox, tokenizer_perf_test bounds the encoder's linearity by
CPU time. Its 500 KB single word reads a ratio of 10 to 12 against the threshold of 9 on a Zen 2
VM with 512 KiB of L2, every run, with the tokenizer unchanged. A ctest -E regex lets such a host
build the image without the threshold moving for everyone. Empty by default. docs/DOCKER.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The per-binary CPU budgets are set on a fast machine. A VM on an EPYC 7302 spends 4.6x the quoted
CPU time on tokenizer_test's reference pass, so the image's test stage failed there on a correct
tree, and -j sized for the compile also sized the tests: twelve at once on a 24-thread host put
tests on busy SMT siblings, which costs CPU seconds too.
RAD_TEST_CPU_BUDGET_SCALE multiplies the budget where rad_test.h reads it, at run time, so a
direct ctest takes it as well and the build layer is untouched by it. The stage takes it as
TEST_CPU_BUDGET_SCALE (build.sh -B) and its parallelism as TEST_JOBS (build.sh -J), each empty by
default, which is the stage as before. harness_test checks the factor and keeps it out of its
fixture's environment; docs/DOCKER.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On an MXFP4 container the fused junctions skip the bf16 activations the tap reads, and q/k/v and
gate_up Grams came out zero without a word (down likewise behind gelu_mul_quant_i8). Under
RADIANCE_CALIB_DIR no junction or fused down-quantiser is declared, so any container
calibrates, unfused; checked on the production MXFP4 container. RADIANCE_G3_CALIB_LAYERS
refuses trailing characters. Docs: which trunk fuses what, the four-stream numbers' two
workloads, which sizes are tested. arch_test's world-2 check counts the post-norm op.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gemma3 section of ARCHITECTURES.md (geometry, traps, KV groups, linears, calibration,
measurements, the DFlash2 drafter), the calibration variable and the conversion of record in
GUIDE.md, the README's models table. Recipes: the int8 calibration container (KL 0.003),
MXFP4 + GPTQ (KL 0.042, 56 tok/s a stream on two R9700s), and with a drafter. The compose file
serves a plain Gemma 3 template: TranslateGemma's own refuses the startup render's plain turn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gemma4_bf16's block structure with Gemma 3's differences (modeling_gemma3, transformers 4.57):
GemmaRMSNorm everywhere, one head geometry, scores at query_pre_attn_scalar^-0.5, linear rotary
scaling on the global layers only, the bf16-held embedding scale, no value norm, soft-capping
and YaRN refused. Linears i8a8, mxfp4a8 and w4a8i8_asym over an activation scaled per
(row, 128), beside bf16 and w4a8 / w8a8: one int8 scale a row costs KL 0.097 at w8a8 on
Gemma 3's outlier channels. Fused junctions on a quantised trunk. A calibration tap
(RADIANCE_CALIB_DIR, RADIANCE_G3_CALIB_LAYERS), the column-split linears as rank parts.
A DFlash2 drafter as qwen35_fp8 declares one; rad_block_dflash2.h applies the drafter's
input_embedding_scale through embed_lookup's mult when it is not 1, so other drafters'
graphs are unchanged. Against transformers' float32 forward on a tiny Gemma 3: KL 0.00016 on
the host backend and the cards. arch_test: 7 cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- r4d_attn_paged_h128_gqa2w.hip: decode and query-tiled prefill at head_dim 128, gqa 2,
window >= 1, instantiations of the h256/gqa6 templates with WIN = 1 (as h256_gqa2 for
Gemma 4); the h128/gqa2 rows keep window 0.
- qkv_norm_rope: head_dim 128, and an optional v_norm (0 leaves v alone).
- ar_rmsnorm_post_quant_fp8: ar_rmsnorm_quant_fp8 with a post-norm of the reduced sum against
w_post before the residual add (the sandwich junction), exact wire only. Its own op: an
optional seventh operand on ar_rmsnorm_quant_fp8 broke every plugin issuing its six.
r4d_selftest: the windowed rows against the inline oracle over a history past the window, and
qkv_norm_rope at h128 / v_norm 0 byte-identical to its chain.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the bf16 release: the trunk's linears RTN int8 under fwht128 (weight error 6.3e-3), the
lm_head int8 (6.8e-3), the drafter as q38-27b-fp8-df2.recipe makes it; 29.0 GiB. Against the
bf16 model over 45K mostly-Go positions: mean KL 0.00051 and 99.25% top-1, against 0.00404 and
97.75% for Qwen's FP8 release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A third build of the qwen35 source, as qwen35moe_fp8 is, claiming (qwen35, w8a8_fwht128).
Behind QWEN35_W8A8: check_format's method and fmt, a probe of the first delta-net input
projection that learns the trunk is rotated int8 before the activations are declared (and refuses
one that is not, plain int8 included: the descriptor names the rotation), and the plugin
identity; the four trunk activations then carry int8 code pairs.
It declines imported checkpoints (RAD_ARCH_SERVES_IMPORTS(0)): as the family's second quantised
plugin it would make every imported Qwen3.8 release (Quark, ParoQuant, GPTQ, NVFP4) refuse, so
those stay with qwen35_fp8.
arch_test: every trunk linear an i8a8h GEMM behind its own quantiser at one and two ranks, the
refusals (no int8 trunk, a plain one, another format, no fmt), lint clean with the MTP head and
with DFlash2, and two ArchCases (pinned graphs; libref's vocabulary serves it at one rank).
shipped_plugins_test lists the new key and holds each shipped family to at most one plugin that
takes imports. ARCHITECTURES.md and GUIDE.md list the plugin.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
decl_gated_fold was declared for any gate_up that was not bf16, MXFP4 or rotated 5-bit, so an
int8 one got an fp8a8 fold over int8 codes. Only a host kernel took the op, and placement then
pinned every layer group's weights to the host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
linear_is_w8h recognises i8*bf16[1x128]/fwht128; probe() reports it as int8 so the producer
writes the bf16 plane, and declare() quantises it with had_quant_act_i8g. A rotated weight fed
codes its producer wrote (ActFP8::q8_fed) is refused: those codes are unrotated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An imported quantisation names its tool, which no plugin claims, so the family's one quantised
plugin serves it and two are refused. rad_arch_serves_imports(), optional and absent = yes, lets a
second quantised plugin that reads only its own containers return 0: the import pick then leaves
it out of the family, neither counted nor picked as the only plugin. Its own descriptor still
selects it. Additive export; RAD_ABI_VERSION does not move.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its consumer's scale carries the whole 1/group, as had_quant_act_fp8's does; the per-row had_*
int8 forms fold 1/sqrt(group) and are not interchangeable with it. TOOLS.md: libr4d reads the
int8 block rows rotated too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
had_quant_act_fp8 at int8 codes (top 127), one body shared by both in each library, so a
rotated int8 trunk runs on the host kernels too. gemm_nt_q needs no change: both libraries pick
the int8 product from the operands' dtypes, and i8a8h's rotation is in the values. libref's
operand description takes i8a8h, and rad-avx-check gains cases for the op and the dtype.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libquant's rtn at codes=i8 group=128 scale=bf16 transform=fwht128, decoded through the core:
the weight gemm_nt_q reads at i8a8h comes back as its source, with less error than the plain
grid on a source with outliers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gemm_i8a8_nt_m16 and gemm_i8a8_tiled take dtype i8a8h: the same launch over i8 codes rotated by
the unnormalised 128-wide Hadamard along K, the 1/128 in the bf16 scale (libquant's
transform=fwht128). The layout hook accepts only the transform its dtype names and tags the
rotated codes r4d.i8h.w.frag64, since the bytes cannot tell the two forms apart.
r4d_selftest's i8a8h_rot measures the pair against the exact f32 product: rel_l2 0.009-0.012
rotated, 0.012-0.014 plain, ~1.0 for the rotated weight against the plain quantiser. The
had_quant_act_i8g row now says the factor of 128 is the weight's, not sqrt(128).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The single-threaded loops stay beside LAPACK; RAD_LQ_LAPACK=0 takes them and
gptq_through_lapack_matches_the_loops compares the two (output error equal to rounding). A
factor whose diagonal is not finite and positive is refused, as the loops refused a NaN pivot
that dpotrf lets through. The cache keeps the 4 most recent layer factors: a MoE layer's
experts alternate between two stems. The size in the comment is the f32 factor's, 1.85 GB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under tensor parallelism an attention output or down projection sees only its rank's K / world
columns, so no rank can write the K x K Gram. A tap may write each rank's block as
<stem>.part; with no whole file calib_sum places the parts on the diagonal in rank order (the
cross-rank products, never formed, zero) and converts the result like a whole file. Parts that
do not cover K, or not in domain 0, are reported and the weight rounds to nearest. Tested
byte for byte against the whole block-diagonal file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At K = 21504 (a dense 27B's down projection) the single-threaded Cholesky and inverse took hours
a layer; dpotrf / dpotri take 13.5 s for all three on 24 cores, identical to 1e-14. Without
OpenBLAS nothing changes. The factor cache kept every layer's factor, 3.7 GB each at that
width, which OOM-killed a 62-layer conversion at layer 25; it now keeps one at a time (a layer's
experts arrive together and still share it). RAD_LQ_FACTOR_CACHE_ALL keeps the old behaviour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ar_ln_had_quant_i8 clamped a tuned block count to M only; it stays under R4D_AR_MAX_BLOCKS
now, as every other entry's. The MoE hyper-connection gathers keep the minimum their LDS table
needs, which may exceed the ceiling: the comment and GUIDE say so instead of "every
collective". r4d.h states that a refused IPC export leaves the handle zeroed, out_len 0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every block of a collective spins until its twin on the peer card has pushed. One engine is safe
(both cards dispatch its blocks in the same order); two tensor-parallel engines on the same
cards can deadlock, one engine's spinners filling a card while their twins wait behind the
other engine's kernel. Two TP2 engines on two R9700s hung within a minute of concurrent
prefill and the failed queue eviction froze the host. Capped in both engines so their spinners
together leave part of a card free, the cycle cannot close: 15 minutes of concurrent load
clean at 64 / 16. Only launch counts shrink; each element's sum is the same. Unset, nothing
changes. GUIDE section 8 documents it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
r4d_ar_ipc_alloc exports every collective buffer with hipIpcGetMemHandle. Beside another
process holding the same cards it answers invalid argument while the allocation is fine, and
HIPOK stopped the engine. libr4d's ranks are threads of one process and share the pointer
itself, so the handle is never read: a refused export leaves it empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Over a split vocabulary every rank's candidates are gathered and merged in one workgroup
(sample_merge_topk), and libr4d's row holds world_size * n_cand <= 4096 pairs in LDS. The engine
declared the default 1024 a rank, 8192 pairs at eight ranks, and the first step stopped on a shape
the merge does not serve. Declare now narrows the width to 4096 / world_size, 512 at eight ranks,
and says so in one line; a request whose top_k is wider is refused at admission, as a top_k over
the width already was. Two and four ranks keep 1024.
sample_test: at two, four and eight ranks declare succeeds, top_k at the width is admitted and one
more is refused, naming the width.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Weights from a variable describe one board on one day. Unset or "auto", RADIANCE_AR8_SHARD_WEIGHTS
now reads them from the links: each rank takes its card's bus id from the runtime
(hipDeviceGetPCIBusId), walks /sys/bus/pci/devices from the root port down to the card as
core/diag/sysinfo.cpp's read_card does, and keeps the slowest hop's current speed x width x line
code (8b/10b under 8 GT/s, 128b/130b from there) / 8. The R9700 sits behind an on-card switch
whose endpoint reports Gen5 x16 in any slot, so a degraded slot shows only at the root port. The
weight is round(4 x (rate / fastest)^2): x16 4, half the rate 1, a quarter 0. On the board of the
previous commits that is the measured best, 4,1,0,4,0,1,4,4, and after both Gen4 links retrained
at Gen5 x8 it is 4,1,1,4,1,1,4,4, where the 16 MiB two-shot takes 1360 us. "off" keeps the shards
even and eight integers set them, as before.
The ranks publish their links in the rendezvous (ar8_settle) and, after one barrier, derive the
same table from the same eight entries before anything is sized; settings that differ between
ranks fail init on every rank. Equal weights run the unweighted kernel, and a rank whose path says
nothing (no /sys/bus/pci in a container) leaves the shards even, with a warning naming it. Startup
logs one line, "[r4d] eight-rank two-shot shard weights from the slowest PCIe hop of each card: r0
32.0 GT/s x16 63.0 GB/s w4, r1 32.0 GT/s x8 31.5 GB/s w1, ...". The links are read once, at init:
a link that falls back while the server runs changes the weights at the next start.
r4d_ar_links_test builds that board's sysfs under a temporary root (root port, on-card switch,
endpoint) and checks the bottleneck hop, the weights before and after the repair, equal links, the
line code and a path that says nothing; it needs only libr4d's include path. r4d_selftest runs
auto and off at the default floors, for bits only since what auto derives depends on the box, and
--perfar8 derives the weights the same way and names each rank's link. 206 of 206 on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each block splits its words (in shard space) into K runs. Step j pushes run j+1's first hop and
reduces and pushes run j's second, then handshakes, so a rank with a short shard sends and
receives at once instead of one direction a hop. A launch takes K+1 handshakes instead of two.
The flag a (block, source) publishes is a monotone counter, so one handshake vouches for every
earlier one, and r4d_ar_seq_take reserves the K steps at once (`steps`, 1 for every other kernel):
one-shots and gathers on the same instance stay in the family's flag space. The regions stay at 0
and the longest shard, so the scratch is as before; every word is touched by the same thread in
the same three steps, so the fold, the bits and the in-place form are unchanged. The launcher
clamps K to the words a block holds, and K 1 is its own instantiation without the loop.
16 MiB, bf16, warm K 1 K 2 K 4 K 8
even 2841 us 2806 2667 2470
4,1,0,4,0,1,4,4 2730 2126 1798 1636
4,2,1,4,1,2,4,4 2495 2121 1940 1922
4,1,0,4,0,1,4,4 in 8 pieces is 42% under the even split. Fitting measured = f x computed + h x
(K+1) at K 4 and 8 gives f = 1.21 and h about 5 us a handshake: what separates 1636 us from the
1.17 ms the Gen4 links need is their efficiency, not the handshakes.
A decode-sized message loses with either:
numel even K 1 4,1,0,4,0,1,4,4: K 1 / K 2 / K 4 / K 8
196608 73 us 85 / 76 / 81 / 113
524288 214 207 / 166 / 169 / 198
2097152 699 711 / 581 / 531 / 527
8388608 2841 2730 / 2126 / 1798 / 1636
so below RADIANCE_AR8_SHARD_WEIGHTS_MIN_ELEMS and RADIANCE_AR8_PIECES_MIN_ELEMS (262144 elements
each) the message runs even and in one piece, on the kernel as it was. Above them, without
RADIANCE_AR8_PIECES, K follows the size (r4d_ar8_auto_pieces): 2 under 1048576 elements, 4 under
4194304, 8 above, where the crossings above lie. RADIANCE_AR8_PIECES (1 to 16) fixes K over the
floor, and a launch's `pieces` parameter (the selftest's) overrides that. Weights and K are a
function of the message size and the instance (ar8_weights_for, ar8_pieces_for), so a replay of
the same size decides the same; the slot is sized for weights only when the largest message is
over the weight floor. Every rank compares both variables and both floors at init.
r4d_selftest, with both floors at 0: the weighted and even sets at K 1, 2 and 4 (1- and 9-word
messages cross the launcher's clamp), and one instance whose K changes from launch to launch (1,
4, 2, 8, 16, 3, 1), which a wrong flag reservation hangs or races. At the default floors: the size
rule over 131072 to 4194304 elements, K 4 on both sides of the piece floor, a 131073-word message
over the weight floor (served only weighted) and a 9-word one under it (refused, and served at a
floor of 64). 192 of 192 on the cards. --perfar8 names the floors and times the two-shot as the
server runs it and at K 1, 2, 4 and 8.
GLM-5.3-Flash at TP8 (an out-of-tree plugin) on these eight cards with 4,1,0,4,0,1,4,4, against
the same build without in the same hour: a 20K-token prefill 3450 tok/s against 2945, 8K 3372
against 2920; eight agent streams 457 tok/s against 458, one 141 against 139. K 8 at every size
instead gave the same prefill (3461) and 436 at eight streams, 113 at one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In the two-shot rank r reduces shard r: in the first hop it sends N - len_r and receives
(ws-1)*len_r, in the second the reverse. With even shards every rank moves 1.75 N each way at
eight ranks, so on a board whose links differ the slowest link sets the time. On eight R9700 (four
links at Gen5 x16, two at Gen5 x8 and two that trained at Gen4 x8, 14.3 GB/s one way by
TransferBench) the 16 MiB two-shot, a 2048-token chunk at 4096 wide, takes 2.45 to 3.05 ms over a
day, where the Gen4 links alone need 2.05 ms for their 28 MiB.
RADIANCE_AR8_SHARD_WEIGHTS=w0,...,w7 sizes rank r's shard in proportion to w_r (the floor, then
the few remaining words one each to the weighted ranks in ascending order); a rank of weight 0
owns no shard and only pushes, gathers and handshakes. The shard bounds become a table the kernel
takes by value (r4d_ar_shards.h, host-only, shared by the launcher, the shim and the selftest), so
a recorded launch keeps its table. Equal weights give the even split word for word, and unset the
split is the even one as before; three and four ranks stay unweighted. Which rank reduces a word
changes the link it crosses, not its fold, so every table gives the same bits.
Every rank must cut the message at the same words: init reads the variable on each rank and fails
on all of them if the ranks disagree. A weight over half the sum makes the longest shard's two
regions outgrow a message, and only then does init grow the slot. Weighted shards need not divide
the words evenly, so the even rule (words % 8, else RAD_E_SHAPE) applies without weights only.
Measured with --perfar8 (16 MiB, bf16, warm): even 2.78 to 3.05 ms that day, 4,1,0,4,0,1,4,4 (no
shard on the Gen4 ranks) 2.71, 4,2,1,4,1,2,4,4 2.50, 2,1,1,2,1,1,2,2 2.58. Only 10 to 17%: with
the hops separated by a handshake a rank sends in one and receives in the other, and the larger of
N - len and 7 len a hop is least at len = N/8. The weights pay once the hops overlap.
r4d_selftest: ar_wide_weighted runs 0,3,1,0,5,1,2,4, 1,0,0,0,0,0,0,0 and 4,1,0,4,0,1,4,4 over
uneven and empty shards, a single owner (the slot grows) and messages of 1 and 9 words, which the
even split refuses; the refusal check runs without weights whatever the environment. 55 of 55 on
the cards, every one bit for bit with the fold. --perfar8 prints the weights, every size's shard
lengths and each rank's time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The exact all-reduce at eight ranks shared the three- and four-rank band: one-shot up to 524288
elements. The one-shot sends (ws-1)*N bytes a rank, seven times the message at eight ranks, where
the two-shot sends 2*(ws-1)/ws*N, and on eight R9700 (PCIe P2P, bf16, warm) the two-shot is the
faster from 16384 elements on. A decode step of eight streams with a draft window of six on
GLM-5.3-Flash (4096 wide, an out-of-tree plugin) reduces 48 x 4096 = 196608 elements: 232 us
one-shot, 68 us two-shot, where all_reduce was 20.7% of the step's device time.
R4D_AR_8RANK_ONESHOT_MAX_ELEMS is 8192, a multiple of 64, the eight-rank two-shot's DIV;
cArTsExact8 starts one element above it. The two-shot's block rule stops at 8 blocks at eight
ranks: every block handshakes with seven peers, and past eight blocks the extra flag rounds cost
more than the reduce bandwidth they add (4 blocks up to 393216 elements, 5 at 524288, 8 instead of
16 from 2097152). Both rows fold in fp32 in ascending rank order, so neither change moves a bit.
numel before after
4096 one-shot 22.5 us one-shot nb 4 12.8 us
16384 one-shot 39.7 two-shot nb 4 21.5
131072 one-shot 176.3 two-shot nb 4 52.3
196608 one-shot nb 16 233.2 two-shot nb 4 68.7
524288 one-shot 573.7 two-shot nb 5 177.4
2097152 two-shot nb 16 615.8 two-shot nb 8 610.5
8388608 two-shot nb 16 2460 two-shot nb 8 2489
16777216 two-shot nb 16 4999 two-shot nb 8 4824
At 4096 the rule already chose 4 blocks; the 22.5 us was the microbenchmark's, ten launches after
the host-side check, which now warms up with as many launches as it times.
Band edges are the union over every candidate row (core/plugin/bands.cpp), so the edge at 8192
splits the two-, three- and four-rank bands too. Both halves resolve the same row, kernel and
bits, at the cost of one more instance per (width, dtype) whose slot holds 8192 elements. Keeping
the edge to eight ranks would need the band builder to skip rows whose fixed constraints the
geometry rules out (world_size 8 here), a change to every op's bands for one row; plugin_test
states the new edges instead.
r4d_selftest runs the eight-rank rows (ar_oneshot_8rank_exact, ar_twoshot_8rank_exact,
ar_gather_8rank) through the width-parametrised cases of the three- and four-rank ones instead of
skipping them: the pattern's band edge is at 8192 and 8256 there, and a 9-word message must be
refused. --perfar8 numel [iters] [dtype] times both rows, one thread a card, at the block rule
and at 4 to 64 blocks, each checked bit for bit against the fold on every rank. On the cards:
ar_oneshot_8rank_exact 20 ok, ar_twoshot_8rank_exact 16 ok, ar_gather_8rank 5 ok.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Inside a class, escapes GBNF does not know ([\b], [\f], [\v], [\0], an escaped space, \p{..}, \c,
a backreference) were copied raw and the grammar then failed to load, an internal error on a
schema the converter had accepted.
A JSON string holds a control character only as an escape, so \t \n \r \f \v \0 (and \b in a
class) now match that escape, in a positive class as alternatives beside it and in a negated
class by leaving the escape out. Outside a class the escape is a group, so a quantifier takes all
of it. An escaped space or non-ASCII character is itself; \x and \u in a class need their hex
digits. Any other class escape is refused at conversion with a message naming it.
vendor/patches/0020, vendor/UPSTREAM; gbnf_test cases.
Patterns written in JavaScript escape punctuation that needs no escape: "\/" in a path, "\-" in
a class. zod's email pattern carries "[A-Za-z0-9_'+\-]", so any tool validating an email with zod
sent a schema that was refused outside a class ("Unsupported regex escape") or, inside one,
produced a grammar that failed to load.
Outside a class such an escape is now the bare character; regex syntax characters and '"' keep
their backslash. Inside a class it is written \xHH, so an escaped '-' or '^' cannot read as a
range or a negation. Found by running 203 patterns harvested from installed agent packages
through rad-gbnf-check. vendor/patches/0019, vendor/UPSTREAM; gbnf_test cases.
\d \w \s \D \W \S were refused in a literal ("Unsupported regex escape") and copied raw into a
class, where GBNF cannot load them. Tool schemas use them freely: oh-my-pi's workpool tool sends
"\S" thirteen times, so with 0017 its requests got past the anchors and were refused here.
Each shorthand is written out as its ECMA-262 class before the scanner reads the pattern. The
negated forms leave out '"', '\' and the control characters and admit any JSON escape instead, so
a match cannot run past the closing quote; \s also admits \t \n \f \r. In a class a positive
shorthand becomes its ranges and [\s\S] and its kin become any text; a negated shorthand mixed into
a class is refused. vendor/patches/0018, vendor/UPSTREAM; gbnf_test cases, and sample_test's
"cannot spell" case moves from \d to \b.
_visit_pattern() read only ^...$ and refused every other `pattern` with "Pattern must start
with '^' and end with '$'". JSON Schema patterns are unanchored (ECMA-262 search, validation
6.3.3). Since 1.8 constrains tool-call arguments with a grammar, a bare pattern on array items
failed the whole request: an opencode agent's tool list did, on every request.
A missing anchor is now written out as any string text on that side, (?:[^"\\]|\\.)*, not ".*"
('.' matches '"' here, so on array items ["1","x"] read as one string holding a digit). A
one-sided anchor beside a top-level '|' is still refused. vendor/patches/0017, vendor/UPSTREAM;
tests in gbnf_test (json_schema_grammars_admit_exactly_their_instances) and sample_test (an
empty pattern now matches every string).
oot_plugins.sh gave libr4d's out-of-tree configure the tree's HIP compiler and targets but not
RAD_HIP_VOPD_REPEATABLE. In a tree configured as the build image configures it (ON, for the
patched LLVM 24), the out-of-tree libr4d was compiled with VOPD pairing off and step 5 found
different device code. The option is now the script's sixth argument (default OFF), forwarded to
the device libraries' configure. In radiance-build, ctest -L oot failed at step 5 and now passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gemma's tokenizer.json spells runs of 2-31 spaces as added, non-special tokens in U+2581
(ids 138-167). piece_at returned every user-defined token literally, so indentation and
double spaces in a Gemma reply came out as U+2581. HuggingFace runs every token it keeps
through the decoder; now a user-defined token does too, and only control and unknown
tokens stay literal. decode, the Detokenizer and TokenView change together. tokenizer_test
covers it with a Gemma-shaped tokenizer.json.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A checkpoint reservation (Scheduler::reserve_ckpt, at planning) is written only after the
step (Engine::checkpoint_save), and nothing between the two checked that the slot was still
the reservation's. A later reservation in the same step that found the store full ran
retention over every session, and the policy, placing its ladder from each session's tip,
could release the very slot just handed out: a second request's reservation lands on a
snapshot a first session already holds (the same prefix, so the same key) below that
session's tip, or a lookup's take_over indexes a fresh reservation under a session whose
ladder does not keep it. The save then faulted in checkpoint_copy ("the store does not hold
that slot ... given back after its id was handed out"), the step loop read the negative as a
device fault, and the engine exited with every in-flight request (#129: every 25-50 min
under multi-session agentic load, the store not full at the fault, 12-15 of 16 in use --
the eviction itself had freed the rest).
A reservation now keeps its slot the way a handed-out snapshot does: retention, the LRU
eviction and expiry skip it from reserve_checkpoint until commit_checkpoint, or until the
next step begins when the save was skipped (its request gone), so a skipped save cannot hold
a slot for good. The engine issues every save before it plans the next step, so the window
covers the copy. A reservation that finds every slot handed out or awaiting a save is
refused as before (ckpt_refused) and the chunk goes without a snapshot.
mem_test: the two cases, the shared-prefix one at the position geometric backoff releases,
and a step boundary (begin_step) in the three cases that reserve several snapshots in a
row without committing, as the engine does one per step.
2026-10-18 22:53:56 -05:00
1927 changed files with 730275 additions and 63209 deletions
| Qwen-Image 2.1 FP8: text to image and image edits | `qwen-image-2.1-fp8.rad` (16 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-qwen-image-2.1-fp8) | `qwen-image-2.1.yaml` |
| Qwen-Image 2.1 Turbo FP8: the same in 8 steps | `qwen-image-2.1-turbo-fp8.rad` (16 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-qwen-image-2.1-turbo-fp8) | `qwen-image-2.1-turbo.yaml` |
| MiniMax-H3 FP8: video with its stereo soundtrack from text | `minimax-h3-fp8.rad` (60 GiB) | [download](https://huggingface.co/StillDeadcode/minimax-h3-fp8) | `minimax-h3.yaml` |
| FastH3 8-Step V2 FP8: the same in eight steps | `fasth3-8-step-v2-fp8.rad` (62 GiB) | [download](https://huggingface.co/StillDeadcode/fasth3-8-step-v2-fp8) | `fasth3.yaml` |
| MiniMax-Music3 bf16: songs from lyrics and a description | `minimax-music3-bf16.rad` (20 GiB) | [download](https://huggingface.co/StillDeadcode/minimax-music3-bf16) | `minimax-music3.yaml` |
| Breeze-TTS-2 bf16: speech, whole, streamed or live, one card | `breeze-tts2-bf16.rad` (5.5 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-breeze-tts2-bf16) | `breeze-tts2.yaml` |
| EmbeddingGemma 2 bf16: text, image, video and audio embeddings, one card | `embeddinggemma2-bf16.rad` (1.4 GiB) | [convert](#convert-a-checkpoint) | `embeddinggemma2.yaml` |
| Qwen3-ASR 1.7B bf16: speech to text, `/v1/audio/transcriptions` and live over `/v1/realtime`, 30 languages, one card | the checkpoint as it ships (4.1 GiB) | [Qwen/Qwen3-ASR-1.7B-hf](https://huggingface.co/Qwen/Qwen3-ASR-1.7B-hf) | — |
| GLM-5.3-Flash: IQR-V4 experts, IQ8R trunk, int8 latent cache, four cards with the experts tiered to host memory | `glm53-flash-iqr-v4.rad` (159 GiB) | [download](https://huggingface.co/animusnull/glm-5.3-flash-iqr-v4) | `tp4.yaml` |
| DeepSeek-V4.1-Flash 1017 uncensored (refusals removed): llama.cpp's blocks at 2.83 bits a weight (its DSpark drafter's MXFP4 experts are not served), exact fp8 cache, two or four cards with the experts tiered to host memory ([docs/ARCHITECTURES.md](docs/ARCHITECTURES.md#deepseek41-deepseek-v41-flash)) | `deepseek-v4.1-flash-1017-uncensored.rad` (134 GiB of experts) | [download](https://huggingface.co/bakon3/DeepSeek-V4.1-Flash-1017-uncensored-rad) | — |
| Qwen3.8-27B IQR-V4, 2.5 to 8 bits a weight ([docs/IQR.md](docs/IQR.md)), DFlash2 drafter, vision | `qwen3.8-27b-iq2r-v4.rad` .. `qwen3.8-27b-iq8r-v4.rad` (10 to 28 GiB) | [download](https://huggingface.co/StillDeadcode/qwen3.8-27b-iqr-v4) | `tp1.yaml` (IQ4R-L) |
| Hemmingway-1.5 (Qwen3.8-27B fine-tune) IQ4R-S, tool-tail GPTQ; this version serves the trunk, not the MTP block | `hemmingway-1.5-iq4r-s-tool-tail-mtp-gptq.rad` (14 GiB) | [download](https://huggingface.co/gostar77/hemmingway-1.5-iq4r-s-tool-tail-mtp-gptq) | — |
| Gemma 4 31B w5: GPTQ int5 trunk (a scale and a zero point per 128 weights), MTP, vision | `gemma4-31b-w5.rad` (23 GiB) | [download](https://huggingface.co/keptn/gemma4-31b-w5) | — |
| Qwen-Image 2.1 IQ8R: text to image and image edits | `qwen-image-2.1-iq8r.rad` (16 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-qwen-image-2.1-iq8r) | `tp1.yaml`, `tp2.yaml` |
| Qwen-Image 2.1 Turbo IQ8R: the same in 8 steps | `qwen-image-2.1-turbo-iq8r.rad` (16 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-qwen-image-2.1-turbo-iq8r) | — |
| Krea 2 Turbo IQ8R: text to image, one card | `krea-2-turbo-iq8r.rad` (16 GiB) | [download](https://huggingface.co/StillDeadcode/krea-2-turbo-radiance-iq8r) | — |
| Krea 2 Raw IQ8R: the same, undistilled | `krea-2-raw-iq8r.rad` (16 GiB) | [download](https://huggingface.co/StillDeadcode/krea-2-raw-radiance-iq8r) | — |
| FLUX.3 [klein] IQ8R: text to image and edits from up to ten pictures, one card | `flux-3-klein-iq8r.rad` (9.4 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-flux-3-klein-iq8r) | — |
| LTX-2.5 distilled IQ8R: video with its stereo soundtrack from text or a first frame, one card | `ltx-2.5-distilled-iq8r.rad` (37 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-ltx-2.5-distilled-iq8r) | — |
| MiniMax-H3, int8 DiT: video with its stereo soundtrack from text | `minimax-h3-i8.rad` (63 GiB) | [download](https://huggingface.co/StillDeadcode/minimax-h3-i8) | `tp2.yaml` |
| FastH3 8-Step V2, int8 DiT: the same in eight steps | `fasth3-8-step-v2-i8.rad` (65 GiB) | [download](https://huggingface.co/StillDeadcode/fasth3-8-step-v2-i8) | — |
| MiniMax-Music3 bf16: songs from lyrics and a description | `minimax-music3-bf16.rad` (20 GiB) | [download](https://huggingface.co/StillDeadcode/minimax-music3-bf16) | `tp1.yaml`, `tp2.yaml` |
| Unlimited-OCR bf16: document parsing with the DeepEncoder tower | `unlimited-ocr-bf16.rad` (6.2 GiB) | [download](https://huggingface.co/Aijuus/unlimited-ocr-bf16) | — |
| Breeze-TTS-2 bf16: speech, whole, streamed or live, one card | `breeze-tts2-bf16.rad` (5.5 GiB) | [download](https://huggingface.co/StillDeadcode/radiance-breeze-tts2-bf16) | `tp1.yaml`, `tp2.yaml` |
| Fish Audio drama-3: speech with speaker tags and directions, two cards | `drama3-i8.rad` (37 GiB) | [convert](data/recipes/drama3-i8.recipe) | — |
| Stable Diffusion XL bf16 and its finetunes (Illustrious, NoobAI, Pony): text to image, one card | `illustrious-xl-v2.0-bf16.rad` (6.4 GiB), from any single-file SDXL checkpoint | [convert](#convert-a-checkpoint) | — |
| EmbeddingGemma 2 bf16: text, image, video and audio embeddings, one card | `embeddinggemma2-bf16.rad` (1.4 GiB) | [convert](#convert-a-checkpoint) | `tp1.yaml`, `tp2.yaml` |
| nomic-embed-text-v2-moe bf16: text embeddings, one card | `nomic-embed-v2-moe-bf16.rad` (959 MB) | [convert](#convert-a-checkpoint) | — |
| LiquidAI LFM3-1.7B IQ8R: rotated int8 trunk, bf16 head; text, tool calls and reasoning, one card | `lfm3-1.7b-iq8r.rad` (2.5 GiB) | [convert](#convert-a-checkpoint) with `data/recipes/lfm3-1.7b-iq8r.recipe` | — |
| LiquidAI LFM3-1.7B bf16: text, tool calls and reasoning, one card | `lfm3-1.7b-bf16.rad` (3.8 GiB) | [convert](#convert-a-checkpoint) | — |
| Meta Muse Glimmer 30B bf16: text, images and video; sliding-window rotary layers between NoPE full ones, a windowed ViT | `muse-glimmer-30b-bf16.rad` (56 GiB) | [convert](#convert-a-checkpoint) | — |
| Meta Muse Glimmer 30B w4a8: int4 trunk, images and video, one card | `muse-glimmer-30b-w4a8.rad` (16 GiB) | [convert](#convert-a-checkpoint) | — |
| Meta Muse Glimmer 30B IQ8R: rotated int8 trunk, int8 head, DFlash drafter, images and video | `muse-glimmer-30b-iq8r-dflash.rad` (36 GiB) | [download](https://huggingface.co/StillDeadcode/muse-glimmer-30b-iq8r-dflash) | — |
| Recursive Flint (39.8B, about 2.5B active) IQ8R: rotated int8 trunk and experts, two cards | `flint-iq8r.rad` (38 GiB) | [download](https://huggingface.co/StillDeadcode/flint-iq8r) | — |
| Ling-3.0-tiny IQ8R: rotated int8 trunk and experts, one card | `ling-3.0-tiny-iq8r.rad` (7.9 GiB) | [download](https://huggingface.co/StillDeadcode/ling-3.0-tiny-iq8r) | — |
| NVIDIA Nemotron-3.5-Bolt-74B-A9B 2-bit: NVIDIA's IQ2_XXS experts and Q8_0 linears as stored, IQ8R Mamba projections, LiLiCorr drafter, one card | `nemotron74-2bit.rad` (26.66 GiB of weights) | [convert](data/recipes/nemotron74-nvidia-24gb-iq8r.recipe) | — |
| Nemotron 3.5 Embed 1B BF16: text and image embeddings, one card | the checkpoint as it ships | [NVIDIA checkpoint](https://huggingface.co/nvidia/Nemotron-3.5-Embed-1B-BF16) | — |
| Nemotron 3.5 Embed 8B BF16: text and image embeddings, one card | the checkpoint as it ships | [NVIDIA checkpoint](https://huggingface.co/nvidia/Nemotron-3.5-Embed-8B-BF16) | — |
| Nemotron 3.5 Rerank 8B BF16: text/image document relevance, one card | the checkpoint as it ships | [NVIDIA checkpoint](https://huggingface.co/nvidia/Nemotron-3.5-Rerank-8B-BF16) | `tp1.yaml`, `tp2.yaml` |
| Qwen3-ASR 1.7B bf16: speech to text, `/v1/audio/transcriptions` and live over `/v1/realtime`, 30 languages, one card | the checkpoint as it ships (4.1 GiB) | [Qwen/Qwen3-ASR-1.7B-hf](https://huggingface.co/Qwen/Qwen3-ASR-1.7B-hf) | `tp1.yaml`, `tp2.yaml` |
| Inkling 2 Mini IQ4R-V4 + DFlash2: the experts IQR-V4's four-bit computed trellis (GPTQ against recorded Hessians), the attention and the head rotated int8, the embedding int8, incoai's DFlash2 drafter (four-bit computed trellis, down int8), the vision tower bf16; text and images, one or two cards (`draft-window: adaptive`) ([geometry](docs/ARCHITECTURES.md#inkling2-inkling-2-mini)) | `inkling-2-mini-iq4r-v4.rad` (14.43 GiB) | [download](https://huggingface.co/StillDeadcode/inkling-2-mini-iq4r-v4) · [convert](data/recipes/inkling2-mini-iq4r-v4.recipe) | — |
**Not served by this version.** A container whose weights are block FP8, MXFP4, M2XFP4 or
ParoQuant, or whose experts read E4M3 activations, is refused at startup by the name of the first
such weight. That is every FP8 and MXFP4 container of the models above, and the models that have
no int8 container yet: Ornith-1.5 (35B-A3B and 122B), Sage-A1.5, Ling-3.0-flash-Sante and
Anima's FP8 container (Anima converted to bf16 is served). Each returns with an int8 container.
A container with an int8 or bf16 trunk and a block-FP8 drafter (NVIDIA-Nemotron-3.5-Bolt-E4B,
the Gemma 4 31B DFlash and DFlash2 containers, MiniCPM5-2B bf16), or with GGUF blocks and an
MXFP4 drafter (the DeepSeek-V4.1-Flash container's DSpark), serves without the drafter under
`num-speculative-tokens: 0`.
A container holds everything the server needs: the weights, the tokeniser, the chat template and
any drafter. Each download link's repository has the recipe and the exact command that made the
@@ -44,7 +100,7 @@ file. Download one into your models directory (the transfer resumes if interrupt
Loaded 100 of 1927 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.