Commit Graph
429 Commits
Author SHA1 Message Date
keptn42 432b50d7dd deploy/grafana: the adaptive draft window, verifies by draft depth
Two panels for RADIANCE_DRAFT_ADAPT: the mean window of the running
sequences (a gap while none runs) and the share of verifies by the drafts
they carried.

Conditional acceptance by position is now accepted(j) / reached(j). The
old reached(j+1) / reached(j) needs every verify to carry the same depth;
on an adaptive instance it showed 0.24 at position 2 where the engine's
own ratio was 0.72, and the last-position series is no longer defined.
2026-10-07 11:10:19 +02:00
keptn42 32cdaa5cc7 metrics: count each draft position's acceptances
radiance:draft_position_accepted_total{position}, next to the reach. At a
fixed depth the next position's reach is this position's acceptances, so
reached(j+1) / reached(j) gives the conditional acceptance over a window.
Under the adaptive window a verify can end at j with j taken, and that
ratio drops wherever windows end; accepted(j) / reached(j) does not.
2026-10-07 11:10:19 +02:00
keptn42 d579bd7d45 docs/GUIDE: the adaptive draft window, its metrics and its environment 2026-10-07 11:10:19 +02:00
keptn42 1e27172c14 draft: the adaptive window is the serial drafter's; a block drafter keeps its depth
RADIANCE_DRAFT_ADAPT prices a draft as one more round of the head. A block
drafter proposes its whole block in one pass, so it is not that trade; with
a block drafter the engine now turns the policy off before the first step
and says so. New sched_test case.
2026-10-07 11:10:19 +02:00
keptn42 76727fa050 draft: cap every adaptive window under load (RADIANCE_DRAFT_ADAPT_BUSY)
The cost table prices a step at one sequence. Under load every row a step
adds is expert bandwidth its neighbours wait on, and the adaptive window
lost 4 % at 8 concurrent requests. With RADIANCE_DRAFT_ADAPT_BUSY=N and
more than N sequences running, every window is capped at
RADIANCE_DRAFT_ADAPT_BUSY_DEPTH (default 3); the estimates keep learning.
The count is taken once a cycle and held to its end, so the plan, the
rounds, expect_draft and set_draft see one cap. Unset, nothing changes.
2026-10-07 11:10:19 +02:00
keptn42 82da8eab69 draft: an adaptive draft window per sequence (RADIANCE_DRAFT_ADAPT)
One depth for every request is too shallow for code and JSON and too deep
for prose. With RADIANCE_DRAFT_ADAPT=1, --num-speculative-tokens becomes
the ceiling and each sequence drafts into the window d that maximises
E(d)/T(d): the tokens a step is expected to emit from the sequence's own
smoothed acceptance at each position, over the step's cost
(RADIANCE_DRAFT_COST, depth:ms pairs). The serial head runs as many rounds
as the deepest window in the step. A window moves only past a hysteresis
and a hold, since a new window is a new pass shape. Acceptance is
unchanged. /metrics gains radiance:draft_depth_adaptive and
radiance:draft_verify_depth_total{depth} while it is on. Unset, nothing
changes. Greedy at up to 6 against fixed 3: code +7.7 %, JSON +16.3 %.
2026-10-07 11:10:19 +02:00
keptn42 73691a1189 r4d_selftest: the R4D_MOE_PF2 aligned-form pass at every class's own geometry, fp8a8 included
moe_q4_gemm holds the run-aligned form under parts 16 and 64 to the form
without them as well, so the block-fp8 instance of the early weight issue
and the narrow classes' pad tiles are compared byte for byte too. Past 512
experts the launcher builds no run map and there is no aligned launch, so
the pass is skipped there rather than failed.
2026-10-07 11:09:45 +02:00
keptn42 92eb44619b moe_gemm_q run-aligned form: the first pass's weight at the map read (R4D_MOE_PF2 64)
In the run-aligned form the map entry names the block's expert, yet the
weight loads wait behind the token load, a barrier, the live count and the
table entry. Part 64 issues the rows and the live count first, then the
table entries and the first pass's weight through the uniform global base,
all unconditional, so the weight stays in flight while the tokens arrive.
The same bytes go to the same registers and LDS slots: bit-identical.
2026-10-07 11:09:45 +02:00
keptn42 e31be583a9 moe prefill forms behind R4D_MOE_PF2: wide gather, parallel scan and map prefix, 256-column down
In a prefill chunk moe_gather loads two bytes a lane and waits on every
slot, moe_scatter scans on one thread, and so does the run map's prefix.
R4D_MOE_PF2=1, or a mask of the parts: 2 a wave a token and 16 bytes a
lane with every slot's row in flight, 4 its column groups last first, 8 a
parallel scan with the tail folded into the placement, 16 the map prefix
in parallel, 32 a 256-column run-aligned down tile (w4). Each part keeps
its sums in the same order or is integers: bit-identical. Unset, every
launch is as before.
2026-10-07 11:09:45 +02:00
baKon 33778b2b8c budget: an uneven world's cheaper rank pages the common tokens and keeps its experts
The resolver derives one split, the dearest rank's, for every card, and one
block table serves every rank. An attention-zero rank keeps no attention cache:
at TP3 on Flash-Next it pages the common 1.45M tokens in ~1.8 GiB of its
10.6 GiB KV pool, the rest is an address reservation nothing ever commits or
lends, and 1091 of its experts can never reach the card even with the cache
idle.

Such a rank now gets a KV pool that pages exactly the common token count (the
new KVManager::pool_mib_for_tokens, the inverse of paged_tokens, plus a 64 MiB
margin) and the difference in its weights pool, no further than every weight
resident. The per-rank split reaches BOTH readers of the resolved sizes --
Pools::configure and the planner -- so the grown pool is planned into. The
token count, the carve, the loan and the dearest ranks' pools are unchanged;
configure_kv names it if a re-sized pool ever binds.

Only a derived split under expert_tiered is re-split: a stated pool is the
operator's, and under auto a fully resident rank would choose all_vram while
its peers spill. Where every rank's cache costs the same -- every world the
heads divide -- no rank qualifies and every rank takes cfg_ as before.
2026-10-07 11:09:36 +02:00
hazyumps 6fd7421f79 Fix rotary compatibility edge cases and document Qwen qualification 2026-10-07 11:09:27 +02:00
hazyumps 59d36ae928 Extend YaRN to Qwen4 attention and compressed index keys 2026-10-07 11:09:27 +02:00
hazyumps 2af7fa4022 Add static YaRN to Qwen rotary paths with independent CPU and ROCm vectors 2026-10-07 11:09:27 +02:00
Deadcode d23c3e0d17 radiance 1.2.1
- A checkpoint restore that found its snapshot slot given back stopped the engine (#33): a
  snapshot handed to an admission is now kept until its step has run, a lost one re-prefills
  that request instead, and a failed restore names the check and the rank.
- The headroom warning had no fixed point (#32): it now checks the room left for a kernel's first
  launch and names the --gpu-headroom-mib value that clears it.
- reasoning_effort (#31): the levels the chat template takes are probed at startup and published
  in /server_info; a level outside them is a 400 on `reasoning_effort` with `supported`;
  --reasoning-effort-map rewrites a client's level.
- rad-convert reads published quantised releases (#29): AMD Quark MXFP4 byte for byte, and
  AutoRound (auto_round:auto_gptq) / GPTQ int4 and int8, with Flash-Next checkpoints that ship
  their experts one by one.
- tool_choice "required" and a named function are served by a call grammar for the whole reply.
2026-10-07 10:14:00 +02:00
Deadcode e95d397288 radiance 1.2.0
- MXFP4 weights: block-fp8 Qwen3.5/3.6/3.8 dense models serve OCP-MXFP4 linears (e2m1, an E8M0
  exponent per 32) at 4-bit weights against E4M3 activations. New libr4d rows: the decode GEMM
  (M <= 128, split-K with a fused last-arriver reduction) and the prefill GEMM on a fragment-tiled
  activation. Qwen3.8-27B MXFP4 (AMD Quark AWQ) is in the model table.
- Cards without peer-to-peer access serve: every collective has a host-memory twin; --p2p
  auto|on|off.
- Stop strings apply to the answer, not to the reasoning block a reply starts in.
- A prefix hit ends one drafter window before the prompt's end, so a windowed block drafter
  (DFlash2) drafts from the first token of a follow-up turn.
2026-10-06 21:36:24 +02:00
Deadcode 7001841e45 radiance 1.1.1
- Pinned host memory works again on kernel drivers without the SVM API (e.g. a KVM guest with the cards passed through): the host pool is one allocation there instead of 1 GiB pieces that landed apart on the cards (#28). Regression since 1.0.9.
- A host-pool refusal no longer advises shrinking the pool when it fits under the pin cap and the available RAM.
2026-10-06 14:43:46 +02:00
Deadcode 82b5835c02 radiance 1.1.0
- The VRAM split has no ratio: --expert-vs-cache-ratio is gone (now an unknown option). The
  experts keep what the pinned host pool cannot hold, the KV cache takes the rest and lends idle
  blocks to the experts. Flash-Next at tp2: 7.9 GiB of KV a card, up from 4.7. Startup, /stats,
  /metrics and the dashboard report the most the cache can hold.
- Linear-state snapshots live in pinned host memory, not VRAM (--checkpoint-slots sizes the
  store). Prefix-cache misses on agent sessions fixed; a published conversation is no longer
  trimmed away.
- Any world size from the shipped container (baKon): --tp 3 on Flash-Next with no padded
  checkpoint -- the attention world, uneven delta-net heads, the fill op.
- Kernels (keptn42): moe_gemm_q decode loads and one-trip run search, hc_read's prefill form
  (+3.7% prefill at 18K), hc_up row groups up to eight, the fused router launch. Each is the rule
  where it was measured faster; no environment switches.
- Tool calls: a typed argument is always JSON (Python True/None no longer leak into arguments --
  Codeberg #21); nine further reply-parser fixes; the reply path inside a call is ~12x cheaper on
  the host.
- The kernel changes: prefill +2-3% and decode -2% a step on 2x R9700 at tp2, identical text.
2026-10-06 14:04:49 +02:00
baKon 9f5feb24ee Revert "budget: a rank whose cache costs less backs the same tokens with a smaller pool"
This reverts commit fa01bd2. Its premise -- the attention-zero rank holds
a larger share of the experts, so the bytes its cache does not need are
best spent in its weights pool -- went with the experts' remainder-first
placement (665d181): the experts cut as every world always has and no
rank has a larger share. What the re-split did keep was a KV pool on that
rank a third the size of its peers', and BetterBench after three 250k
prefills (a cache three quarters full) decoded 13-23% slower at every
concurrency than the same tree without it, while a cold server measured
faster. The pool goes back to the common split; what the rank does not
carve for attention it lends, as every rank's idle cache does.
2026-10-06 11:23:06 +02:00
baKon 92b8aaff2b arch: the experts stay on the rotation; only the delta net goes remainder-first
An expert block is a whole GEMM of every routed token; a rank taking the
extra block of every class became the step's slowest rank. Measured on
Flash-Next at three ranks, interleaved image A/B, two reps each: experts
50/25/25 cost 25% a step single-stream; one class's extra block
(37/25/37) swung 16.5-19.1 ms between boots; the delta-net head alone on
the attention-zero rank gave 15.6 ms both reps against 16.7-17.2, c1
+10-16%, c4 +4%, c8 +2-3%, acceptance unchanged at 2.54 tokens a step.
The experts cut as every world always has; TP2 and TP4 are untouched.
2026-10-06 11:23:06 +02:00
baKon 2d93182213 kv: a rank's recurrent state is cleared and tiered by its own plan, not rank 0's
A freshly assigned recurrent slot was zeroed on every rank with rank 0's
layer_bytes_per_state. The ranks' shares of a group need not be equal --
a world the heads do not divide gives them different counts -- and a rank
holding more heads than rank 0 had the tail of its state left as the last
sequence left it, read by the recurrence from the first token. Every rank
now clears by its own plan. The host/disk tier made the same assumption
twice: a slot was rank 0's entry times the world and a rank's window sat
at rank times that; a slot is now the sum of the ranks' entries, each
rank's window where the ranks before it end, and the staging ring is
sized for the largest. Equal shares give the bytes they always gave.

Found by moving the extra delta-net head of Flash-Next at three ranks
onto the attention-zero rank: rank 0 held five heads, rank 2 six, and
every answer was noise.
2026-10-06 11:23:06 +02:00
baKon 017cf52218 docs: OPS.md -- the fill op 2026-10-06 11:23:06 +02:00
baKon 5acdab7eb7 arch: the ranks without attention take the remainders first
Whatever does not divide over the world -- the extra block of an expert's
width, the extra delta-net head -- went to whichever rank the rotation picked,
and the attention-zero rank, which pays nothing for attention and keeps no
attention cache, came away the lightest. rad_arch.h remainder_place puts the
attention-zero ranks first in the order the remainders are handed out, then
the attention ranks in today's rotation; with no such rank the place is the
rotation itself and every cut is byte for byte what it was. Flash-Next at
three ranks: experts 30/30/40 and delta-net heads 5/5/6 instead of 35/35/30
and 6/5/5.
2026-10-06 11:23:06 +02:00
baKon ffdf1f2ced budget: a rank whose cache costs less backs the same tokens with a smaller pool
The resolver derives one split for every rank (the dearest rank's). A rank
whose KV groups cost less per token -- an attention-zero rank keeps no attention
cache -- would spend the common pool on tokens configure_kv then caps away, one
block table serving every rank. Its KV pool is now sized for the same token
count as the dearest rank's, a hair over, and the difference goes to its
weights pool, where its larger share of the experts lives. Only a derived split
is re-split; a world whose ranks cost the same is untouched.
2026-10-06 11:23:06 +02:00
baKon 3e629e7a27 kv: a group a rank keeps no cache for
rad_kv_group_zero(b, group): the group is declared as on every other rank --
the scheduler indexes groups by position and one block table serves every
rank -- and this rank carves nothing for it: its block count is the shared
table's, its costs are zero, its pool base is null, and issue refuses any op
on this rank that names it. For a rank the geometry gives no attention heads,
whose attention is a fill of zeros and never stores or reads a key. qwen4exp
declares its attention group so on such a rank. The arch test's contract
becomes the real one: same KV groups by position; ops are each rank's own.
2026-10-06 11:23:06 +02:00
baKon 7be92ec8f4 attn gated: an attention-zero rank computes no attention
Its share of every projection is zero, so q, k, v, the attention and the output
projection are zero and the reduce gains exactly nothing from it. Declaring the
projections and running them on zero weights spent a real rank's dispatches and
bytes every layer, and a slot for every zero. The block on such a rank is now
one fill of its output wire, then the all-reduce and the residual it always had;
the norm stays because a pre-norm block's fold and ar_in live in it. The branch
is dead on every rank with heads, so a world the heads divide declares as before.
2026-10-06 11:23:06 +02:00
baKon cd48c61daf libr4d: a fill op
y = value over an [M, n] extent at a row pitch, bf16, default 0. The op a rank
issues where it has nothing to compute and a reader downstream -- an all-reduce,
a residual -- still expects a defined buffer: a wire shared across layers cannot
be zeroed once a step, and a memset knows neither the pitch nor the dtype.
Smoke-tested for the exact zero, the pitch, and the RNE of a value.
2026-10-06 11:23:06 +02:00
baKon fd54038b8c docs: TP3 -- the zero share is written, not assumed; the poison test 2026-10-06 11:23:06 +02:00
baKon 43d97cb9e6 load: a zero share is delivered from a container, and an undelivered slot refuses
From a container the relayout workers are fed by the sweep over the file, and a
zero share (rad_weight_shard_zero: an attention-zero rank's q|gate, k, v and o)
has no bytes in the file, so nothing ever arrived for it, its worker never ran,
and its slot held whatever the card had there. On a card whose freed VRAM the
driver wipes that is zeros and the rank serves correctly by luck; on a card
fresh from a reset ("VRAM is lost") it is garbage and every token is garbage.
The checkpoint branch hands every staged weight to the workers itself, which is
why the hole was never seen there.

Zero shares are now handed to the workers before the sweep, and the pool's
finish() refuses when any staged weight was never delivered, so a slot nothing
wrote cannot serve again.

Reproducer on any card: RADIANCE_POISON_ALLOC=255 with an odd world over a
container (--tp 3 on a two-KV-head model).
2026-10-06 11:23:06 +02:00
baKon 31a3ddd24f device: RADIANCE_POISON_ALLOC fills fresh device allocations
A buffer read before anything wrote it is zeros on a card whose freed VRAM the
driver wipes, and garbage on one that has just been through a reset ("VRAM is
lost"). RADIANCE_POISON_ALLOC=B fills every fresh device allocation with byte B
so such a read shows on any card; RADIANCE_POISON_RANGE=lo:hi narrows the fill
to allocation ordinals for a bisect. Debug knobs beside RADIANCE_TRACE_ALLOC;
off, nothing changes.
2026-10-06 11:23:06 +02:00
baKon 9fc7e5f1ff kv: every rank carves the least rank's blocks
One block table serves every rank, and Engine::serve refuses ranks whose
paged groups hold different block counts. Under the even split that was
a check that never fired: the ranks' pools had the same geometry and the
same bytes. Under the attention world they do not. A rank with 6 of 16
delta-net heads holds more recurrent state than one with 5 and has less
pool left for pages; the attention-zero rank has no attention weights
and has more. Three ranks over Flash-Next carved 136256, 142352 and
more, and the serve was refused.

KVManager::paged_split is the carve's paged arithmetic with nothing
carved -- the token count the paged groups exhaust at together for a
pool of so many bytes, a windowed group capped at its window -- and
carve_into spends what it says. paged_tokens asks it; cap_paged_tokens
sets a ceiling it keeps under. Engine::configure_kv plans every rank
first, asks each what it could page, and caps every rank at the least
before any carves; a rank that could have paged more says so at info.
At an even split the cap is what every rank would have carved.

mem_test: kv_ranks_with_unequal_pools_carve_the_least_ranks_blocks_under_a_cap.
2026-10-06 11:23:06 +02:00
baKon d72b00bfdb tests and docs for the attention world
arch_test: flashnext_tp3_zeroes_the_third_ranks_attention_and_splits_gdn_heads_unevenly
holds the three-rank declaration of the Flash-Next fixture: the three
programs declare the same ops and KV groups in the same order; every
rank the two-rank attention geometry with the span of its heads, rank 2
zero; the delta net 6/5/5 K and 18/15/15 V heads as per-part spans of
[q|k|v|z] and the conv channels, a span of A_log, the output columns,
and the state group at each rank's own V count. The fake builder
records the two new exports as it records the span. The TP4 case's
"world 3 is refused" check becomes "world 3 declares".

docs/TP3.md is rewritten: what replaced the padded checkpoint, the two
rules, what they are built from, the serve line and the log lines. The
pad tools stay in the tree for an engine without an attention world.
2026-10-06 11:23:06 +02:00
baKon 45963012ee any world size: the attention world, uneven delta-net heads, nothing padded
A world the KV head count neither divides nor is a multiple of -- three
ranks over Flash-Next's two -- was refused by geom_from, and 1.0.12
served it by padding the checkpoint offline (docs/TP3.md): zero heads
appended so that 36 / 3 / 18 / 54 divide, a second 115 GiB container
per model, 1/3 of the attention and 2 of 18 delta-net heads computing
zeros. This serves the shipped container at any world size instead.

The attention world. geom_from serves attention on the largest multiple
of the KV head count under the world (split, or replicated as 1.0.7
does when that is still above the count) and the ranks past it are
attention-zero: they declare the same heads and the same program as
their peers -- the scheduler sees one program -- and read nothing for
attn_qg, attn_k, attn_v and attn_output (rad_weight_shard_zero). Their
attention computes zeros from zeros and their output projection adds
exactly nothing to the reduce. Three ranks over two heads: attention on
ranks 0 and 1 exactly as the two-rank serve declares it, 12 heads, one
KV head, gqa 12, the same kernels; rank 2 zero. Five over two:
attention on four, rank 4 zero. Under a smaller attention world the even
shard over `world` is the wrong cut for every projection, so
rad_block_attn_gated_fp8.h declares spans -- q|gate rows and output
columns [attn_rank * n_head, +n_head) heads, k/v at kv_off -- the same
call the KV replication already used. When the attention world is the
world, every TP2 and TP4 deployment, nothing here is declared and the
block declares as it always did.

Uneven delta-net heads. The delta net has no KV-head constraint: its
kernels are bound on head widths and take any head count. 16 K heads
over three ranks are 6, 5 and 5, each rank's V heads the same multiple
(48 / 16 = 3: 18, 15, 15), every rank real heads. qwen4exp computes the
split and rad_block_gdn_fp8.h declares it as spans of the container's
rows: per-part for [q|k|v|z] and the conv channels (the parts are not
equal), one span for [a|b], A_log, dt_bias and the output columns.
LinearFP8 owns the scale plane's units (1/128 of the weight's rows for
block-fp8, the weight's own for int8 and bf16), so a block declares in
the weight's rows and the scale plane follows. The even split, when the
counts divide, is untouched.

The log says what the geometry did:
  world_size = 3 over n_head_kv = 2: attention on 2 rank(s), rank(s)
  2..2 carry zero attention weights and the delta net and experts of a
  full rank
  qwen4exp: rank 1 takes delta-net K heads [6, 11) of 16 and V heads
  [18, 33) of 48
2026-10-06 11:23:06 +02:00
baKon 82445ca71f format: a span per stacked part, and a share that is zeros
Two additive builder exports, RAD_ABI_VERSION untouched.

rad_weight_shard_span_parts: a row-sharded weight whose stacked parts
are not the same width -- the delta net's [q|k|v|z], 2048, 2048, 6144,
6144 rows on Flash-Next -- cannot take rad_weight_shard_span's one
[lo, hi), which is applied to every part and assumes them equal. This
takes a span per part together with each part's whole extent in the
container; share.cpp cuts every part by its own rows and refuses totals
that do not sum to the entry. It is how a rank declares an UNEVEN share
of the heads -- 6 of 16 K heads where three ranks take 6, 5 and 5 --
with nothing padded.

rad_weight_shard_zero: this rank's share of a row- or column-sharded
weight is zeros. weight_share returns the declaration's extents with no
rectangles; the loader stages the weight with a worker that writes
zeros (the route a checkpoint weight already takes from a container)
and reads nothing. It is for a rank the geometry gives no real heads
(next commit), which then declares the same program as its peers.

share_test holds the per-part cut and the zero share.
2026-10-06 11:23:06 +02:00
keptn42 1936bc881f hc_up: exact row groups up to eight, so a five- or six-row verify reads W_up once
hc_up_rg rounds the row group down to 8, 4, 2 or 1. The group exists so a
verify reads W_up once, but at MTP 4 or 5 (five or six rows) it splits into
4 + 1 or 4 + 2 and W_up is read twice. R4D_HC_RG_EXACT=1 makes a row count
up to eight one group of exactly that many rows; 3, 5, 6 and 7 are
instantiated as well. Only the loop nest changes, so the output is
bit-identical. Unset, the power-of-two rule as before. Flash-Next at tp 4,
MTP 4: 14.18 -> 13.32 ms a decode step.
2026-10-06 11:22:53 +02:00
keptn42 7843a3d400 moe_gemm_q decode form: the block's run in one round trip
A decode-form block finds its run by a chunked search: four to six
dependent L2 round trips and two barriers a chunk, paid also by blocks that
find nothing. R4D_MOE_RUNSCAN=1 loads the block's sorted rows and all
offsets in one batch, numbers the runs in expert order with a DPP scan, and
hands the run's bounds over LDS. Up to 512 experts; above that the chunked
search runs. Bit-identical, off by default. Flash-Next at tp 4 with UW and
RS: 36.9 -> 36.1 ms a step at 16 concurrent.
2026-10-06 11:22:43 +02:00
keptn42 6e14caaedd moe_gemm_q decode form: two K blocks a pass, and weight loads without serial waits
In the decode form every weight load is a flat_load through a table pointer
in VGPRs, and the waitcnt pass puts s_wait_loadcnt 0 in front of each, so a
pass's scale, activation and weight loads go out one after the other.
R4D_MOE_UWLOAD=1 makes the table entries uniform and reads them through
address_space(1), issues the scale loads unconditionally, and uses LDS
barriers in the K loop with one release fence for the prefetch: one wait a
pass. R4D_MOE_GU_FK256=1 (or =N, up to N routed rows) stages two 128-wide
K blocks a gate_up pass. Both bit-identical and off by default; the default
kernels are instruction-identical to before. r4d_selftest compares every
variant byte for byte.
2026-10-06 11:22:43 +02:00
keptn42 d7aa401568 hc_read PF2: a persistent up product and mix
Each wave keeps its 16 rows of d as twenty WMMA fragments (K = 320) and the
workgroup walks a run of channel blocks, with mix_up in fragment order so a
block's B is a 40 KB copy into LDS. R4D_HC_READ_PF2 5, 6 and 7 pair it with
the 64-row, the 128-row or the wide down product. Bit-identical. On gfx1201
it is slower than the 256-row tile of value 1.
2026-10-06 11:22:32 +02:00
keptn42 075dfefe54 hc_read: a second prefill form behind R4D_HC_READ_PF2
The wide prefill form reads h and builds N once per 128-column tile, three
times a call, decodes both E4M3 mixing matrices again in every row tile,
and launches the norm scales on their own. PF2 decodes the matrices once in
a prologue that also computes the norm scales in the same order, runs the
down product one workgroup per 64 rows over all columns with B straight
from WMMA fragment order, and the up product and mix at 256 rows.
R4D_HC_READ_PF2 picks 1 both halves, 2 or 3 one of them, 4 a 128-row down
product. Bit-identical to the wide and the decode tiles' forms; unset, as
before. At M = 2048: 711 -> 611 us a call.
2026-10-06 11:22:32 +02:00
keptn42 0eeee5bb3a router_gemm_topk_scatter: the router GEMM, its selection and its sort in one launch (R4D_ROUTER_FUSE
At decode every MoE layer launches the router GEMM, router_topk_scatter
after it, and the shared expert's gate. With R4D_ROUTER_FUSED=1 the last
workgroup of the router's skinny bf16 GEMM, named by a self-resetting
arrival counter, runs router_topk_scatter's body, and one more workgroup
computes the shared gate; =2 keeps the gate separate. Each logit is the
same split-K chain at the split the unfused GEMM's law picks, so the
outputs are byte-identical. Decode band only (M <= 64); unset, nothing new
is declared. Single stream: -0.8 % a step.
2026-10-06 09:13:58 +02:00
Deadcode d0f639bd06 radiance 1.0.13
- Faster prefill on models with an MTP head (Qwen3.8-Flash-Next, Qwen3.6-35B-A3B). Every prefill
  chunk but a prompt's last runs the head only to leave its K and V behind, and the head no
  longer runs its expert layer and lm_head for nothing on those chunks. Flash-Next on two R9700:
  +1.4% at 8K tokens, +3.2% at 26K, +5.9% at 78K; text and decode unchanged. From Code000's
  opt33.
- A request log at the info level: one line when a request is admitted (endpoint, peer, message
  and tool counts, prompt tokens, max_tokens), one when it ends (finish reason, cached prompt,
  generated and reasoning tokens, time to first token, decode rate), and every refusal with its
  status and peer -- a wrong API key included. No prompt text at info. (baKon)
- deploy/grafana: a dashboard for /metrics on Prometheus or VictoriaMetrics. (keptn42)
- Three-rank tensor parallelism for Qwen3.8-Flash-Next: the all-reduce and all-gather at three
  ranks, the vocabulary split by 128-row blocks where the world does not divide it, and
  tools/pad_tp.py to pad the checkpoint's head counts to a world of three -- docs/TP3.md.
  (baKon)
2026-10-05 20:50:29 +02:00
baKon 6b394ccca6 qwen4exp: the plugin owns the expert width split; geom_from does not refuse it first
geom_from divides n_ff by the world before the plugin's own split runs,
and 640 does not divide by 3. The plugin cuts the routed experts' width by
whole fp8 blocks and parity at any world up to the block count (1.0.8),
so the refusal is answered before it is asked. geom_from gains
arch_splits_ff (default off): with it, a width the world does not divide
is left whole in g.n_ff for the plugin to slice; a width that divides is
unaffected, and every other plugin keeps the refusal because for them
g.n_ff is the per-rank width. qwen4exp opts in.
2026-10-05 19:31:12 +02:00
baKon 2149a1a757 three ranks: pad the checkpoint, exactly, where the geometry does not divide
Radiance refuses a head count the world does not divide, by name, and
three is such a world for Qwen3.8-Flash-Next (24 q / 2 kv / GDN 16, 48).
Replication answers four ranks, not three. The answer at three is the
one tcclaviger's vLLM applies at load time: pad to 36 / 3 / 18 / 54 with
zero weights placed where a zero contributes nothing, so the padded model
computes what the original does. Radiance has no load-time pad, so this is
an offline tool and a document.

- tools/pad_tp.py: numpy-only, streams one tensor at a time, handles the
  Flash-Next fused q+gate head blocks and the GDN in_proj row orders,
  rewrites config.json. --sparse reflinks the original shards and writes
  only the padded tensors into shards that sort first, which the
  checkpoint reader's first-wins emplace then shadows: 6.6 GB of new
  bytes for a 336 GiB checkpoint.
- tools/pad_verify.py: every tensor read back -- untouched ones
  byte-identical, padded ones the source in place and zeros elsewhere.
- docs/TP3.md: what is padded and why each pad is exact, the tool, what
  the engine gained at three ranks, the serve line, measurements on three
  R9700s against the shipped two-rank container.
- README: the three-rank row and the document.
2026-10-05 19:31:12 +02:00
baKon 72947681c3 vocab edges at a world that does not divide them: block-aligned split, declared as a span
token_embd / output are RAD_SHARD_ROW; at three ranks 248320 rows do not
divide, and share.cpp refuses a row shard without a declared span.
qwen4exp now declares [vocab_off, vocab_off + n_vocab) for both. The split
rule (rad_arch.h shard_extent/shard_begin, restated in core/engine.cpp)
keeps the even share whenever the world divides the vocabulary -- two and
four ranks are untouched -- and only otherwise rounds the per-rank count
up to a 128-row block, because a block-scaled fp8 head refuses a cut
inside a tile: at three the ranks take 82816, 82816, 82688.
2026-10-05 19:31:12 +02:00
baKon b60e329d93 libr4d: all-reduce and all-gather at three ranks
Instantiate the wide one-shot all-reduce at WS=3 and add an all-gather on the
wide transport (ar_gather_3rank), with dispatch rows for world_size 3, so a
three-card box resolves 'all_reduce' and the vocab-parallel sampler's
'all_gather'. The two-shot is not instantiated at 3: it shards the message
world ways and the residual width does not divide. Selftest: 3-rank sum,
block-count sweep and both gather placements (skipped on fewer than 3 cards).

Local lab build on top of 1.0.3 (f487864); not submitted upstream.

(cherry picked from commit a76f2ab66500b9a7711b8f52abbf48eb88758359)
2026-10-05 19:31:12 +02:00
keptn42 709d9beb1b deploy/grafana: screenshots for the README
The overview row and the whole dashboard over one hour of a four-rank Qwen3.8-Flash-Next server, 256 colours, 39 KB and 209 KB.
2026-10-05 19:30:59 +02:00
keptn42 41c0d25233 deploy/grafana: a dashboard for /metrics, on Prometheus or VictoriaMetrics
Throughput, prompt tokens by source, speculative decoding by draft
position, scheduler steps, latency, prefix cache and HTTP, from both
metric families. Plain PromQL, so the same JSON runs on Prometheus and on
VictoriaMetrics. Window ratios are counter ratios with the definitions of
the since-start gauges; conditional acceptance at position j in a window
is reached(j+1) / reached(j).

GUIDE: draft_position_acceptance_ratio is cumulative since start
(draft.h), and the dashboard is named under §6.3.
2026-10-05 19:30:59 +02:00
baKon ee65352d7d server: a request log at the info level
docker logs answered nothing about traffic: the only lines the server
wrote on a request were the kernel recordings, and a refusal left no
trace at all, so a client reporting "rejected" could not be matched to
anything. Two lines per request now, at info: one when it is admitted
(id, endpoint, peer, model, message and tool counts, prompt tokens, n,
max_tokens) and one from record() when it ends (finish reason, prompt
tokens and what the prefix cache spared, generated and reasoning
tokens, time to first token, decode rate, wall). Every refusal logs its
status, type and message with the peer -- 4xx at info, 5xx as a
warning. The debug level adds the last user message's opening, one
bounded line, so a log line can be matched to what was typed; the
daily's info level never prints prompt text.

HttpRequest carries the peer (httplib's remote_addr:port; empty
in-process), OaiRequest carries what the parse already walked past
(message and tool counts, the last user message) and the peer.

(cherry picked from commit 067facd47e2b0c0afeefe79166e77f01c33d588f)
2026-10-05 19:30:45 +02:00
Deadcode a4845834ea radiance 1.0.12
- Wrong answers under concurrency on models with gated delta net layers (Qwen3.8-Flash-Next,
  Qwen3.8-27B, Qwen3.6-35B-A3B). A conv state slot was one entry wider in the allocation than in
  the state the kernels index, so clearing the slot a newly admitted request was given -- and a
  prefix-cache checkpoint's save and restore -- reached into the next request's conv and n-gram
  windows. A request decoding beside an admission then lost part of its recent context: a right
  first token followed by a context-free continuation ("1. **Identify the numbers..." for "What
  is 65 times 3?"), repeated or skipped digits. A single request was never affected. One
  definition of the slot now, and the server refuses to start if the allocation and the kernels
  ever disagree on it. Present since 1.0.0; reported with a strict concurrent sanity check.
- --num-speculative-tokens 0 no longer stops the engine at the first multi-sequence decode step:
  an all-reduce argument struct's padding was uninitialised, and a recorded pass's audit read it
  as a changed argument.
2026-10-05 18:27:23 +02:00
Deadcode 469441d90f radiance 1.0.11
- The n-gram embedding table (Qwen3.8-Flash-Next's per-layer embedding) can be gathered on the
  card. libr4d gains a row for embed_lookup_q whose output is the host gather's to the bit, and
  --ngram-placement uses it: ram keeps a pinned copy in RAM that the cards read in place over the
  link, so a step has no host work in it; vram puts the whole table on every card that holds it;
  disk reads it from the container on the host, as before. auto takes the first of the three that
  holds the table and prints why it passed over the others. Without a device kernel for the gather,
  ram is the locked copy the host gather reads and vram is refused, as in 1.0.10.
- The pinned copy is not charged to RLIMIT_MEMLOCK; the host gather's locked copy still is, so
  --ulimit memlock=-1 matters only on a run without the cards.
- The idea and a first kernel for the device gather came from Code000.
2026-10-05 16:34:37 +02:00
Deadcode e466fa07e2 radiance 1.0.10
- 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.
2026-10-05 14:01:30 +02:00