Archived
bbc7607222fbaa8a4d5c378bd595fdef94951164
13
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bdb37d5d16 |
arch: Gemma 4 31B with z-lab's DFlash drafter
Gemma 4's DFlash drafter moves into arch/common so both Gemma 4 plugins declare it, on the int8 grid too; the 31B declares it beside its w4a8 / w8a8 trunk when the container carries one; the w4a8 and Q8 -df recipes and compose files; the tests. Squashed from: - arch: Gemma 4's DFlash drafter into arch/common, for both Gemma 4 plugins, and on the int8 grid - arch: z-lab's DFlash drafter beside the 31B's w4a8 / w8a8 trunk, its gqa-8 attention at gqa 4 - data/recipes: gemma4-31b with DFlash, the w4a8 trunk with a block-fp8 drafter, and Q8 - tests: the 31B with its DFlash drafter declares the chains where libr4d's fused ops are not declared - tests: the 31B's steps with its DFlash drafter lint clean, on both grids, at one, two and four ranks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1e968f6e1d |
radiance 1.7.0
- 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 |
||
|
|
b93b531f63 |
radiance 1.5.0
- 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 |
||
|
|
c527863248 |
arch/gemma4: the dense arm on the second lane beside the routed arm, in a step that runs whole
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> |
||
|
|
7a1ae22690 |
gemma4k, arch/gemma4: norm_add_norm_route -- the attention join writes the routed arm's inputs
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> |
||
|
|
34ee08ea5e |
arch/gemma4: a prefill chunk in two slices, the all-reduces on the second lane beside the compute
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> |
||
|
|
743b7e1a6a |
arch/gemma4: the DFlash head reads a block-fp8 copy of the table where the container holds one
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>
|
||
|
|
73c3dc38be |
gemma4k, arch/gemma4: attn_paged_qrow -- q in the fused row only where gemma4k reads it
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> |
||
|
|
0d95046f6f |
gemma4k, arch/gemma4: expert_scale -- per_expert_scale on the routing weights in one launch
Gemma 4 multiplies each renormalised routing weight by per_expert_scale of the expert it chose. In the conventional vocabulary that is an `embed_lookup` of the [n_expert, 1] table by the ids and a `mul` into the weights -- two launches a MoE layer, a few dozen elements each at decode (--profile-ops: ~0.26 and ~0.22 ms a step across the 30 layers). gemma4k's `expert_scale` is the pair as one kernel, ew = bf16(ew * w_e[id]), with an id outside the table reading 0 as embed_lookup's missed row does: one product rounded once, so the pair's value bit for bit. Like the joins it has no libref row on purpose, so arch/gemma4 falls back to the pair wherever gemma4k is not loaded, and RADIANCE_GEMMA4_FUSE=0 turns it off with them. 30 launches a step the fewer. g4k_emu: device and host rows against the pair over 32 shapes -- top-k 1 and 8, pitched rows, pads and one-past-the-end ids, rows past M untouched -- every element equal. arch_test: a decode step scales in one launch, and in two with it refused. docs/OPS.md: the row and its paragraph; GUIDE: what the switch now covers. Not yet run on the cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
29f981fd6c |
arch/gemma4: route a decode step in one launch -- libr4d's fused router, top-k and sort
At decode heights the router GEMM (128 x 2816), its top-k and the expert sort are each one small workgroup's work behind a full dispatch: --profile-ops put the three at ~0.27, 0.29 and 0.24 ms a step across the 30 MoE layers. libr4d already fuses them for the Qwen MoE blocks -- `router_topk_scatter` for the pair, `router_gemm_topk_scatter` with the GEMM in front -- and documents both as byte-identical to the launches they replace, so the routing does not move. arch/gemma4 now asks for them as rad_block_moe_fp8.h does: the pair up to the sort's single-workgroup bound (1024 routing slots, 128 rows at top-8), the GEMM form up to the skinny GEMM's decode band (64 rows), and the separate ops for a pass past either, declared regardless. The per-expert scale and the experts' input norm sit between them in the issue order and read only the ids and weights the fused op writes. Two launches a MoE layer the fewer at decode, 60 a step. arch_test: a decode step routes with the fused op; refused, with the pair; both refused, with the three separate ops -- and the per-expert scale and the gather run in every case. Not yet run on the cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
171dcee15b |
gemma4k, arch/gemma4: the feed-forward join writes the next layer's input norm
join_add_scale takes an optional gain `w_n` and output `y` (both or neither) and, given them, writes y = rmsnorm(x) * w_n over the residual it has just stored -- the next layer's input_layernorm, or the final norm after the last layer. Those norms read the x the join writes and nothing else, so each was a launch of its own and a second read of the row; now it is a fourth reduction in a block that already holds x in registers. On the 26B-A4B that is 30 launches a forward pass the fewer (29 input norms and the final norm), at decode a step's worth of ~8 us launches. Rounding where the chain rounds: y is taken over the bf16 x the join stores, with libr4d's expression, so g4k_emu holds it to the chain bit for bit (+next cases, decode to prefill heights, odd widths and pitches) and to the host arm within a flipped rounding. arch/gemma4 declares every layer's input-norm gain ahead of the layers so a join can name the next one's; where a join resolves, the norm it replaces is neither declared nor issued, and where it does not, the chain is as before. docs/OPS.md: the row and its paragraph. arch_test: fused, the only x -> h rmsnorm is layer 0's and every join writes h; refused, all thirteen come back. Not yet run on the cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3a48ee78de |
arch/gemma4: the sliding layers' attention reads q in the fused qkv row
The q lift -- a `cast` copying q out of the fused [q|k|v] projection into a dense block -- was there because libr4d's paged attention reads q only dense. gemma4k's takes q at any row pitch (its head_view, and g4k_emu's q-pitch-slice cases), and gemma4k serves all of Gemma 4's attention, so the slice goes straight in: one launch and a [T, q] copy less on each of the 25 sliding layers, every step. With libr4d ahead of gemma4k its attention refuses the slice by name (RAD_E_STRIDE) rather than reading it wrong. arch_test: no copy between projection and attention, and the attention reads `qkv_s`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c2bd41fe95 |
arch/gemma4: Gemma 4 text with z-lab's DFlash drafter -- the 26B-A4B MoE and the dense sizes
Claims ("gemma4", ""): a container converted from Google's bf16 checkpoint, the recipe choosing
what is fp8. gemma4_bf16 keeps ("gemma4", "compressed-tensors"), the CT-INT4 dense release; the
two do not overlap. Serves gemma-4-26B-A4B-it (128 experts of 704, top 8) and the dense sizes
without per-layer embeddings, with a DFlash block-diffusion drafter merged at convert time.
The readings that stay plausible when wrong, each explained at its site:
- Proportional rope is not a partial rotary: the full layers rotate the first 64 frequency pairs
of the 512-wide head at theta^(-2j/512), pair j = channels (j, j + 256), declared as full-width
NeoX with the frequencies past pair 63 divided by 1e30 through the YaRN ramp `rope` carries.
- K is V on the full layers: V is the un-normed, un-rotated k projection, so its norm is issued
before the key norm overwrites `k`.
- The router reads the residual through a gainless rmsnorm times its `scale` times hidden^-0.5,
and per_expert_scale multiplies after the renormalised top-k.
- Two post-norms a layer's feed-forward, one an arm, each arm's partial reduced before its norm;
both partials share one [2T, n_embd] buffer so one all-reduce carries them.
- The embedding scale is sqrt(hidden) rounded to bf16 (53.0, not 53.066).
- The sliding layers' KV group is RAD_KV_FULL with the window on the attention op: a WINDOW
group is not prefix-cached, and on this tree a hit on one re-prefills; FULL keeps the hit.
- fp8 experts are two tables by parity, so a rank holds an even count; down at K = 704 cannot be
fp8 (whole 128-blocks), hence the 768-padded recipe.
- The sharded draft head's merge is pair_argmax at R = 2 on the wire.
- The drafter's tap copy is declared at the end of the layer it taps, where it is issued. The
buffer planner takes liveness from declaration order; declared once after the trunk, it let the
plan share `dflash_src` with `moe_edn`, which every MoE layer writes, whenever the sizes
allowed. At --max-num-seqs 16 they did, and on the cards DFlash accepted 2% of its drafts
(97 tok/s against 135 with speculation off and 186 with the taps intact), the text fluent
throughout.
The sandwich joins are asked for as norm_add_norm / join_add_scale (gemma4k) and declared as the
rmsnorm / add chain where nothing serves them; RADIANCE_GEMMA4_FUSE=0 asks for the chain. The
reply format is the shared one (arch/rad_gemma4_chat.h), so tool calls are parsed in the engine;
the plugin as measured declared reasoning only and left calls to an out-of-tree sidecar, so the
call path is untested on this plugin's containers.
arch_test: the MoE trunk declares both arms and six of each join; both KV groups FULL with the
window on the op; the full layers' rope over the whole head with the ramp at 63.5..64; with the
joins refused, the chain is declared and issued instead; both Gemma 4 plugins export one format;
with a DFlash drafter, `dflash_src` is live from the first tap layer (its range overlaps
`moe_edn`'s, so no plan can share them) and a step writes each tap once.
Measured on 4x R9700 at TP4 (gemma-4-26B-A4B-it + DFlash, gate_up experts block fp8), with
gemma4k and --draft-window adaptive: a story at T 1 177 tok/s, greedy thinking 572 tok/s, code at
T 0 319-334 tok/s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|