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>
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 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>
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>
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.
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>
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>
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>
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>
- MiniMax-H3 and FastH3 no longer stop the server on a prompt longer than 16 tokens (FastH3) or
128 tokens (MiniMax-H3)
- latent upscaling for the MiniMax-H3 containers: with LBH-123-AI's latent upscaler in the
container, `latent_upscale` runs the first steps at a smaller size and refines the latent at the
full size; `upscale_refine_steps` sets how many steps refine, and the video object reports both
- rad-convert --in-place extends a container whose weights the plugin has regrouped since
- plugin ABI 22: out-of-tree plugins must be rebuilt
- video: MiniMax-H3 and FastVideo's FastH3 8-Step V2, a video with its stereo soundtrack from text
on OpenAI's /v1/videos, block fp8 on two cards
- music: MiniMax-Music3, songs from lyrics and a description on /v1/audio/speech
- speech: Breeze-TTS-2 on /v1/audio/speech and vLLM-Omni's realtime WebSocket
- runtime LoRA adapters beside the base model, picked per request by `model` (baKon, #105)
- several agent streams keep their cached history: --checkpoint-slots auto, the new default, sizes
the snapshot store by --max-num-seqs (#108)
- the Swift 1.5 27B W4 releases convert and serve: compressed-tensors AWQ and GPTQ int4, AutoRound,
ModelOpt NVFP4 (#110)
- the image's host tests pass where perf_event_open is refused, as in BuildKit's sandbox (#106)
- plugin ABI 21: out-of-tree plugins must be rebuilt
- every model serves without a GPU: libavx covers every op, so `--kernels libavx` alone serves
every shipped container
- Qwen3-ASR (zivius): speech to text on /v1/audio/transcriptions and live over /v1/realtime
- /v1/messages works with Claude Code as it ships (gearwave00001)
- a long agent conversation keeps its cached history when the client rewrites its last turn
(manueloverride)
- a stream's first event goes out with the first token, so llama-benchy measures prefill right
- opt-in --prefill-interleave (Smellyyyy, baKon) and --prefill-span (keptn42)
- four-rank TP releases the link early; four-rank selftests and docs/TP4.md (goodman-b)
- NVFP4 and FP8 compressed-tensors imports (devmilan); tools/rad-export for finetunes and LoRA
adapters (baKon)
- many fixes, among them lost tokens on stop strings under concurrency, keep-alive, MiniCPM5 tool
arguments and the CPU's vision and audio encoders
- plugin ABI 17 and changed op schemas: out-of-tree plugins must be rebuilt
- Qwen-Image 2.1 and 2.1 Turbo: text to image and image edits over OpenAI's images API,
/v1/images/generations and /v1/images/edits. An edit takes up to ten pictures and an optional
mask, outside which the picture comes back exactly as it was; `background: transparent`, png,
jpeg and webp output, `n` pictures from one prompt, streamed previews (`partial_images`), and
vLLM-Omni's seed, negative_prompt with true_cfg_scale, num_inference_steps, width and height.
arch/qwenimage21 serves the diffusers pipeline directory, converted with
data/recipes/qwen-image-2.1-fp8.recipe (block fp8) or qwen-image-2.1-bf16.recipe.
deploy/compose/qwen-image-2.1.yaml and qwen-image-2.1-turbo.yaml serve the fp8 containers on
two cards. Two R9700s make a 2048x2048 picture in 61 s at the base model's 40 steps and in
13 s with Turbo (56 and 12 s with --tp-wire wht6), a 1024x1024 one in 6.0 and 2.6 s. The
models are under Qwen's research license, which is non-commercial
- an image generator is a program kind of its own (core/gen): an architecture declares its
conditioning, denoising and decoding passes, and the driver runs the schedule, the pictures of
a batch and the conditioning cache. An image model's /v1/models entry is its generator's name
(qwen-image-2.1, qwen-image-2.1-turbo), and its capabilities and startup banner list only the
images endpoints
- the tiled prefill GEMMs run their tiles in groups of activation bands, 16 for fp8 and 8 for
bf16, so an operand larger than the 64 MB cache is read once a group instead of once a band. A
bf16 GEMM with more than 64 MB of weight runs up to twice as fast
- fixed: a second lane opened in the middle of a step started beside work lane 0 had not
finished. Gemma 4 26B-A4B opens its lane that way, so its first step after startup could read
rows not yet written
- startup no longer warns about --checkpoint-slots when it was not passed, nor about an expert
floor on a model with no experts
- the image's FFmpeg writes png, jpeg and webp (libwebp)
- for out-of-tree plugins: RAD_ABI_VERSION is 16. The op vocabulary gains the image generator's
ops (conv2d_nhwc, ln_mod, ln_mod_quant_fp8, flow_euler, attn_prefix_self and others; docs/OPS.md,
"Image generation"), and all_reduce takes an optional `overlap`. Plugins built against 1.5.0
must be rebuilt
- Gemma 4 31B (PRs #74, #75, #81, #86; sfjes, keptn42): sliding and global attention with their
own kernels, the assistant head as a drafter that reads the trunk's cache, the vision tower, a
fused w4a8 decode step, bf16 and compressed-tensors int4 checkpoints, and window snapshots so a
prefix hit on a sliding-window model resumes instead of prefilling again.
deploy/compose/gemma4-31b-w4a8.yaml serves keptn42's container on two cards
- ParoQuant (PRs #65, #66, #67; malic): Qwen3.8-27B checkpoints with learned Givens rotations,
as int4, int5 and MXFP4, imported without re-quantising, the prefill's rotations on the matrix
cores. deploy/compose/qwen3.8-27b-paro.yaml serves them on one card. A ParoQuant container made
with the PR builds is refused: convert it again with --reuse <old container>
- Gemma 4 26B-A4B with z-lab's DFlash drafter (PR #88; Perire): arch/gemma4 serves Google's bf16
checkpoint with the routed experts in block fp8 or bf16 (data/recipes/gemma4-26b-a4b-df*.recipe),
and libr4d gains its windowed paged attention, the fused sandwich-norm joins, expert_scale and
the sharded draft head's pair_argmax. A prefill chunk runs as two slices with its all-reduces
beside the compute, bit-exact with the whole step. The 31B's global layers take the windowed
attention too: an 11.5K-token prefill on two R9700s in 3.1 s instead of 4.9
- a startup that logs nothing for two minutes says where it waits (#89): the system call (a KFD
request by name), the library that made it, and its stack, which addr2line resolves against the
binary
- the prefix cache is kept in VRAM and host memory only (#70): the disk tier wrote every block and
snapshot a prompt produced, and its copies never outlived the process. --prefix-cache-host-mib
is renamed --prefix-cache-mib; --prefix-cache-dir and --prefix-cache-disk-mib are removed, and
startup refuses all three with what replaced them. The compose files no longer mount /data, and
.env no longer needs RADIANCE_STATE
- --prefix-cache-ttl S (default 3600, 0 never): a conversation no request has used for that long
leaves the cache, whichever tier holds it; radiance:prefix_cache_expired_total counts them. A
full host tier now drops its least recently used conversations
- --vision-tower-placement vram|ram (#84): ram keeps an encoder tower in pinned host memory and
gives its VRAM to the KV cache, read over the link once an image
- timings carry ttft_ms and total_ms (#85): the server's own time from the request body's arrival
to the first and the last token, queueing and tokenisation included
- a KV-cache recall that found a moved expert with nowhere to go stopped halfway and leaked the
slots it had already freed: after it every recall failed, the cache stayed short until a
restart, and requests failed with HTTP 500. A recall now waits for the slots it is owed and
always finishes
- a tool result or tool-call arguments that are not JSON are no longer refused as nesting past
1024 levels for their unmatched brackets (#90): only text that parses as JSON is held to the
bound, since nothing else is parsed into a tree
- the host-pool refusal names the limit that applies to pinned memory (RAM less 1/64 and
1.5 GiB), not ttm.pages_limit
- --embedding-placement auto, removed in 1.3.0, is refused with what replaced it
- for out-of-tree kernel libraries: gemm_nt_q gains two operands (pb1, pb2, the part bounds), and
the loader requires identical op schemas, so a library built against 1.4.0 must be rebuilt. For
architecture plugins, rad_op_declared(b, op) asks whether an op is in the loaded vocabulary
without declaring it
The two feed-forward arms of a Gemma 4 MoE layer read the same normed residual and meet only at
the feed-forward join; issued one after the other, the dense arm's three launches -- gate_up,
act_mul, down, ~36 us under --profile-ops at a 26B-A4B decode step on 4x R9700 -- wait behind the
routed arm's ~120 every layer. At a few rows its GEMMs are latency-bound, nowhere near the
bandwidth the experts' GEMMs take.
In a step that runs whole -- every decode and verify step, and a prefill chunk too short to cut --
the dense arm now rides the second lane: issued behind a join from lane 0 (the attention join is
its producer), beside the routed arm on lane 0, and joined back before the feed-forward reduction
reads both. Its rows of the join buffer and the routed arm's are disjoint. No collective rides it,
so the reductions keep lane 0 here and lane 1 in a cut prefill chunk, and a step's collectives are
on one lane as before. h, gate_up, ffn and ff2 are named to rad_buf_concurrent. Off with the
overlap's switch, RADIANCE_GEMMA4_OVERLAP=0, which now keeps every step on one stream; a startup
note says which.
arch_test: a decode step issues the dense arm's three launches a layer on lane 1 and every
all-reduce on lane 0, two joins a layer, and nothing on the two lanes that touches a common
element unordered; a 4095-token chunk the same; the cut chunks keep lane 1 for their reductions
alone. GUIDE.md's switch and ARCHITECTURES.md say so.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 26B-A4B's router reads rmsnorm(x) * w_r * hidden^-0.5 and its experts rmsnorm(x) * w_e,
quantised to E4M3 for the fp8 gate_up: an `rmsnorm` and an `rmsnorm_quant_fp8` a layer, each
reading back the x norm_add_norm has just written and taking the sum of squares it has just taken.
At decode that is 60 launches a step (8.3 and 7.8 us under --profile-ops on 4x R9700); at a
prefill, eleven passes of each a layer per 20K-token request.
norm_add_norm_route is norm_add_norm, then from the norm factor it already holds the router's row
by rmsnorm's expression, ((x * s) * w_r) * mult, and the experts' codes as rmsnorm_quant_fp8 writes
them: the bf16-rounded norm, a scale of amax * (1 / 448) a 128 columns (1 for an all-zero group),
the value times its reciprocal clamped to +-448, one v_cvt_pk_fp8_f32. Element i is thread i % 256
at slot i / 256, so a group is four waves at one slot -- a wave's max, then the four through LDS.
Its own name rather than optional operands on norm_add_norm: the codes need whole 128-column
groups, which the plain join does not, and the arch falls back cleanly where it does not resolve.
A device row and a host arm (one helper with norm_add_norm's), the schema, OPS.md.
arch/gemma4 asks for it on every layer whose gate_up is block fp8 -- the user's fp8gu container,
every layer -- and then issues neither op_rnorm nor op_enorm; it declares both still, and
norm_add_norm and the chain behind it, for where it does not resolve. The routed arm's two norm
gains are declared ahead of the attention join now, which names them. The overlap takes either
join. A startup note counts the layers that take it.
The same rounding as the chain, but for the order a sum of squares is added in, as every join here:
g4k_emu holds the kernel to a chain summed in its block order bit for bit -- x, y, the router's
row, every code and scale -- at the 26B-A4B's 2816 at four heights, at 128, 3072, 3200 and 6144,
and with an all-zero group; against the host arm, no code more than a step off. The emulator gains
v_cvt_pk_fp8_f32, through the project's saturating encoder. arch_test: with fp8 gate_up experts the
route op resolves on all six layers, a decode step issues it and no rmsnorm_quant_fp8 and one
rmsnorm fewer a layer; refused, norm_add_norm and both launches; a tp-4 prefill through the
overlap issues it a slice and keeps every reduction ordered.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every input of a drafter layer was three launches after its all-reduce: `add` (x += h), `rmsnorm`
(x -> h) and `quant_act_fp8` (h -> hq | hs), ~8 us each under --profile-ops on 4x R9700 and a few
unprofiled, twice a layer -- thirty a draft pass, every decode step.
libr4d's `rmsnorm_quant_fp8` is that chain in one pass where it takes the residual operand (the
fused_add_rms_norm form): the norm of the bf16-rounded sum, the codes of the bf16-rounded norm,
which its row states is the chain's function. The drafter now issues it for both inputs of every
layer, the attention input of layer 0 with no residual -- x as the embedding left it -- and the
last layer's trailing add stays, ahead of the final norm, which no quantiser follows. Nineteen
launches fewer a draft pass. Where nothing serves the op the chain is declared and issued as
before. A draft is verified whatever it is, so this cannot change what is accepted.
arch_test: a draft pass issues ten rmsnorm_quant_fp8 and one add, the residual operand x and the
delta h past layer 0 and x alone at it; refused, the chain's ten adds and fifteen quantisers.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On gemma-4-26B-A4B at tp 4 on 4x R9700 the all-reduces were 47% of a 20K-token prefill under
--profile-ops (957 of 2020 ms): a layer reduces T x E after attention and both arms' 2T x E after
the feed-forward, at ~16.5 GB/s a rank on the link, against ~8 ms of compute a layer at the average
chunk. Run whole, the two take turns.
A chunk of two routed passes or more (4096 tokens) now runs as two slices, and every trunk
all-reduce rides the runtime's second lane (rad_lane) beside the other slice's compute: slice A's
attention reduction under slice B's output projection, slice B's under slice A's two arms, slice
A's feed-forward reduction under slice B's arms, and slice B's under the next layer's join and
projections of slice A. Attention runs whole -- it reads every row's keys. A model of the measured
times puts it at up to a quarter off an unprofiled prefill; --profile-ops syncs every op and cannot
show it.
The same bits as the whole step: the cut is a whole number of routed passes, so the routed arm
makes the passes the whole step makes, and both slices are at least one pass, above every row band
the sliced kernels have (the GEMM's 16 and 64, the reduction's one-shot edge) -- core's rule four
for the second lane. The slice's partials sit dense-then-routed in its own run of the join buffer,
so each slice's feed-forward reduction is one message.
The order: a reduction is issued on lane 1 behind a join from lane 0, its producer; lane 0 joins
lane 1 back before the consumer and before the next reduction is issued, since a join orders behind
everything its lane has issued. The embedding's reduction stays on lane 0, ahead of everything lane
1 is first joined behind, so the collectives keep one order on every rank. The two buffers reduced
in place are named to rad_buf_concurrent. Taken where the joins are fused, the wire is exact and
there is more than one rank; RADIANCE_GEMMA4_OVERLAP=0 runs every chunk whole, and the startup note
says which. A decode step never takes the lane.
routed() takes a run of rows and the join row its partial lands at; attention between the
projections and the output projection moves into attend(), which both paths issue.
arch_test records the lane of each issue and where each join sits, and a new test holds a 6-layer
26B-A4B with the DFlash taps, at tp 4: no two issues on different lanes that touch a common element
go unordered (taking every operand as read and written; dropping one wait makes it count six), lane
1 carries the trunk's 4 x 6 reductions at the slices' sizes and nothing else, the slices issue the
whole step's rows by op and its routed passes, a 4095-token chunk and a decode step stay on one
lane. GUIDE.md has the switch, ARCHITECTURES.md the paragraph.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The drafter's head was `gemm_nt` over the target's bf16 table -- 352 MiB a rank at tp 4, every draft
pass, 566 us of a 26B-A4B decode step under --profile-ops on 4x R9700: the widest read on the draft
path, and the "first thing to change once the model runs" its own comment named.
A container may now hold the table a second time as `dflash.draft_head.weight`, block fp8 -- one
checkpoint tensor, two logical weights, as rad_block_dflash2.h does it -- made by the recipe line
dflash.draft_head.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
which the three gemma4-26b-a4b -df recipes now carry. Where the copy is there, the head is
quant_act_fp8 over the gathered rows and gemm_nt_q over the copy at fp8a8: half the bytes, for 176
MiB a rank more. The copy is row-sharded exactly as the table, so a rank's rows are the same
vocabulary slice and row_topk's vocab_off, the all_gather and pair_argmax are unchanged. Drafts are
verified, so the coarser logits change what is proposed and never what is accepted --
draft_n_accepted says whether they propose worse; there is no rerank against the bf16 table yet.
Where the copy is not there -- every container converted before this, or one whose recipe made it
something other than block fp8 -- the head reads the bf16 table exactly as before. The decision is
the stored encoding's (weight_enc on the copy's name), and the copy's name map entry alone writes
nothing: rad-convert walks the declared weights. The startup note names the head in use. The
block-fp8 test moves to one helper, which the routed experts' encoding check now uses too.
arch_test: with the copy's encoding block fp8, the copy is declared and the head is gemm_nt_q over
it from the quantised rows; without, nothing is declared and the head is gemm_nt over the table;
a draft pass issues the head once either way. ARCHITECTURES.md says so.
Not yet run on the cards; it needs a container converted with the new recipe line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8772d5b handed the sliding layers' attn_paged q as a column slice of the fused [q|k|v] row. gemma4k
reads that; libr4d's paged attention reads q only dense and refuses the slice with RAD_E_STRIDE,
which stops the engine at the first step. Under attn_paged the first library in --kernels wins, so
the slice was only safe with gemma4k ahead of libr4d -- and the deploy script's default order
(libr4d,gemma4k,libavx) took the server down at layer 0's attention on both profile runs.
gemma4k now declares the same kernels a second time under attn_paged_qrow: attn_paged's schema
field for field, with q read at its own row pitch. Only gemma4k declares it, so it resolves there or
nowhere. The sliding layers ask for it once; where it resolves they read q in place (no lift), and
where it does not -- a hierarchy without gemma4k, or RADIANCE_GEMMA4_FUSE=0 -- q is lifted into a
dense block by a `cast` again and attn_paged reads that, which every attention library takes. The
lift's buffer is declared only then, since an unnamed buffer is live for the whole program. A miss
is the swa group's first op carrying a block_size, and answers rad_kv_block_size with the
RAD_KV_BLOCK it declares, as attn_paged would. No libref row, as the joins.
The kernel order still matters for speed -- gemma4k first is the order this model was measured with
(ARCHITECTURES.md) -- but no longer for whether the server runs. A startup note says which form
was taken.
arch_test: the slice reaches attn_paged_qrow and never attn_paged; refused, every sliding layer
lifts q for attn_paged; a decode step issues either form; and the three older gemma4 tests
count the sliding layers' attention under its new name. docs: OPS.md's row and paragraph (and a
line of the joins' text reflowed to the width, as one of gemma4.cpp's), ARCHITECTURES.md's kernel
paragraph, which now names expert_scale too, and GUIDE's FUSE row.
Not yet run on the cards.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ARCHITECTURES.md: a `gemma4` section in the file's form -- the 26B-A4B's geometry, the readings
that stay plausible when wrong (proportional rope is not a partial rotary, K is V, the router reads
the residual, per-arm post-norms, the bf16 embedding scale, the FULL sliding group, the drafter's
causality), tensor parallel, fp8 experts, which kernel library serves what, and what is not
declared. Its table gains the arch/gemma4 row, and the gemma4_bf16 row is corrected: that plugin
claims ("gemma4", "compressed-tensors"), not ("gemma4_bf16", "i4").
GUIDE.md: converting gemma-4-26B-A4B-it with its drafter, and RADIANCE_G4K_WMMA /
RADIANCE_GEMMA4_FUSE in the tooling table. IMPLEMENTATION.md: gemma4k/ in the layout.
KERNELS.md is rad-kbench's and is not edited here; it wants regenerating on a card with gemma4k
loaded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Google's Gemma 4 assistant (Gemma4AssistantForCausalLM), merged under
`draft.` by `rad-convert --draft-model`, declared when the container carries
it and the deployment speculates (max_spec > 0):
x = pre_projection(concat(E_trunk[tok] * sqrt(n_trunk), h_trunk))
x = 4 layers (3 sliding, 1 full): q-only attention over the TRUNK's cache,
o_proj, plain-gain sandwich norms, GELU ffn, per-layer scalar
hd = norm(x); logits = the head's own tied table (no soft-cap)
h' = post_projection(hd), the next round's hidden state
h_trunk is the trunk's final-normed hidden state. Each head layer reads the
last trunk layer of its class (58 sliding, 59 full on the 31B), as vLLM wires
it. The head keeps no cache, so it is declared with rad_drafter_shared_kv:
one row a drafting sequence, every round at the committed position.
TP: q heads row-sharded with the trunk's kv heads; o_proj and down are
column-sharded and all-reduced before their post-norm; projections and norms
replicated; the lm_head vocab-sharded through the ordinary sampler chain.
Declare refuses a head whose kv geometry, window, rotary or vocabulary differs
from the trunk's, and use_ordered_embeddings (centroid masking). The probe
answers draft depth 3 for `--num-speculative-tokens auto`.
arch_test: no head without one or at max_spec 0; shapes, name maps, the
drafter declaration; the issue order of a history pass and a round; the
attention reading trunk layers 10/11 of the 12-layer fixture; TP2 reduces
before each post-norm; a history pass of the wrong shape is refused.
- EmbeddingGemma 2 (google/embeddinggemma-2): text, image, video and audio embeddings on the
card (libr4d) and on the CPU (libavx); prompt_name, Matryoshka dimensions, image budgets,
mixed content parts and the messages form on /v1/embeddings
- #43: on serves that lend the activation arena to the experts (Qwen3.8-Flash-Next with
expert_tiered), every image after the first read its rows from the wrong place -- garbage
replies, or an earlier request's image. Fixed
- the Qwen vision towers' attention resolves on the card again (broken on main after 1.2.3,
never released)
- #42: a warning at startup when amdgpu cwsr_enable is 0, and a stalled queue is reported as
slow or stuck; the guide covers the GPU-hang-and-reset chain
- Four-rank Qwen3.8-Flash-Next (PRs 14 and 16 by keptn42): the all-reduce runs fused with the
hyper-connection's write, and with the MoE gather in front of it, on decode and verify steps on
the exact wire. The routed experts are split in four classes, so every rank computes the same
share; moe_gemm_q_mod4 is the new grouped GEMM. The oracle now checks moe_gemm_q on w4nl and
w5nl containers.
- --embedding-placement and --ngram-placement, each auto | vram | ram | disk. The token embedding
can live in the pinned host pool, read in place over the link (from PR 17 by mechkbfan). An n-gram
table can be copied into locked RAM at load instead of read from the container (from PR 15 by
keptn42). auto takes the fastest tier with room once every other weight is placed, and startup
prints what it chose and why. A tier that cannot be honoured stops the start with the reason; the
embedding on disk and the n-gram table in VRAM are refused, since nothing can serve them.
- The expert_tiered placement no longer spends the pinned host pool twice when it falls back to
layer offload, and a lossy-wire request for a four-rank fused write is a selection miss rather
than a startup abort.
At --tp 4 each MoE connection ran moe_gather and the fused write as two
launches, three or four with the inverse table. ar_gather_hc_write_4rank
runs r4d_ar_gather_word as the prologue of ar_hc_write_4rank, with the
two-rank slot table and grid rule. The arithmetic is moe_gather's plus
ar_hc_write_4rank's, so the bytes are unchanged. One and two ranks unchanged.
At --tp 4 each gated-residual connection ran all_reduce and hc_write_bf16
as two launches. ar_hc_write_4rank fuses them: the wide exact one-shot,
reduced in place, with r4d_ar_hc_write_word as its epilogue. It takes the
steps the exact one-shot would (under 1 MiB, and under min_bytes on wht6);
larger and lossy messages keep the two launches. Two ranks unchanged.
The parity split gave ranks 0..3 30/30/20/20 % of the routed work. The extra
block of each five-block expert now goes round all four ranks by expert id
mod 4: rank r takes two blocks of class r and one of each other class, a
quarter each. The plain experts' extra tiles move to ranks 0 and 1 so they
do not stack on the shared expert's. One and two ranks declare as before.
At four ranks the routed parity split leaves ranks 0 and 1 widest, and the
shared expert's extra block and the plain bf16 experts' extra tiles were cut
from rank 0 as well. Both remainders now go to the ranks the routed split
leaves narrowest. One and two ranks declare byte for byte as before.
- Qwen3.8-Flash-Next serves at --tp 4, contributed by goodman-b (PR 9). Rank pairs share each of
the model's two KV heads, every rank computes a slice of every expert's width, and four ranks
run the unfused all-reduce plus a new four-rank all-gather for the vocab-parallel sampler. Two
ranks declare and compute exactly as before. The README has a four-rank flag row; it pins
--host-pool-mib on every card, 48 GiB in all. At four ranks the expert shares are not equal:
ranks 0 and 1 compute three blocks of every even/odd pair of experts and ranks 2 and 3 two
(docs/ARCHITECTURES.md).
- The four- and eight-rank all-gathers require peer access between the cards, as every other
collective does since 1.0.7, and the kernel library's selftest now refuses any multi-rank kernel
that does not.
The real-container declare gate refused this container at layers 46-47: 'keeps
1 experts plain bf16 on this rank, which leaves 127 quantised'. Root cause:
protected-expert counts are per-rank, and the recipe protects IN PAIRS precisely
so that each rank's quantised count stays even. Expert parallelism broke that
property the parity tables rest on; fixing it properly would need unequal-length
weight tables, which the builder's equal-split rule refuses by design.
The width split was always the right answer above two ranks and serves more
ranks than the old code realised. Each parity's blocks are cut contiguously
across the ranks and the rank taking the odd block alternates with the parity:
at four ranks and five blocks, [0,2) [2,3) [3,4) [4,5), with the fat class
rotating between the two parities so no rank takes both. Every block of every
expert has exactly one owner, protected counts go back to the recipe's global
even numbers, and -- because every rank still computes a slice of every routed
expert -- the routing-balance cost the EP design carried disappears with it.
World 2 is byte-identical: base, extra and the parity rotation reduce to the
same expressions at g.world == 2. Worlds up to the block count now declare;
beyond it the refusal names the reason.
World 4 refused at declare on two counts and at boot on a third the audit
found; the fourth is unchanged by design.
- rad_arch.h: a world above the KV head count replicates the heads in rank
pairs instead of dividing them. Geom gains kv_off; each rank declares
n_head_kv 1 and gqa 6. A world that is not a multiple of the head count
is still refused, by name.
- rad_block_attn_gated_fp8.h: k/v pass the row span LinearFP8 already
takes, gated on world > n_head_kv_all so an even shard is untouched and
TP2 declares byte-identically.
- qwen4exp_fp8.cpp: above two ranks the ranks own whole experts (5 blocks
of 128 do not cut four ways); the parity tables stay two-rank and the
router stays replicated.
- libr4d: attn_{prefill,decode}_h256_gqa6_bs4 rows and their TU -- the
gqa8 body at ratio 6, page 4. No fused form is instantiated at this
geometry; the unfused pair is what resolves.
- libr4d: r4d_ar_gather_Nrank.hip. The vocab-parallel sampler declares an
all_gather at any world > 1 and libr4d shipped only the 2-rank row, so a
TP4 boot was refused by the reference-kernel gate rather than served
wrong. The wide one-shot all-reduce with the reduction removed.
- rad_block_attn_gated.h / rad_block_attn_fp8.h: refuse a world above the
KV head count. They read n_head_kv and declare no span, so they would
have booted and read half a KV head -- fluent wrong text.
- tests/arch_test.cpp: the four-rank declare test, and the fake records
the shard span the real builder stores.
- README, ARCHITECTURES: TP4 in the present tense, with the costs named
and the rate against TP2 left unmeasured.