Commit Graph
710 Commits
Author SHA1 Message Date
mici81andClaude Opus 5.5 49ca5ff9c6 libr4d decode split law: size a three-wave verify by the step's depth
The full-attention decode law gives a three-wave workgroup (q_len * gqa > 32,
an 8-row DFlash2 verify at gqa 6) 128 / units segments whatever the depth.
Three to seven sequences of Qwen3.8-27B (two KV heads a rank) then get 21..9
segments, each walking 4-18k tokens at depth, and one or two sequences stay
at 64 / 32 where 256 / 128 are faster.

The law now reads the step's depth from the block table's width (max_blocks *
block_size, capped at max_ctx; the scheduler rounds the width to the batch's
longest sequence): up to 16k tokens 128 / units as before, past 16k at least
64, past 64k 512 / units capped at 256. Declare passes no table, so the
scratch is still sized at the declared bound, the deepest the law can be
asked for; the law grows with depth, so an issue never needs more.

Qwen3.8-27B MXFP4 + DFlash2 at TP2 on 2x R9700, k6_v4, speculation 7, ms a
decode step against this main:

  x1  90k 22.07 -> 22.03   180k 25.35 -> 24.88
  x2  90k 26.83 -> 26.36   180k 33.18 -> 31.99
  x3                       180k 42.41 -> 40.33
  x4  90k 36.20 -> 34.96

Steps whose count does not change (1k x1..x8, the short block at 16k x16) are
within noise. Greedy output is identical (300 tokens, two prompts). The forced
segment sweeps behind the thresholds are in the comment.

r4d_selftest: decode_split_law_case reads the law through the decode scratch
hook's declare path, 21 batches across the depth thresholds.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-29 09:25:09 +01:00
Adam Zhang 4374bea1c4 hc_read: the one-grid form's wait traps past its deadline instead of reading a stale d
hc_role_wait, where hc_read_fused_kernel's B blocks wait for every A block, gave up after half a
second and went on, so a counter fault would have read a stale `d` and its scales and written
wrong values with no error. The all-reduce handshakes trap on the same condition (r4d_ar_seq.h,
r4d_ar_oneshot_2rank_exact.hip: a handshake that cannot complete is a lockstep violation); this
does the same. It cannot fire with the counters in order (each launch's last B block clears
them), so nothing that runs today changes.

libr4d/isa/res.sh: no hc kernel spills, hc_read_fused_kernel 126-147 VGPRs.
r4d_selftest --case hc_read_e4m3 and hc_read_bf16 on 890715f: 67 ok, 0 FAIL, the 24 byte-for-byte
comparisons against the previous decode kernels among them. --perfhc 4: 25.4 us a call (the
previous decode kernels 34.6), as before the change.
2026-10-28 08:16:28 -05:00
Asim Siddiqui 890715fd96 libr3d: the wave-matrix record -- the six 16x16x16 variants, the MAC-core measurement, the i8-x4 gap
RDNA3's ISA lists exactly six wave-matrix instructions (f16, bf16, int8 and
int4 in; f32, f16, bf16 and i32 accumulating) and the toolchain emits them on
every gfx11 target; they run over multiple cycles driving the DOT pipeline
internally, and the MAC-core measurement on the 16-CU gfx1102 part confirms
it: f32-acc f16 19.11, f32-acc bf16 19.24, f16-acc f16 19.44, i32-acc i8
19.29 against the paired dot2 path's 18.86 TFLOP/s -- the same pipe within
three percent, matching the full-kernel 1.99-vs-1.97 already in r3d_common.h.
The i32-acc i4 tile is the exception at 25.68 TFLOP/s, 35% above, but it takes
i4 in both operands and the grids served here pair i8 activations against i4
and i2 weights: there is no mixed-precision integer WMMA on RDNA3, so that
pipe is unreachable from the w4a8 and w2a8 rows.

Commentary only -- the rationale passages in the README, CMakeLists.txt,
r3d_rows.cpp, r3d_plugin.h and r3d_selftest.cpp now state the measured
record; no kernel, lane map or numeric path changes, and the rebuilt library
is byte-identical (selftest 78 rows, 0 failed, 0 skipped).
2026-10-28 13:51:45 +01:00
Asim Siddiqui 6cb9826975 libr3d: the gfx11 (RDNA3) kernel library
A complete row set for the gfx11 family (1100/1101/1102/1103/1150/1151 plus gfx11-generic),
mirroring libr4d's structure: the quantised GEMM rows (m16, tiled, gated, the bf16 logits
gemm), the paged and ragged attention for decode and prefill, the KV store, the sampler
spine and the spec rows, with the recorded-fixture, board, selftest and comparison-driver
gates for each.

The gates are the record. Every row is measured against libref on the shape matrix: the
recorded fixture at 1153 cases with worst rel_l2 1.362e-03, the board's five modes with
bit-identical decision lines, the selftest at 74 rows, and the 233-case served-shape pairing
at 0 divergent against the tree libref. End-to-end on a 2B fp8 checkpoint served on the
card, coherent through prefix-cache adoption.

Two platform laws each shape the design. A kernel that calls device printf takes the
implicit hidden_hostcall_buffer argument and is undispatchable by the AQL backend, so the
trace records are plain stores behind a budget. And a plugin-owned __device__ global is not
a channel into the engine's dispatch path: in a dlopened plugin the runtime's symbol stub
is not the address the kernel's module writes, so the served trace channel is a hipMalloc'd
record slot passed as a kernel argument, with the device-global ring kept for the board.

kv_store bounds its slots at the pool's own plane (n_blocks x block_size), the span the
cache operand declares, not at the step's own span: a request that adopts a cached prefix
writes its new tokens at the allocator's global block indices, which sit past any bound
built from the step's token count, and a slot lost there is KV that attention then reads
stale. A corrupt slot map is dropped at the same bound.
2026-10-28 13:51:45 +01:00
baKon 1ffa770901 docs: deepseek41-hf-direct, the release converts without a GGUF intermediate 2026-10-28 13:50:16 +01:00
baKon b64b0de7de convert: --chat-template, bake a template a release ships none of
DeepSeek's release carries no chat_template.jinja and its tokenizer_config.json
names none, so an HF-direct container answers /v1/chat/completions with 501
unless the serve passes --override-chat-template. The converter now takes the
template itself and bakes it into the vocab section, overriding whatever the
checkpoint carried or lacked. Trailing newlines are stripped as for a sibling
chat_template.jinja, and an unreadable or empty file is refused rather than
skipped. Both paths are covered: text_test reads the file, convert_test
converts the tiny checkpoint and reads the template back out of the container.

(cherry picked from commit 6381f61794cd61d1f86925fd23ea61e1b1544dfe)
2026-10-28 13:50:16 +01:00
baKon 73bee2dcc2 data: the DeepSeek-V4.1 release's Engram tables and fused imatrix, from the release alone
engram_tables.py builds the Engram hash tables from the release's own tokenizer.json
and config.json, so rad-convert needs no llama.cpp converter run; imatrix_merge.py
fuses the gate/up imatrix entries llama.cpp's converter writes split, matching the
plugin's fused ffn_gate_up weights. The recipe is the UD-IQ1_S mix for the official
release (251.07 GiB plan).
2026-10-28 13:50:16 +01:00
Adam Zhang 11076c06fc hc_read: the previous decode kernels behind r4d_hc_read_pin_decode, compared byte for byte
The one-grid form and the pipelined tiled up-mix replaced hc_read_a_kernel, hc_up_mix_kernel and
hc_up_mix_tiled_kernel in place. Their previous forms are kept verbatim as *_prev, with
hc_up_mix_prev_launch launching the up-mix as before, and r4d_hc_read_pin_decode(1) selects them:
kernel A, then the up-mix in a second launch, and the tiled up-mix's K passes in sequence. 0, the
default, is the launcher's rule.

r4d_selftest's hc_decode_forms runs both on the same inputs on a real stream at 1 to 7 rows (each
one-grid instantiation), 8, 16, 32, 33 and 64 (the tiled up-mix at both row tiles), with E4M3 and
int8 codes, and compares x, the injected gains, the codes, their scales and the rotated twin byte
for byte. The two forms must dispatch different kernels (r4d_record_dispatches), so an ignored pin
fails: with the hook made a no-op, all 24 checks fail. For that the tiled up-mix now launches
through r4d_emit, so the dispatch log sees it. --perfhc times both under the launcher's prefill rule.

--perfhc M, cold (256 MiB through the caches), one R9700 at 240 W, three runs, medians, previous
-> rule: 1 row 32.3 -> 22.5 us (-30.3 %), 4 rows 34.8 -> 25.4 (-27.0 %), 8 rows 46.2 -> 43.3
(-6.3 %), 32 rows 51.1 -> 48.4 (-5.3 %). r4d_selftest --case hc_read_e4m3: 62 ok, 0 FAIL (24 of
them the new comparisons); hc_read_bf16: 5 ok.

libr4d/isa/res.sh: no hc kernel spills or uses scratch (195 kernels). hc_read_fused_kernel takes
126 to 147 VGPRs (9 or 10 waves). The pipelined tiled up-mix at its 32-row E4M3 tile takes 111
VGPRs where the previous one took 75 (12 waves a SIMD against 16), and is the faster of the two at
8 to 32 rows as measured above.
2026-10-28 13:48:43 +01:00
Adam Zhang 222cbe7981 hc_read: the tiled up-mix pipelined, its loads in flight across LDS-only barriers (51.4 -> 48.4 us at 32 rows)
At 8 to 32 rows (two to eight streams at MTP 3) the up product with the mix ran its five K passes
as loads, barrier, WMMA, one after another. Its K loop now issues a pass's loads before staging
the previous pass from registers, with the mix's operands loaded alongside the first pass. The
barriers there order LDS only (hc_lds_barrier): __syncthreads() fences at workgroup scope, which
on gfx12 in WGP mode waits for every outstanding global load, so no prefetch survived it. The
quantise tail reads each thread's channels once, where it walked them a dependent load at a time.

Same fragments through the same WMMAs in the same K order, and the same tail arithmetic: the
output is bit-identical (compared byte for byte against the previous kernels in this series' last
commit).

r4d_selftest --perfhc M, cold, one R9700 at 240 W, three alternating rounds against 6c33ee4,
medians: 8 / 16 / 32 rows 46.6 / 47.8 / 51.4 -> 43.9 / 44.3 / 48.4 us (-5.8 / -7.3 / -5.8 %).
r4d_selftest --case hc_read_e4m3 and hc_read_bf16: 43 ok, 0 FAIL.
2026-10-28 13:48:43 +01:00
Adam Zhang c896a870ed hc_read: kernels A and B as one grid at decode, their dots off LDS round trips (34.7 -> 25.2 us at 4 rows)
At one to seven rows hc_read is a chain of dependent latencies, not a stream of bytes: kernel A
is mostly its norm prologue and the L2 round trips around its dots, with memory idle meanwhile,
and kernel B cannot ask for W_up until A has ended. At Qwen3.8-Flash-Next's shape (hc 4, n 2560):

- A and B run as one grid (hc_read_fused_kernel), roles by ticket: a block's first act is an
  atomic increment, tickets below `na` run A's body, the rest B's. A B block loads its W_up rows,
  then waits until every A block is done. Every block holding a smaller ticket has started, so
  the blocks it waits on are resident: no co-residency is assumed and none can deadlock. The last
  B block past the wait clears the counters for the next launch on the stream (kHcSyncCtr more
  words in the per-stream counter block), and a wait past half a second gives up rather than hang
  the card. Without the counters the two kernels run as before.
- A's norm prologue loads all of a thread's h and norm gain at once, one round trip for ten.
- B's dot reads d from LDS as bf16, sixteen values in two 16-byte reads, two rows of W_up a thread.
- At four rows a wave computes its two W_down columns in one pass over N (hc8_dot_down2).
- Dynamic LDS starts 16-byte aligned: the fused kernel's static LDS is not a multiple of 16, and
  misaligned N reads ran A three times slower.
- The quantise tail reads its group once instead of three times.

Every sum is the same fmaf sequence in the same order, so the output is bit-identical; this
series' last commit keeps the previous decode kernels behind a pin and r4d_selftest compares the
two byte for byte. Eight or more rows keep the tiled path.

r4d_selftest --perfhc M, cold (256 MiB through the caches), one R9700 at 240 W, three alternating
rounds against 6c33ee4, medians: 1 / 2 / 4 rows 32.7 / 33.2 / 34.7 -> 22.8 / 23.6 / 25.2 us
(-30 / -29 / -27 %); 8 and 32 rows unchanged. r4d_selftest --case hc_read_e4m3 and hc_read_bf16:
43 ok, 0 FAIL.
2026-10-28 13:48:43 +01:00
Adam Zhang fe2b8cd7fe r4d_selftest: --perfhc times the prefill-tile forms a row count is served by
Pinned at 8 rows up to the wide row tile, the wide kernels refuse the shape (RAD_E_SHAPE: they
serve only the wide tile), and --perfhc stopped at that FAIL before timing anything, so hc_read
could not be timed at a verify step's 8 to 32 rows (two to eight streams at MTP 3). A pinned form
that refuses with RAD_E_SHAPE is now a skip; the forms that serve run, compare byte for byte and
time as before. The decode tiles' kernels, the first form, must still serve, and any other error
fails as before.

--perfhc 8 / 32 / 64, cold, one R9700: the decode tiles' kernels 46.5 / 51.2 / 81.0 us a call,
where each stopped at the FAIL before.
2026-10-28 13:48:43 +01:00
Adam Zhang 14e91c4d9f gemm_fp8a8: the narrow form's scales staged through LDS and its split finisher coalesced (Flash-Next int8 at 32 rows 83.6 -> 68.3 us)
Two costs in gemm_fp8a8_body, which every fp8 and int8 linear at 64 rows or fewer runs
(gemm_fp8a8_nt_m16, gemm_i8a8_nt_m16, the bias and gated rows, and r4dchain_gemm_fp8a8):

- The fold loaded its weight and activation scales itself, after the next K tile's prefetch had
  been issued. Loads return in order, so each fold waited for that whole prefetch, twice a tile at
  FK 256, and the "one tile ahead" overlapped nothing. The scales are now staged through LDS a
  tile ahead, beside the B tile: each thread loads one weight-scale dword and one activation scale
  with its B prefetch and stores them with the B tile, so a fold reads LDS. Two registers a
  thread; holding a tile's scales a lane (8 + 2*NT registers) spilled at the decode pins.
- The split-K finisher walked the partial planes token index fastest, `rows` floats apart, one
  element a thread: a cache line a load and a round trip each, most of a 45 us call at N 512,
  M 64. Consecutive threads now take consecutive weight rows, four rows a 16-byte load and four
  loads in flight a plane; a shape off that alignment walks the rows fastest an element at a time.

The int8 single-tile wave pin goes from 12 to 10: the staged form needs a few more registers than
12 waves' 120 leave, gfx12 allocates them 24 at a time so 11 waves leave 120 too, and no decode
shape puts more than 8 of these waves on a SIMD. The gated three-tile form, at 8 waves since the
previous commit, spills 10 at 33-47 rows and 9 at 48 with the staging (0 and 7 without; at 9 waves
it would spill 70).

The same values are summed in the same order (each finished element from 0.0f in ascending split
index, rounded by the same rule) through the same WMMAs in the same K order: bit-identical. A dead
wave's fp8 block scale reads 0 instead of the plane row past the end; its rows are never stored.
A full r4d_selftest in 6c33ee4 and here, every launch of a gemm_fp8a8* or gemm_i8a8* row hashed
after it: 975 of 975 identical (829 gemm_fp8a8_nt_m16, 42 gated, 18 gemm_i8a8_nt_m16, 5 bias).
Greedy replies on Qwen3.8-Flash-Next (int8) and Qwen3.8-27B FP8 byte-identical to 6c33ee4's.

r4d_selftest --perfw8 / --perf at every narrow-GEMM shape of the two models at tp 2, cold
(256 MiB), one R9700 at 240 W, alternating rounds against 6c33ee4, medians, summed over each
model's ops at 1 / 8 / 32 / 48 / 64 rows: Flash-Next int8 61.7 / 64.2 / 83.6 / 111.9 / 130.9 ->
56.8 / 57.0 / 68.3 / 87.5 / 95.7 us, 27B FP8 411.0 / 411.9 / 427.2 / 446.3 / 485.4 -> 404.6 /
405.4 / 415.0 / 428.5 / 438.7 us. Most at narrow N, where the finisher dominated: fp8 512 x 5120
at 64 rows 53.2 -> 15.4 us, int8 256 x 2560 at 48 rows 21.0 -> 8.5 us. The gated row at 27B's
gate_up against the previous commit: 1.3-3.4 % faster at 8-32 and 48-64 rows, 1.8-2.3 % slower
at 33-47 (176.8 -> 180.2 us at 40), where the staging's spills cost more than its overlap gains;
against 6c33ee4, 3.5 % faster there. Decode step at tp 2, old / new / old: Flash-Next 15.76 /
15.69 / 15.76 ms, 27B FP8 28.02 / 27.69 / 28.04 ms.
2026-10-28 13:48:23 +01:00
Adam Zhang 3efb37254b gemm_fp8a8: the gated three-tile form pinned at 8 waves (gate_up at 48 rows 272.9 -> 180.6 us)
The gated row at 33 to 48 rows (NT 3, MW 16) was pinned at 9 waves, 168 registers, where its
epilogue spilled: 57 registers at the full tile (48 rows) and 10 below it (12 and 59 in its
chained twin). At Qwen3.8-27B FP8's gate_up at tp 2 (N 17408, K 5120) 48 rows took 272.9 us
against 180.6 at 56. The gated form is always MW 16, so a block puts four waves on each SIMD, and
8 and 9 waves both hold two blocks a WGP: at 8 the form gets 192 registers for no occupancy, and
spills 7 at 48 rows and none below. f8_waves takes the gated flag (false by default), so no other
form's pin moves.

A pin changes register allocation only. r4d_selftest --case dequant_w4_bf16 (fp8_numeric, which
checks the gated row byte for byte against the GEMM + gated_quant_fp8 pair at every M it runs),
every launch of an fp8 narrow GEMM row hashed after it in 6c33ee4 and here: 879 of 879 identical,
42 of them gated; 1,526 ok, 0 FAIL.

r4d_selftest --perf 17408 5120 M, cold, one R9700 at 240 W, five alternating rounds against
6c33ee4, medians: 48 rows 272.9 -> 180.6 us (-33.8 %), 33 to 47 rows 186.2-187.6 -> 175.9-177.1
(-5.5 %), 8 to 32 and 56 to 64 rows within 0.3 %.
2026-10-28 13:48:23 +01:00
Adam Zhang 14b8f21a1a r4d_selftest: --perf times the gated row at a gate_up shape
--perf N K M timed gemm_fp8a8_nt_m16 and the tiled row but not gemm_fp8a8_gated_nt_m16, the
engine's gate_up at every fp8 SwiGLU model, so that row had no timing. At N % 256 == 0,
K % 256 == 0 and M <= 64 it is now timed with the others, N being the gate and up rows together
as the engine fuses them; a shape the split rule would split is reported as not served. At
Qwen3.8-27B FP8's gate_up at tp 2 (N 17408, K 5120) on 6c33ee4, one R9700 at 240 W, cold:
157.1 us at 8 rows, 164.3 at 32, 186.7 at 40, 271.8 at 48, 180.3 at 56.
2026-10-28 13:48:23 +01:00
baKon 662b7720b5 core/sched: a prefix hit resumes on the cold run's chunk grid, so it recomputes the cold run's own chunks
A hit recomputes the tokens past where it resumes. Kernels may round a row differently at another
chunk length (spec §17: the fp8 GEMM's split-K count is chosen from M), so a hit that recomputes
its tail in other chunks than a cold prefill of the same prompt can flip a near-tie in greedy text.
On the DeepSeek-V4.1 daily (TP4) a 24k-token prompt that hit a 16k one's tail snapshot resumed at
15856, ran a 528-token chunk to the next boundary and answered differently from its cold run.

--prefix-resume exact, the default:

- ChunkGeometry carries the grid an idle server's cold prefill chunks on: --max-num-batched-tokens
  rounded down to the quantum, or the checkpoint interval where chunks split at it and it is the
  smaller, times the span from the second interval on.
- plan_chunk writes checkpoints only on that grid. A prompt's tail snapshot is taken where its last
  chunk starts (sliding-window snapshots keep their one-block margin) instead of at its last
  quantum boundary. The chunk already ends there, so a long cold prompt no longer runs a short
  extra step at its end.
- A checkpoint interval past the chunk must be a multiple of it; otherwise it is rounded up, and
  startup says so.
- admit_one steps a hit with no snapshot to resume from (full attention) back to the grid. A
  request's own checkpoint (Request::checkpoint_at, /v1/systemone's shared head) is honored where
  it falls.

--prefix-resume nearest keeps the previous rule.

The cost is re-prefill: an exact repeat runs the cold run's last chunk again, and an agent's next
turn resumes where the previous prompt's last chunk started, about half a chunk more than nearest
(2048 tokens at a 4096-token budget). The property holds on an idle server; a prefill that shares
its steps with decode rows or other requests (--busy-prefill-chunk, --prefill-interleave) is cut
differently, as batching already changes greedy text.

Tests: sched_test covers the grid for six geometries (GDN hybrid, interval past the budget, span,
periodic and tip-only window snapshots, full attention), the interval rounding, the tail snapshot
at the last chunk start, admission stepping back to the grid, and a property over prompt lengths:
every checkpoint is a chunk start of the cold run of its prompt and of any longer prompt it
prefixes, and a hit from it cuts the cold run's chunks. config_test covers the flag.
2026-10-28 12:50:54 +01:00
baKon f43929ccb8 core/mem, core/sched: a prefix hit on a model whose KV groups have different block sizes, and a hybrid's window in the checkpoint slot
DeepSeek-V4.1 declares its compressed attention at one KV row per r tokens: kv_index_r2 and
kv_compressed_r2 at 2-token blocks, kv_index_r1 and kv_compressed_r1 at 1-token blocks, beside a
16-token sliding window (kv_window), a linear compressor state (kv_comp_tail_r2) and a conv window
(kv_engram_tokens). On that model no request ever reused a token, for two reasons:

- PrefixCache::configure took the first full group's block size as its granularity and left every
  paged group with another block size out ("block 1 != cache granularity 2: not cached").
- KVManager put a trunk's window in the checkpoint slot only on a model without linear state, and
  the scheduler refuses a hit that leaves a trunk group uncovered. With linear state beside the
  window, every hit was zeroed (HitCut::Window).

Either alone leaves the hit at zero. On an agent's growing conversation that is the whole context
prefilled again every turn.

The cache now holds every paged group but a windowed one. An entry covers the lcm of their block
sizes and holds lcm / B blocks of a group with B-token blocks (PrefixCache::entry_groups,
blocks_per_entry). A lookup hands each group its own blocks for adopt(); insert, eviction, trim,
rebind, restore_room, release_session and unshared_tokens count per block; trim() and trim_for()
count entries. The chunk quantum is already a multiple of every paged group's block, so
checkpoints and hits stay on the entry grid. With equal block sizes an entry is one block a group,
as before.

A trunk's window rides in the checkpoint slot whether or not linear state is beside it; the slot is
the state, then the window pages, the layout KVManager::checkpoint_copy already walked. The
scheduler lets a hit stand on a windowed trunk group when it resumes at a window snapshot
(win_hit no longer needs a model without linear state); any other trunk group the cache does not
hold refuses the hit, as before. The reserve's trim asks for entries, from the group furthest
short. The idle tiers move an entry as its blocks: TierExec and the slot layout take
entry_groups(), where a group appears once for each block it holds in an entry, and the VRAM
estimate counts the same.

No plugin on main has a window beside linear state or paged groups of different block sizes, so
every model here keeps its cache and slot as they were. DeepSeek-V4.1 (#266) has both; its slot
grows by the window's pages (10 blocks of kv_window, 6.25 MiB a rank at TP4).

Tests: mem_test -- an entry at the lcm over block sizes 2/1, 2/4 and 16/2 (lookup blocks, adopt,
refcounts, eviction and trim in entries, restore_room, unshared_tokens), a publish short of one
group's blocks refused and unwound, checkpoints on the entry grid (and the binding's key), an
interval off the grid refused, a hybrid with a window and mixed blocks, an entry over mixed block
sizes through the host tier byte for byte (one to three ranks, replicated beside zero), and a
checkpoint carrying linear state and the window together; the window-snapshot rule's test now
expects the window beside linear state. sched_test -- a hit on a hybrid whose slot carries the
window resumes at the snapshot, a trunk group neither cached nor in the slot refuses the hit, a
hit over mixed block sizes adopts each group's own blocks, and the reserve trim asks for entries.
2026-10-28 12:50:54 +01:00
NunzeandClaude Opus 5.5 64c3dc9893 libr4d: the gdn conv kernels read an f32 weight -- a GGUF ships ssm_conv1d in f32
llama.cpp keeps a Gated DeltaNet's ssm_conv1d unquantised, in f32, and a container converted from
a GGUF holds it so. The three kernels that read the convolution weight, gdn_conv_prep,
gdn_conv_update and the convolution gdn_conv_recurrent_update folds in, read bf16, so their shims
refuse an f32 weight. The weight's element type is now a template parameter of all three.
r4d_gdn_conv_tap.h, which already holds the arithmetic the fold shares with the standalone path,
gives the vector a channel's taps are loaded as (ushort4 or float4) and the widening of one tap,
exact for either type. The shims take a bf16 or an f32 weight and pick the instance by its dtype;
any other dtype is still refused.

The raw entry points keep their signatures. r4d.h gets an f32 twin of each standalone one,
r4d_gdn_conv_prep_w4_h128_bf16_f32wgt and r4d_gdn_conv_update_w4_h128_bf16_f32wgt, rather than a
flag, so no caller of the bf16 ones changes. The fold has no raw entry point; its CV parameter now
also says the weight's type (1 bf16, 2 f32), which leaves every existing instance's template
arguments and name as they were. That is twelve new conv instances and sixteen new fold ones.

The bf16 instances compile to the same code. Built before and after with the build's flags, all
116 kernels of the two units have the same instructions, resource counts and metadata; only the
conv kernels' names change with the added template argument. The bf16 reads keep their shape:
widening gdn_conv_update's ushort4 to a float4 before use reorders its loads. The f32 conv
instances use no scratch, conv_prep 56 to 57 VGPRs (53 at bf16) and conv_update 108 (96 at bf16,
12 waves per SIMD instead of 16); each f32 fold instance has exactly its bf16 twin's counts.

r4d_selftest gets three cases for the card. gdn_conv_prep and gdn_conv_update over an f32 weight
holding bf16's values must write the bytes they write over the bf16 weight: q, k and v, g and beta
at prefill, and the conv state. The sequences are uneven; at prefill two are seeded from their
cache, one of them over two chunks, and a one-token one is not. Outputs are poisoned, the cache
must move and an f16 weight must be refused. The fold over the f32 weight must match the pair
over the bf16 one, byte for byte as the fold already does at bf16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 12:49:37 +01:00
NunzeandClaude Opus 5.5 d73abc28d5 libr4d: the dense integer rows take the group they compute -- a Q8_0 weight at group 32 was read as 128
The dense integer kernels compile their group in and read no `group` argument, and neither the
rows nor the layout hooks checked it: w8_enc_layout accepted an `i8*f16[1x32]` weight (a Q8_0
block) at group 32 and the kernel computed it at 128. The twelve dense gemm_nt_q rows now carry
C_EQ("group", ...), and the four hooks (w4, w5, w8, w2a8) answer RAD_E_DTYPE at any other group,
the one code select() counts as a refusal. relayout_parity_test pins the hooks, plugin_test the
rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 12:49:18 +01:00
NunzeandClaude Opus 5.5 385318f81a core/format, tools: GGUF Q8_0, Q4_K and Q6_K tensors import as their planes -- rad-convert writes them without a recipe
A GGUF tensor of block type Q8_0, Q4_K or Q6_K could only be dequantised, so rad-convert reached it
through a recipe rule and re-quantised what was already quantised. ckpt_resolve now states the
planes libquant's ggml quantiser writes for the same blocks and marks the weight imported, and
ckpt_plane_rows splits each row's blocks into them bit for bit. The split is
core/format/ggml_planes.h, the reader's copy of lq_ggml's unpack functions, since the core cannot
call libquant; a type there is one table row, its planes and its split. Pieces of one block type
joined along rows import, an expert's slices of a stacked tensor included; mixed types and column
joins keep a GGUF reason.

The weight is not trivial, so the loader refuses it with the hint to serve the container
rad-convert writes, and ckpt_rows_f32 still dequantises it for a recipe. A rule that declines such
a weight is an error in rad-convert, since keeping its planes would hide that the rule did not
apply (spec.md §4.4).

Tests: quant_ggml_test holds every type of the reader's table to the quantiser's encoding,
checkpoint_test decodes the planes of Q8_0, Q4_K (one-block rows and a row join) and Q6_K against
the block definition and holds an expert's gate|up, two slices of stacked Q4_K tensors, to the same
blocks stored on their own, and convert_test runs a declining rule over a Q8_0 tensor, with the
GGUF writer moved to tests/gguf_writer.h for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 12:48:13 +01:00
baKon 6f034d989f config: list the decode-hot options and spell --draft-expert-placement as a word 2026-10-28 12:40:47 +01:00
baKon 6b544e0d39 core/place: --draft-expert-placement host and --expert-profile/--expert-pin-top (decode-hot residency) 2026-10-28 12:40:47 +01:00
Alex 9f707a0f67 driver+server: keyframes ride a latent upscale -- pinned at the small size, then re-encoded at the full size
A keyframe is pinned on the grid the steps run on, which is why 7935897 refused it with
latent_upscale. The pin can follow the switch instead: the server prepares each keyframe at the
small size too, the same way as at the canvas (stretch or centre crop), and the driver encodes
that picture into the keyframe's slot before the prompt pass, runs the small steps on the pack it
already lays out at the small size, and after the VUPSCALE pass encodes the canvas picture into
the same slot before the first full-size evaluation. The plugin reads its slots as before, so
neither the plugin nor the ABI changes; rad_builder.h documents the order. References keep their
own grids and are encoded once, as before.

Host: video_gen_test checks the pass order (E C S S U E S A D), each encode's size and slot and the
step rows at both sizes, and that a keyframe without its small picture is refused; videos_test
checks that each keyframe is prepared at both sizes with its stretch/crop and that the tower still
sees the canvas frame only. GUIDE, the ComfyUI node's README and tooltip no longer say keyframes
refuse latent_upscale.
2026-10-28 12:37:10 +01:00
mici81andClaude Opus 5.5 812cdeceb0 gemma3 + libr4d: the fused all-reduce junction on the lossy wire, for rows of whole 64-element groups
Under --tp-wire wht6 a TranslateGemma step of 2-3 sequences (16-24 rows) sent its junction as
three launches (the standalone lossy all_reduce, rmsnorm, rmsnorm_quant_fp8): the fused
ar_rmsnorm_post_quant_fp8 sent the exact wire only, and the compressed fused form needed a row of
whole 512-element chunks, which Gemma 3 27B's 5376 is not (10.5).

- r4d_fused_quant_fp8.hip: a row of whole 64-element groups that is not whole chunks ends in a
  partial chunk whose missing groups go out as zeros and are not stored back. Every real group is
  the same 64 elements as in the flat message, so its bytes and the sum are the standalone wire's.
  The (row, chunk) mapping is a template parameter (PAD, wire 6 only), so a row of whole chunks
  (Qwen3.8's 5120) runs exactly the code it ran before; as a runtime branch it cost a Qwen3.8 x4
  step 1.3-1.6 %. POST (the sandwich post-norm) on either wire.
- r4d_ar_entry.hip: K % 64 instead of K % 512 for wire 6, a size check of the padded message
  against the slot and the local pack, and the local pack's scale region a sixteenth of the slot
  instead of a thirty-second (padding adds up to 7 groups a row: a 2048-row prefill chunk would
  have overrun the old size).
- gemma3: the junction declares its lossy twin (op_ar6) and takes it up to kAr6MaxRows (24); a
  taller step keeps the standalone all-reduce, which spread over more blocks wins there (the
  fused kernel gives a block one row).

TranslateGemma-27B MXFP4 + DFlash2, 2x R9700, --tp-wire wht6 --draft-short-from 8, greedy,
aggregate tok/s, two rounds, junction limit never / 24 / any:
  2 streams (16 rows) 350.7 346.2 / 370.4 367.0 / 357.7 356.0
  3 streams (24 rows) 455.8 451.2 / 462.8 460.6 / 437.3 436.8
  4 streams (32 rows) 553.7 553.6 / 553.9 560.2 / 521.0 523.0
  8 streams (32 rows) 717.4 718.0 / 716.7 720.8 / 662.4 661.9
So 2 streams +6 %, 3 +2 %, 4 and 8 unchanged.

Bit identity: with --tp-wire-min-kb 1 (one stream's steps go out lossy) the fused path gives the
unfused one's greedy top-5 logprobs, 300 of 300 tokens, max |d| 0, on two pieces (x1 there 197.6
-> 212.6 tok/s). Qwen3.8-27B MXFP4: 300 of 300 identical on two prompts, speed unchanged.

Tests: arch_test (the lossy-wire junction test now also expects a 24-row step to fuse through the
twin, other op instances than the 8-row step's, and the 64-row prefill to stay unfused).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-28 12:20:10 +01:00
nickreese 9497bf9061 gbnf: share bounded-repetition chains across identical operands
Reuse one optional-link chain per repeated operand, preserving exact bounds and existing compile limits. Includes a synthetic multi-bound schema regression.

AI-assisted contribution; original implementation by claude-nanbeige.
2026-10-28 11:38:40 +01:00
griffin-warrior caa468389c kbench: state the coverage the pass measured in the report header
The header asserted "Every kernel of every loaded library ran" on a pass
whose own body counted 132 of 510 rows reached, so a coverage gap read as
full coverage. Print the sentence only when no declared row was left
unreached; otherwise name the count and point at Rows nothing ran. The
counts come from the same LibRow data the section below prints, so header
and body cannot disagree.

Reproduces on v1.13.0 (checked-in docs/KERNELS.md); the generator literal
is unchanged on current main.
2026-10-28 11:38:00 +01:00
griffin-warrior bbf90ebaa2 kbench: skip the report check where python3 is absent, like ops_doc
The counting is one python3 pass; exit 77 (ctest's SKIP_RETURN_CODE)
where python3 is not present, the same posture ops_doc takes for plugins
that will not dump.
2026-10-28 11:37:51 +01:00
griffin-warrior 1f4f4420e9 kbench: a report whose counts disagree with each other fails a test
The checked-in libr4d section of Rows nothing ran said 239 not reached
over a table of 243: 486c9331 added the four kv_store_streamed rows to
the table without the count (the previous regeneration, 1e968f6e, was
consistent at 239/239). The generator prints header and table from one
vector, so a file like this cannot be one run's output: it is a hand-
merged regeneration, and its headline (132 of 510) and section totals
read four rows short of the tables.

Count the rows each section emits (tests/kernel_report_check.sh), fail
the fast tier when a header and its table disagree or the headline no
longer adds up, and correct the report to the numbers its own tables
show: libr4d 243 not reached, 291 declared (the four rows are in
r4d_rows.cpp and the library reports them), headline 132 of 514.
Regenerating the report from one run on a rig with cards supersedes the
corrected numbers; the test keeps the file honest.
2026-10-28 11:37:51 +01:00
griffin-warrior 7a039cbb5c selftest: skip 2+ rank collective cases when the cards have no peer path
On a box whose cards expose no peer path (IOMMU off; the engine carries
the fact as device.p2p and selects host-mailbox rows around it), the
2-rank collective cases failed with RAD_E_DEVICE: ar_ipc_enable_peer
throws enable_peer: invalid device ordinal, init maps it, and a box
configuration the engine serves shows up as five failures. A card count
is not the fact the kernel contract gates on; hipDeviceCanAccessPeer
answers it without launching a kernel. Gate every collective case on it,
with a skip naming device.p2p, like the card-count gates. On such a box
the five failing cases now skip (targeted --case runs); the rest of
r4d_selftest is unchanged.
2026-10-28 11:37:41 +01:00
griffin-warrior 1720ed3f4a diag: name the build's media capability; docs(GUIDE): the ffmpeg row
An AUTO probe that misses leaves one STATUS line in the configure log,
and the engine boots green and 500s every media request; the startup
report -- the part of a log to paste into an issue -- said nothing about
the capability that decides it. mm::decoder_version() names it (the
libavformat version, or "absent (built without libav*)"), reported on
the startup report and /diagnostics (hardware.host.media), and GUIDE
1.1 lists the five -dev packages, the RAD_WITH_FFMPEG tri-state and the
symptom.
2026-10-28 11:37:31 +01:00
griffin-warrior 0bb00a836d docs(GUIDE): building against a ROCm SDK outside /opt/rocm
A userspace SDK (venv-style) finds hipcc via -DRAD_HIPCC, then device
compilation dies on clang's 'Could not find standard C++ header cmath':
ROCm's clang needs --gcc-install-dir for the distro libstdc++, and
--rocm-device-lib-path for the tree's amdgcn/bitcode. ROCM_PATH covers
discovery, not these. The working flag set, for the SDK and the core
system install, in 1.2 after the direct-CMake recipe.
2026-10-28 11:37:17 +01:00
griffin-warrior 586f77ae0a docs(TP4): gloss the shorthand the table uses
pp, cN, M, I, T, ti8, FK, W4, iq4r, hc_write, pp64K, QSA and L0..L3 are
used as if defined; the kill levels are defined below the table that
references them. One glossary block after the intro; every other word of
the document is unchanged.
2026-10-28 11:36:34 +01:00
griffin-warrior 27f1b27387 docs(QSA): libref implements all five QSA ops, not only qsa_block_key
The sentence in the Checking section predates the libref rows (ref_qsa.cpp
landed in the same release), and it reads as a reason to skip QSA's reference
comparison in a review. The library rows and the report's completeness matrix
show five registered ref rows. The remaining limitation is the subsystem one:
no oracle compares a dense run against a sparse one above the bound, and that
sentence stays.
2026-10-28 11:36:25 +01:00
StillDeadcode d4371cdd3a Merge pull request 'checkpoint: nomic config key aliases, RAD_MAP_TRANSPOSE honouring src_index' (#287) from steki/radiance:nomic-config-aliases into main
Reviewed-on: https://codeberg.org/StillDeadcode/radiance/pulls/287
2026-10-28 11:36:03 +01:00
Boris Manojlovic 6c33ee4e12 builder: narrow an f32 source to a bf16 declaration at load
The builder accepted one conversion direction beyond the exact widening it already did: a single-plane RAD_F32 source declared RAD_BF16 is rounded to nearest even at load (WeightInfo::narrow, beside widen). It is staged like a widened weight, never read in place from the container, and the planner and oracle treat it as 'not the container's stored bytes'. build_test covers the declaration, the stored dtype and size, and that it is not file-direct.
2026-10-27 20:59:42 +01:00
Boris Manojlovic fd40bb430c nomicbert: architecture plugin for nomic-embed-text-v2-moe
Post-norm encoder with fused Wqkv and biases, NeoX rotary, non-causal attention, a dense MLP on even layers and a top-2 of 8 expert MLP on odd layers, mean pooling into the pooled f32 buffer for /v1/embeddings. The checkpoint is f32; data/recipes/nomic-embed-v2-moe-bf16.recipe casts the linears, the token embedding and the token-type table to bf16 (the device kernels read bf16), norms and biases stay f32. The checkpoint's shared experts.bias is not applied: against a llama.cpp run of the same checkpoint at Q8_0 the variant without it matches best (cosine 0.9994; the others 0.9990 to 0.9993), and llama.cpp's own nomic-bert-moe does not carry it. Verified on a gfx1201 card and on libavx/libref against a pure-float32 torch reference: mean cosine 0.99995, min 0.99983 over 20 texts. Unit tests declare and lint a cut-down model. Not verified: inputs above 512 tokens against a reference on the device, other quantisations.
2026-10-27 20:58:47 +01:00
Boris Manojlovic 4853db97db checkpoint: nomic config key aliases, RAD_MAP_TRANSPOSE honouring src_index
meta_from_config_json reads the nomic spellings (n_layer, n_embd, n_head, n_inner, n_positions, moe_top_k, layer_norm_epsilon, rotary_emb_base) as fallbacks in the same chain as the usual keys; existing checkpoints parse as before. RAD_MAP_TRANSPOSE can first take one expert's sub-tensor of a stacked table: src_index[0] picks the dim-0 sub-tensor of a rank-3 stack, or, with src_rows[0] > 0, the row block of a rank-2 stack flattened over its rows. map_transpose_slice() declares it; map_slice() takes the same optional sub_rows. Tests in checkpoint_test cover the aliases, the [8,4,3] case, the flattened case and an out-of-range index.
2026-10-27 20:58:47 +01:00
Boris Manojlovic 157450a82b gemma4_bf16: per-layer MLP width for use_double_wide_mlp (Gemma 4 E2B), and the bf16 descriptor for unmodified Google E2B/E4B directories 2026-10-27 20:57:20 +01:00
Boris Manojlovic 13d3a8b7af checkpoint: nomic config key aliases, RAD_MAP_TRANSPOSE honouring src_index
meta_from_config_json reads the nomic spellings (n_layer, n_embd, n_head, n_inner, n_positions, moe_top_k, layer_norm_epsilon, rotary_emb_base) as fallbacks in the same chain as the usual keys; existing checkpoints parse as before. RAD_MAP_TRANSPOSE can first take one expert's sub-tensor of a stacked table: src_index[0] picks the dim-0 sub-tensor of a rank-3 stack, or, with src_rows[0] > 0, the row block of a rank-2 stack flattened over its rows. map_transpose_slice() declares it; map_slice() takes the same optional sub_rows. Tests in checkpoint_test cover the aliases, the [8,4,3] case, the flattened case and an out-of-range index.
2026-10-27 20:17:47 +01:00
mici81andClaude Opus 5.5 b74a6b2ece spechub: mtp_couple_verify walks the live candidates only (151 -> 31 us a launch)
The sampler's candidate plane is kSampleCandidates (1024) wide and at top_k 20 about 20 entries are live,
but the coupled verify ran its eligibility scan (global memory, one entry at a time) and its sums and
walks on one thread over all 1024: 92-151 us a launch at any row count, on the critical path of every
coupled step. The workgroup now checks validity and takes the maximum in parallel (order-free, exact),
compacts the live indices in ascending order into LDS, and the serial sums and walks run over that list
in the host reference's order, so the token is the same bit for bit.

vtime (n_cand 1024, 20 live, every row bound): 151.7 / 92.8 / 100.5 -> 31.3 / 32.2 / 35.9 us at 4 / 16 /
64 rows; device == host on every row.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-27 18:37:28 +01:00
mici81andClaude Opus 5.5 ce79b12126 dflash2 coupled walk: Q at temperature 0.6 by default
Q's temperature (RADIANCE_DFLASH_Q_TEMP) only moves acceptance, never the
output law. Held-out tokens per verify step at request temperature 1, x4,
32 rows of the eval set, Qwen3.8-27B MXFP4 with a DFlash2 drafter fine-tuned on our traffic, our serving flags:
ordinary rule 3.52; coupled with Q at 1.0 3.71, 0.7 3.88, 0.5 3.85,
0.35 3.77. The walk's scores are flatter than the target's law, so a
sharper Q puts its mass where the target's is; 0.6 is the default now.

At 0.6, 3 interleaved rounds against the ordinary rule (64 held-out rows
at x4, and three requests at x1 and x4, 1500 tokens, T 1):
- tokens per step 3.53 -> 3.82 (+8.2 %), every round apart
  (3.50/3.49/3.61 vs 3.82/3.79/3.86); time-weighted decode +5.4 %;
- decode per stream: 0.7k prompt x1 174.1 -> 181.7 (+4.4 %), x4 144.6 -> 153.8
  (+6.4 %); 22k prompt x1 186.6 -> 191.0 (+2.3 %), x4 135.1 -> 146.2 (+8.2 %);
  41k prompt x1 186.9 -> 196.8 (+5.3 %), x4 125.8 -> 135.0 (+7.3 %);
  aggregate at x4 +5.3..+5.5 %.
Coupled at 0.6 against the ordinary rule, 5000-6000 samples of tokens 1-4
of two chat prompts: chi-square p 0.62..0.99.

The walk's kernel issues each candidate's successor slice and unary score
before the predecessor's codebook row (both are independent of it). This is
the build measured above; it moved the pass time within noise (91.3 -> 90.8
us at M 16, steps 7), and tokens, ids, x and status still match the host
oracle on all 40 random lattices (q by FP64 exp ulps, <= 4.3e-16).

ctest (the environment-only tests excluded) 105/105.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-27 18:37:28 +01:00
mici81andClaude Opus 5.5 cb0abe9ac7 dflash2: lossless coupled acceptance at T > 0 (--draft-coupling on)
DFlash2's drafts were the greedy walk over its candidate lattice, accepted
only when they equal the target's own sampled draw: P(y == x) instead of
rejection sampling's sum min(P, Q). --draft-coupling already did the latter
for a linear MTP head; this extends it to the block drafter.

- dflash_couple_propose (spechub plugin, device row + host oracle): after
  dflash_select, the same lattice walked again, sampled. Position l scores
  each candidate as dflash_select does (unary + low-rank edge from the
  previous token), Q_l = FP64 softmax of score / q_temp over the best eight
  in-vocabulary candidates, x_l ~ Q_l at (seed, base, KEY_DRAFT + l + 1),
  x_l is the next predecessor. Position l writes round l+1's state row, so
  the engine binds it and the sampler's mtp_couple_verify (maximal coupling,
  residual (P - Q)+) verifies it exactly as an MTP round. Q depends on the
  committed text and on x_0..x_{l-1}, never on the verify, and is stored
  exactly. Greedy requests keep dflash_select's tokens (status 0); a draw
  for another card or a Q that cannot be built takes the walk's argmax and
  the ordinary verify (status -1). The shared arithmetic is in
  abi/rad_spechub.h (rad_dflash_couple_step / _walk).
- The block driver stages one draw per drafting row before the query pass,
  reads the states back with the slots and binds them after the commit
  (Engine::bind_couple, shared with the serial driver).
- qwen35_fp8 declares the planes and the op under --draft-coupling;
  RADIANCE_DFLASH_Q_TEMP sets Q's temperature (default 1, exact at any).
- Default (flag off): no op, no plane, no change.

Gates:
- spechub_dflash_couple_test (CPU): emitted token vs P by chi-square over 3
  seeds each, Fisher-combined p 0.135..0.919, for Q = P, Q on fewer tokens
  than P, Q mostly outside P, top_k 20 + top_p 0.95, top_p 0.6, top_k 3 at
  T 0.7, peaked Q; acceptance = sum min(P, Q) within 5 sigma; the walk's
  stored Q equals the softmax of its scores (1e-5) and x follows it (p
  0.993); the whole draft/verify/bonus loop over 3 tokens matches the
  target's autoregressive law (combined p 0.62 at q_temp 1, 0.67 at 0.5,
  0.024 with every 2nd step on the ordinary verify).
- Device row vs host oracle, 40 random lattices at the production geometry
  (V 248320, K 16, R 256, steps 7/3, M 1..16): tokens, x, ids, status
  identical; q differs only by FP64 exp ulps (<= 4.3e-16 relative).
  91 us a launch at M 16, steps 7.
- Engine, Qwen3.8-27B MXFP4 TP2, our serving flags, 4-6 tokens of two chat
  prompts at T 1 / top_p 0.95 / top_k 20, 5000-11000 samples per arm:
  coupled vs ordinary speculation chi-square p 0.23..0.81 (tokens 1-4 and
  pair 1-2); both differ from no speculation on one prompt by the same
  amount (the verify-vs-decode logits, not the rule).
- Flag off, old build (up12 5dbb5dc) vs this: greedy top-5 logprob traces
  identical over 300 tokens (spec 7 and 0, two requests each), 6/6
  fixed-seed sampled texts identical.
- ctest (the environment-only tests excluded) 105/105.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-27 18:37:28 +01:00
baKon 72a58d0c0c core: --expert-stats FILE, the routed experts every layer selects, from the heat engine's histograms
Which experts a served model actually uses, per layer, is what deciding how to spend an expert's
bits needs, and the core already has it: every routed layer's counts come back to a host bank once
a pass, and the heat engine drains the landed banks once a step, one step behind. --expert-stats
FILE credits the same rows to a host tally and writes it as JSON every 30 s and at shutdown,
through a temporary and a rename (place/xstats.h). No device work, no copy, no synchronisation;
where the heat engine is off (every expert in VRAM, a static plan) the drain runs for the tally
alone, and at shutdown the streams are drained and the banks still in the ring are credited.

Counts are filed by step kind: prefill (no decode rows), decode, mixed (one histogram cannot split
it) and draft, which is every routed layer past the trunk (an MTP or DSpark head; its bank holds
the step's last draft pass). Each rank files its passes' kinds when it issues them.

A histogram row is the rank's own experts from zero, so under expert parallelism (deepseek41) it
is the rank's slice. The map from a rank's index to the model's expert id comes from the container:
index e is the unit declared with group expert e, and the directory entry of that unit's weight
names the expert. An expert several ranks hold (a width slice each) is counted on the lowest; a
rank that counts nothing does not drain for the tally. Without directory ids the map falls back to
the indices (one rank, or every rank holding the model's count) or to rank order.

The file carries the model, the routed layers, each layer's expert count and top_k, tokens and
steps issued by kind, histograms, passes, observed tokens and selections per kind and layer, the
per-rank drain counters (lost, unmapped, unclassified), and counts[kind][layer][expert].
/server_info names the file. Router weights are not summed: they stay on the card.

Tests: xstats_test (the map, the tally's kinds and merge, the file); config_test lists the flag
and checks it is off until it names a file.
2026-10-27 18:34:32 +01:00
Constantin fb8cb95b7e docs: verify non-target kernel dispatch 2026-10-27 18:28:46 +01:00
Constantin c2565369e9 docs: record BF16 W4 review follow-up 2026-10-27 18:28:46 +01:00
Constantin d947d7139e fix: preserve BF16 W4 CPU narrowing semantics 2026-10-27 18:28:46 +01:00
Constantin da8c95d4d9 docs: clarify shared R9700 power caps 2026-10-27 18:28:46 +01:00
Constantin fbffd33e22 docs: record third-card benchmark confirmation 2026-10-27 18:28:46 +01:00
Constantin 05ccf42964 docs: record cross-card HYV3 throughput check 2026-10-27 18:28:46 +01:00
Constantin 31ac68549b docs: record launcher compatibility smokes 2026-10-27 18:28:46 +01:00
Constantin 2c9d415166 docs: record full HYV3 validation and A/B results 2026-10-27 18:28:46 +01:00