1186 Commits
Author SHA1 Message Date
StillDeadcode b4c04b6042 Delete .woodpecker.yml 2026-11-12 09:49:23 +01:00
StillDeadcode f0f764d6f5 Delete STRIX_HALOD_RADIANCE.md 2026-11-12 09:48:32 +01:00
KeziandClaude Opus 5.5 60bcc30e5e libr4d: decode tile arms for the int4/int5 x int8 GEMM
gemm_w4a8i8_tiled / gemm_w5a8i8_tiled ran one 256 x 64 tile, built for
2048-row prefill chunks. At decode row counts its time is the weight's
trip through the block and is flat in M (N=5120 K=17408: 272 us at
M=32, 284 at M=256): a 128-row step computes half padding, and N/64
blocks (80 at N=5120) leave most of an R9700 idle.

The kernel is now templated on its tile (TM x TN fragments a wave,
WM x WN waves a block), with the body unchanged, and the rows gain one
tunable axis, `arm`: 0 is the prefill tile (the old constants, so an
untuned install runs the same kernel), 1-8 are 128-, 64- and 32-row
tiles. tools/opshapes.cpp describes the int8-activation operands so
rad-tune can walk the axis, and r4d_selftest checks every arm against
the host reference for int4 and int5, with ragged M and a partitioned
weight; --perfwpa takes R4D_PERF_ARM.

Tuned on an R9700 at the trunk shapes of Qwen3.8-27B ParoQuant int5
(rad-tune, us, arm 0 -> the tuned arm):

  shape             M=32         M=64         M=128
  N=16384 K=5120    258 -> 72    229 -> 97    233 -> 151
  N=5120  K=6144    101 -> 38    101 -> 42    101 -> 62
  N=34816 K=5120    497 -> 217   494 -> 234   504 -> 309
  N=5120  K=17408   273 -> 89    275 -> 103   277 -> 168
  N=12288 K=5120    167 -> 52    167 -> 72    168 -> 112
  N=1024  K=5120     36 -> 21     36 -> 22     37 -> 24

The prefill band (M=2048) keeps arm 0. Which rows reach this kernel is
unchanged: the qwen35 plugin still hands the rotated int4/int5 linears
to it above 64 rows, so the M=32/64 columns only bound what a lower
handover could gain.

The int4 rows share the kernel and gain alike (int4 x int8 at M=128,
arm 0 -> best: N=5120 K=17408 267 -> 150 us, N=34816 K=5120 444 -> 248,
N=16384 K=5120 211 -> 118, N=12288 K=5120 160 -> 91).

End to end, Qwen3.8-27B ParoQuant int5 + DFlash2 on one R9700 (k6_v4
cache, f16 state, depth 3, 32 sequences of ~3k shared + ~2.5k unique
prompt, 3000 tokens out, so 128-row verify steps), against origin/main
on the same boot and tune cache: mean decode step 111.0 -> 93.8 ms,
decode 467 -> 614 tok/s, wall 345 -> 418, no preemptions. Decode at up
to 64 rows (one to eight sequences at depth 7) and prefill (arm 0) run
the same kernels as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019BxxGmKGSAyx2h88G3sEGp
2026-11-11 22:41:02 +01:00
baKon 7da9ccf38b scripts: expert_stats_report.py, what a --expert-stats file says per layer
--expert-stats (merged) writes per-layer expert selection counts. Reading
them one number at a time hides the thing that decides where bits go: a
layer's total is the same at every layer, because top-k routing spends
the same number of selections whatever it picks, so the totals rank
nothing. What differs is the concentration inside a layer and whether
decode and prefill disagree about which experts matter.

Prints per routed layer the top-5/10/20% share, the Gini coefficient, the
experts never selected, and decode against prefill (each one's top-20%
share, the share of decode landing on prefill's top-20%, Jaccard and TVD),
then a skew verdict. The self-check line compares each layer's selections
with its observed tokens x top_k, exact unless the drain lost histograms.

No argument about which layer deserves more bits is made here; the report
is the evidence a person (or a search) spends them against.
2026-11-11 22:36:27 +01:00
behrooz f3e4d11872 libr4d: gqa 7 at head_dim 128
Nanbeige4.3-33B is 56 query heads over 8 KV heads at head_dim 128: seven queries a KV head, the
same ratio at one rank and at two. The gqa-8 unit cannot express it -- its decode body holds 64
rows of q_len * gqa, and 64 is not a multiple of 7 -- so instantiate the shared body at 21
warps: 336 rows, the same 48 query positions a block as gqa 8, and a 63-row decode cap (nine
query positions). Four rows: prefill and decode over bf16 and fp8-e4m3 KV.

The gqa-8 defaults stay as they were. G8_MAX_DECODE_ROWS, G8_P_NWARPS and G8_P_TILE become
#ifndef guards the including unit can win; nothing changes for gqa 8, which is the only other
unit including this file today. The rows state the ratio and both bounds, so a verify wider than
nine query positions takes the prefill kernel.

Without this no checkpoint with that geometry serves at all: declare names no row for it, and the
server stops in startup with nothing selected for attn_paged.

Tested against the model's own releases, which need no change to the engine. llama.cpp 0.9.0-dev
on the same two Radeon AI PRO R9700 measures 1192 tok/s prefill and 23.1 tok/s decode:

  official FP8,  TP=2   34 GiB   4014 tok/s prefill   33.3 tok/s decode
  official INT4, TP=2   20 GiB   3677 tok/s prefill   53.2 tok/s decode
  official INT4, TP=1   20 GiB   2355 tok/s prefill   29.6 tok/s decode

On the FP8 release (compressed-tensors FP8_BLOCK, imported as it ships), 17 * 23 -> 391, 9.11
against 9.8 -> 9.8, 100 - 9 -> 91, every one ending on eos, matching llama.cpp.

The INT4 release does not import as it stands: it carries u4*bf16[1x32]-u4[1x32] while these
linears read u4*f16[1x128]-u4[1x128], so a recipe re-blocks it onto the served grid, which
measures 9.5e-02 relative Frobenius (both grids are four bits, so the bytes are the same and only
the scales move). The answers stay right at that error, and moving about half the bytes a token
it decodes faster on the coarser codes than fp8 does. At 20 GiB it also fits one card.

A Q5_K_M GGUF of this model is no use as a way in: it wants an arch plugin and a conversion of
values that are already quantised, and even then the same questions come out 7 * 3, 9.1 against
9.1 and 10 - 9. The two releases above are the way in; nothing here depends on the GGUF.

Also: the gqa 7 rows against libref on the real 33B weights, 216/216 cases, and rad-kbench -m
with every fusion byte-identical (worst rel-L2 2.08e-3).
2026-11-11 22:32:57 +01:00
neuromanMD c6ef279a12 libr3d: branch-free, bit-identical e4m3_to_f32
The old decode looped over a subnormal's shift, so every fp8 staging loop diverged on gfx11. Normals
re-bias the exponent (+120), a subnormal m is exactly m * 2^-9, S1111111 is the NaN: bit-identical on all
256 codes (the old form is kept as e4m3_to_f32_ref for the check). W7900: the fp8-KV prefill attention
tile 71.6 -> 67.3 ms at 30K keys, output unchanged.
2026-11-11 22:31:33 +01:00
aneinanderandClaude Opus 5.5 e1d612b29d docs: SYCL_PROGRESS -- change 11's commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 20:55:06 +01:00
aneinanderandClaude Opus 5.5 0a1fed0bcf libxe2: GDN recurrent state store through local memory, out as whole lines
The register kernel stored a lane's own 512-byte state row, so each float4 store
touched 16 cache lines. A sub-group's 16 rows now go through a 9-float4-pitch tile,
32 columns at a time, and out coalesced. Bit-identical (rad-kbench gdn rows rel_l2 0,
greedy hashes unchanged). 9B 58.9 -> 59.2 tok/s, 27B 30.4 -> 30.6 (spec off).
XE2_GDN_ROWSTORE=1 restores the row store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 20:55:00 +01:00
neuromanMD aafec91773 libr3d: mxfp4a8 -- do not scan a VRAM e8 plane from the host
e8_scan_once used hipHostGetDevicePointer to decide whether the host can read the e8 plane. It succeeds
for device memory on a large-BAR discrete GPU, so the host byte-scanned VRAM over PCIe (~12 MB/s measured
on a Radeon Pro W7900: 8 s for a 34816 x 5120 plane), and the 16-entry cache was smaller than a DFlash2
drafter's ~36 MXFP4 planes, so every issued pass rescanned most of them -- 70-120 s first requests and
~1 tok/s decode at long context. Scan only host memory (hipPointerGetAttributes), unbounded seen-set; the
kernel's e8 guard already gives reserved values the scale zero in device planes.
2026-11-11 16:53:54 +01:00
aneinanderandClaude Opus 5.5 0aad575475 docs: SYCL_PROGRESS -- generic change 10 (gated prologue), 27B re-bench
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 11:51:00 +01:00
aneinanderandClaude Opus 5.5 9aef29661b libxe2: fused gated-attention prologue (qk_norm_rope_gate, qk_norm_rope_gate_kv_store)
The one-launch prologue that the qwen35 family (Qwen3.5, Qwen3.8), Qwen4-Exp, FishOmni and the MTP
heads request where a kernel library declares it (libr4d did; libxe2 did not, so those models ran
q_norm, k_norm, rope_q, rope_k and kv_store: five launches an attention layer). It splits the
interleaved [q|gate] projection per head, norms q and k, applies the partial NeoX rotary from the
cos/sin table rope_table already fills each step, and with _kv_store stores k and v.

docs/OPS.md requires it byte-identical to the unfused chain, so each step is libxe2's own:
xe2_rmsnorm's bf16 head-row norm (XE2_EXACT=1: libref's ascending sum, as xe2_rmsnorm then takes),
the bf16 rounding the norm stores, cos/sin as xe2_rope_table wrote them (xe2_rope's arithmetic), and
xe2_kv_store's conversion. A sub-group a (token, head), as qkv_norm_rope; that kernel is untouched.
The schemas are libr4d's. The _kv_store row declares its chain (qk_norm_rope_gate, kv_store) and both
rows describe their operands, so rad-kbench draws them and checks the fold byte for byte.
XE2_NO_FUSED_PROLOGUE=1 now hides these two rows as well: the A/B and an escape hatch.

rad-kbench fusion oracle: 28/28 byte-identical on Qwen3.5-9B and on Qwen3.8-27B; default fixture
2144/2144. Greedy A/B (400-token story, 2.4k and 382-token prompts), twice each, spec off: outputs
identical; Qwen3.5-9B w4a16 decode 58.3 -> 58.9 tok/s, Qwen3.8-27B int4 30.1 -> 30.4. Prefill
unchanged (the fused rows serve steps up to 64 tokens).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 11:50:39 +01:00
aneinanderandClaude Opus 5.5 47d1a952e9 docs: SYCL_PROGRESS -- Gemma 4 E2B on Intel, changes 6-9
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:10:37 +01:00
aneinanderandClaude Opus 5.5 dd20835f18 libxe2: sliding-window attention on the DPAS kernels
attn_paged_fast sent any window > 0 to the SIMT split-KV kernel, so every sliding-window layer
(Gemma 2/3/4, Mistral-style and gpt-oss models) missed the DPAS decode and prefill kernels. They now
take the window: each 8-row block starts at its first row's bound (pos - window + 1, on a whole
32-key step; the split decode form partitions from there) and the mask hides keys below each row's
own bound, as libref's attn_paged. The window form is its own instantiation (WIN), so the window-0
kernels are unchanged: the Qwen3.5-9B's attention times match a rebuild of the old code to 0.5%.
The quad prefill form keeps window 0; a windowed prefill takes the esimd prefill form.

rad-kbench, Gemma 4 E2B (head_dim 256, window 512): decode 101 -> 23.5 us and 23 -> 18 us;
q_len 128 757 -> 92 us; q_len 512 2833 -> 98 us; 320/320 within tolerance. Qwen3.5-9B 160/160,
default fixture 2144/2144.

Gemma 4 E2B end to end: decode 63.0 -> 74.4 tok/s, 2.4k-token prefill 1537 -> 1886 tok/s; a story,
a 120-paragraph count and a password at paragraph 77 of 120 answered correctly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 21:08:31 +01:00
aneinanderandClaude Opus 5.5 d35027aaf7 libxe2: split-KV paged attention up to head_dim 512
attn_paged_fast stopped at head_dim 256 (16 values a lane) and sent wider heads to the exact
kernel, so Gemma 4's global layers (head_dim 512) ran xe2_attn_paged_ref at decode and prefill.
The kernel is now instantiated at 16 values a lane (head_dim <= 256: unchanged, its times match
to 0.1%) and at 32 (head_dim 512, four 16-byte value loads a lane).

rad-kbench on the Gemma 4 E2B container, head_dim 512: decode 192 -> 43 us (short context) and
2040 -> 256 us (long); q_len 256 55.4 -> 19.6 ms; 320/320 cases within tolerance. Gemma 4 E2B
end to end: decode 58.6 -> 63.0 tok/s, 2.4k-token prefill 724 -> 1537 tok/s, decode at that
context 29 -> 59 tok/s; answers checked (a story, a 120-paragraph count).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:29:25 +01:00
aneinanderandClaude Opus 5.5 0c7606423b libxe2: fused attention prologue (qkv_norm_rope, qkv_norm_rope_kv_store)
The one-launch prologue that Gemma 3, Gemma 4, Hunyuan v3 and the DFlash2 drafter use where a
kernel library declares it (libr4d did; libxe2 did not, so those models ran the unfused five or six
launches a layer). docs/OPS.md requires it byte-identical to the unfused ops, so each step is
libxe2's own: xe2_rmsnorm's bf16 head-row norm (its partition and reduce_over_group; XE2_EXACT=1
libref's ascending sum, as xe2_rmsnorm then takes), the bf16 rounding the norm stores, xe2_rope's
arithmetic on its frequency table, xe2_kv_store's conversion. A sub-group a (token, head), the head
staged in local memory for the rotary pairs. The schemas are libr4d's.

XE2_NO_FUSED_PROLOGUE=1 leaves the two rows undeclared, so an architecture takes its unfused chain:
the A/B, and an escape hatch.

Gemma 4 E2B: greedy outputs identical with and without (4 requests), decode 58.0 -> 58.6 tok/s.
A random Gemma 3 (v_norm 0): identical, 1570 -> 1600 tok/s. Default fixture 2144/2144.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:29:25 +01:00
aneinanderandClaude Opus 5.5 25c8fbd136 libxe2: qk_norm_rope, conv1d_dw, conv2d, attn_local_rel rows
The encoder towers' ops that had only a host kernel: on the SYCL backend every op runs on the card,
so a container carrying Gemma 4's vision tower (qk_norm_rope, blocks mode, v_norm) or its audio
conformer (conv2d subsampler, conv1d_dw, attn_local_rel) refused to start. qk_norm_rope also serves
GLM's vision tower (axial) and any QK-norm model that declares the fused op.

Each is libref's loop, a work-item an output (a (row, head) for qk_norm_rope and attn_local_rel),
for passes that run once a picture or clip. cu_seqlens stays on the card, so each work-item finds
its own segment.

rad-kbench, Gemma 4 E2B container: qk_norm_rope 80/80, conv1d_dw 64/64, conv2d 34/34,
attn_local_rel 64/64; default fixture 2144/2144. Gemma 4 E2B now serves on Intel: text and an
image request answer correctly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:28:38 +01:00
aneinanderandClaude Opus 5.5 ff4b7c9fb4 libxe2: rmsnorm_p, relu, logit_softcap, rel_sinusoid, pool_rows rows; rope to head_dim 512
Gemma 4 E2B did not start on Intel: five weightless ops had no device row (rmsnorm_p, the bare
value norm, in 15 bands; relu; logit_softcap; rel_sinusoid; pool_rows), and xe2_rope was selected
for its global layers (head_dim 512, proportional rope widened to the full head) and refused them
at launch: the frequency table held head_dim <= 256. It now holds 512, its component index as int8
so the by-value table stays at 1.25 KB.

rmsnorm_p is xe2_rmsnorm with the gain absent; the others are libref's chains (tanh, exp, sin, cos
in double rounded once; pool_rows' f32 sum in row order, rounded, times mult, rounded).

rad-kbench on the Gemma 4 E2B container: rmsnorm_p 20, relu 20, logit_softcap 4, rel_sinusoid 5,
pool_rows 6 cases ok, rope 300/300; default fixture rope 162/162.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 14:15:31 +01:00
aneinanderandClaude Opus 5.5 e1e21935cc docs: SYCL_PROGRESS, generic backend work of 2026-11-08 (changes 1-5, op coverage, gdn analysis)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:28:22 +01:00
aneinanderandClaude Opus 5.5 b0ac7fd42c libxe2: device rows for gelu, silu, gelu_tanh, scale, mul_weight, clamp, fill, iota, act_mul, gelu_mul
These weightless elementwise ops had no libxe2 row, and an op with no weights cannot be placed on
the host, so a model whose graph declares one refused to start on Intel ("no device kernel for op
'gelu_mul' in any plugin"). libr4d serves them; the architectures that use them include Gemma 3
and 4, the embedding models (nomic-bert, embgemma, nemotron-embed), Qwen3-ASR, LFM2's SigLIP2,
Nemotron-H and the diffusion and audio models.

Each is libref's chain element by element (xe2_elem_act.cpp): erf, tanh and exp in double rounded
once to float; silu (alone or in act_mul) to a bf16 result takes the float exp and libref's chain
again near a rounding tie, as silu_mul and sigmoid do. gelu and gelu_tanh stay in double: 1 +
erf(x) cancels for negative x, so a float erf's error is not bounded by the result's.

rad-kbench: the nemotronh + moe + default fixtures, 339/339 (act_mul 60, mul_weight 10, iota 9,
silu 20); a random-weight 2-layer Gemma3 converted to .rad, every resolved kernel agrees with
libref (gelu_mul 10 cases). That Gemma3 now serves (1.5k tok/s decode on the B65); without these
rows it does not start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:15:46 +01:00
aneinanderandClaude Opus 5.5 d04a27fad3 libxe2: gemm_nt_bias on the fast GEMMs, the epilogue in libref's order
gemm_nt_bias (Y = A B^T + bias, then gelu / gelu_tanh and a residual) had only the
correctness-first row: one work-item an output over ascending k. 22 architectures use it
(the ViT, SigLIP2, GLM-vision, SAM and Gemma4-audio blocks, Qwen3-ASR, nomic-bert, the
diffusion VAEs and UNets). The new row forms A B^T on the existing bf16 kernels (the skinny
GEMV at M <= 16, XMX above; each falls back to the exact kernel where its layout is refused)
into an f32 workspace, and gemm_plain runs only its epilogue on it, so the bias, activation,
residual and their roundings are the reference row's. XE2_EXACT=1 keeps the ref row.

rad-kbench: fixture 210/210 (worst rel_l2 1.7e-4), full fixture 2144/2144; the
Qwen3.5-9B vision tower's shapes all agree with libref. N = K = 4608 + gelu on the B65:
M = 1 1,627 -> 81 us, M = 16 8,221 -> 104, M = 128 74,573 -> 253, M = 512 302,924 -> 721.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:54:54 +01:00
claudeandClaude Opus 5.5 6abca01f17 libxe2: w4a16 decode GEMM in 16-row blocks, each group's codes decoded once
gemm_nt_q at w4a16_asym (M <= 64) ran 8-row blocks, each reading and decoding the whole 4-bit weight:
16 rows paid twice, 64 rows eight times. launch16x2 takes two 8-row bands against each group's codes,
loaded and decoded once, the activation loaded 32 columns at a time so both bands fit the default
register file (no spill). The per-row arithmetic is launch16<8>'s. XE2_W4_RB8=1 keeps 8-row blocks.

Qwen3.8-27B int4 (RedHatAI, as shipped), MTP depth 3, Arc Pro B65: 4 concurrent 256-token streams
97.6-99.2 -> 109.4-110.0 tok/s aggregate (+12%); one stream unchanged (43.1 -> 43.2). XE2_W4_CHECK=50
against libref's loop on the host: rel_l2 <= 6.6e-5 on every shape, tens of ties in ~10^5 outputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:53:59 +01:00
claudeandClaude Opus 5.5 2f1fdd4d11 libxe2: bf16 GEMV at 9-16 rows on DPAS, the weight read once
At 9 <= M <= 16 the bf16 skinny GEMM (gemm_nt, logits_gemm) fell to the SIMT kernel's one column a
sub-group, 6-8x the 8-row DPAS kernel's time on the same weight. The ESIMD kernel gains RC = 16: two
8-row DPAS on each transposed weight tile, rows past M clamped by the 2D load and not stored.

MiniCPM5-2B bf16 on the Arc Pro B65 (rad-kbench --bench, cold weights, M = 16): gate_up
712 -> 104 us, down 465 -> 61, qkv 148 -> 29, o 145 -> 25. Twelve concurrent 256-token streams:
198 -> 654 tok/s aggregate. rad-kbench gemm_nt + logits_gemm: MiniCPM5 360/360, fixture 686/686.
XE2_GEMV_SIMT=1 keeps the SIMT form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:38:14 +01:00
claudeandClaude Opus 5.5 3582900903 libxe2: DPAS flash attention at head_dim 64 and 128, not only 256
attn_flash_esimd (decode / verify and prefill) and attn_flash_quad (prefill) were written over HD
but gated to head_dim 256 (Qwen3.8's full attention); every other model fell to the SIMT kernel.
Both now dispatch 64, 128 and 256; the decode merge takes HD / 16 values a lane.

MiniCPM5-2B bf16 (head_dim 128, gqa 8) on the Arc Pro B65, same build, XE2_ATTN_SIMT=1 as before:
decode 69.3 -> 83.1 tok/s, prefill at ~2k tokens 1806 -> 8080 tok/s. rad-kbench attn_paged:
fixture 207/207, MiniCPM5 160/160, Qwen3.8-27B 160/160. KL against XE2_EXACT=1 over the
12-document corpus: mean 0.00060, top-1 98.59% (the SIMT kernel: 0.00060, 98.59%).
Qwen3.8-27B int4 unchanged (30.1 tok/s, 1361 tok/s prefill).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:16:14 +01:00
claudeandClaude Opus 5.5 989db71bfc docs: the engine baseline, RedHatAI Qwen3.8-27B-INT4 as shipped, with and without MTP, beside stock vLLM 0.33
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 00:45:10 +01:00
claudeandClaude Opus 5.5 098b1779fc docs: the PARO-M2XFP4 baseline on the v1.17 merge (bench-standard quick)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 22:46:43 +01:00
claudeandClaude Opus 5.5 45f3b510c7 Merge upstream main (v1.15.1 -> v1.17.0, 152 commits) into the SYCL port
Conflicts, both sides kept:
- abi: RAD_ABI_VERSION 37 (upstream); the fork's RadBuildCtx.plain_norm after upstream's
  expert_file_tier, widened to int64_t so it starts past ABI 37's 208-byte struct instead of in
  its tail padding (abi_layout_test); RadSyclStream rows after RadShapeGen*.
- arch/common/rad_block_gdn_fp8.h: upstream's q8_rot guard and the fork's o_plain guard
  combined; the decode-row q_o.step only where q_o is declared (!o_plain).
- docs/OPS.md: upstream's optional params on sample_logprobs, the fork's q_temp on
  mtp_couple_propose.

Also ignores /baseline-models/ (local model copies).

Host tests: arch_test's MTP lint/graph-pin failures are unchanged from before the merge (the
fork's mtp.fc LinearFP8, 10a99a5); avx_check's hand-built moe_gemm_q w4a8 case also fails on
upstream's own files; images/videos need FFmpeg; three binaries over their CPU budget on this VM.
SYCL card tests 3/3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 22:13:08 +01:00
claude 2bb2f7bacc current work 2026-11-06 20:41:14 +01:00
Code000 451b136874 tests: the preemption cases pin --prefill-interleave 0
The served default --prefill-interleave auto:1 (previous commit) follows measured step times, so the
four sequences of preemption_by_recompute_continues_each_stream_exactly sometimes never overlapped
enough to preempt and the test's CHECK(n > 0) failed in about half the runs under a loaded host
(plain main: 6/6 pass). The cases are sized for the fixed schedule they were written against;
small_pool_args() now pins it. Nothing they check is loosened: the streams must still match and
preemption still happen. With the flag: 6/6 alone and 3/3 beside 40 busy threads, and the case
takes 3 s again instead of 5-12 s.
2026-11-05 20:37:24 +01:00
Code000 a58304632a scheduler: --prefill-interleave defaults to auto:1 where nothing pins the schedule
Cause: with --prefill-interleave 0 every step carries a chunk while a prompt prefills, so a
sequence already decoding gets one token group per chunk step. On Qwen3.8-Flash-Next fp8 (TP2,
MTP 3 drafts) with 8 sessions decoding while 64K-token prompts prefill, that is 12.3 tokens/s a
session against ~83 alone; with 4 such prompts at once, 5.4.

Change: not given, engine bring-up now serves --prefill-interleave auto:1: after a prefill chunk
that ran beside decoding sequences, decode-only steps follow for as long as the chunk step took.
--deterministic keeps 0 (a schedule that follows timing is not reproducible), as do KL mode and
generators (nothing decodes beside a prefill there); an explicit --prefill-interleave N|auto[:SHARE]
wins. Startup names the decision with its reason. The Config default stays 0, so a Scheduler built
directly (tests) keeps today's schedule; Config::prefill_interleave_set records the flag.

Evidence (decode tokens/s a decoding session / aggregate prefill tokens/s / TTFT), 8 sessions
decoding beside 64K prompts:
  --prefill-interleave 0       12.3 / 3,664 / 17.3 s
  auto (0.25)                  23   / 3,181 / 20 s
  auto:1                       40.9 / 1,823 / 35.5 s
  auto:2                       50   / 1,166 / 56 s
with 4 concurrent 64K prefills: 0 5.4 / 2,934 / 64 s; auto 14.8 / 2,545 / 74 s; auto:1 33 / 1,395 /
137 s. auto:1 roughly triples a decoding session's rate for twice the prompt's time to first token.
BetterBench quick (short prompts, concurrency 1/2/4/8) shows no reliable difference between 0 and
auto: a short prompt is one chunk, after which nothing is held. config_test: the flag records that
it was given.
2026-11-05 20:20:13 +01:00
Code000 6e134fc15f sched_test: the burst simulation starts with sequences decoding, and takes auto:SHARE
Cause: the device measurements of --prefill-interleave were taken with sessions already decoding
when the long prompts arrive (8 decoders beside 64K prompts); the simulation only had the burst's
own prompts, which decode after their first token, and could not set auto's share.

Change: SIM_DECODERS sequences of 64-token prompts (SIM_DEC_OUT tokens each, default 4096) decode
for 16 steps before the burst arrives and count as decoders while it prefills; the run ends with
the burst's last prompt. SIM_SHARE is auto's share (SIM_IL=-1 SIM_SHARE=1 is auto:1). The summary
adds the decoders, the steps that carried a chunk per checkpoint interval prefilled, and prints
the interleave as given (N or auto:SHARE).

Evidence: RAD_SCHED_SIM=1 SIM_N=1 SIM_LEN=65536 SIM_DECODERS=8 SIM_SEQS=16, SIM_IL 0 / auto /
auto:1 / auto:2: TTFT 17 / 20 / 33 / 51 s, decode while the prompt waits 9.7 / 17.0 / 37.0 / 47.1
tokens/s a sequence, against the device's 17.3 / 20 / 35.5 / 56 s and 12.3 / 23 / 40.9 / 50
(Qwen3.8-Flash-Next fp8, TP2, MTP 3). SIM_N=4: TTFT max 56 / 67 / 109 s at 0 / auto / auto:1,
decode 6.7 / 15.6 / 34.5, against the device's 64 / 74 / 137 s and 5.4 / 14.8 / 33.
2026-11-05 20:20:13 +01:00
Code000 c00b882b96 scheduler: --prefill-interleave auto:SHARE sets the decode-only share of a chunk step's time
auto gave decode-only steps a fixed quarter of a chunk step's time. On the device (8 decoding
sessions beside 64K prefills, MTP on) that left decode at 23 tokens/s a session against 83 alone,
with 0.45 s gaps: two or three decode steps of ~40 ms per 0.45 s chunk. auto:SHARE makes the share a
choice (0 < SHARE <= 4); auto stays 0.25. The cap on decode-only steps rises from 16 to 64 so a
larger share is not cut off. config_test parses it, sched_test checks auto:1.
2026-11-05 20:20:13 +01:00
Code000 5a8c5533d1 sched_test: an opt-in timed simulation of a burst of long prompts
Cause: scheduling policy for many long prompts arriving at once (how chunks share steps,
admission, decode rows beside chunks, interleaving) was judged on the device only, where a
run of 32 x 128K prompts takes 40 minutes and the device is shared.

Change: sim_burst_of_long_prompts drives the real Scheduler through such a burst (prompts,
decode with three drafts a step, the stager floor, --prefix-resume exact) and times each
step with a cost model whose defaults are fitted to Flash-Next at TP2 (a lone prefill and
decode alone). It checks nothing and returns at once unless RAD_SCHED_SIM is set; the
workload, the flags and the model's terms come from SIM_* variables (see the comment).

Evidence (defaults, 128K prompts, 512 tokens out): the schedule keeps ~1984-2048 prefill
tokens in nearly every step at 4, 16 and 32 prompts (two prompts share a step at 1024 each
until the first decodes, then a chunk of 2048 less the decode rows with the next prompt
filling the rest), so the model predicts ~5.1K tokens/s aggregate at every burst size:
TTFT p95 100 / 412 / 814 s at 4 / 16 / 32 prompts against the device's 158 / 966 / 2456 s.
The gap grows with the burst size, so it is the device's cost of the steps a burst runs
(two-sequence and mixed steps), not the number of tokens the scheduler plans per step.
2026-11-05 20:20:13 +01:00
Code000 f87d03d304 scheduler: --prefill-interleave auto sizes the decode-only steps from measured step times
Cause: while prompts prefill, a sequence that is already decoding gets one token group per
step that carries a chunk. On Qwen3.8-Flash-Next at TP2 such a step takes a 2048-token
chunk's time (~0.4 s, more on the device under load), so decoders crawl at a few tokens/s
until the queue of prompts drains. --prefill-interleave N inserts N decode-only steps after
each chunk, but a fixed N costs the prefill whatever N decode steps cost, which grows with
the number of decoders, and is too few where decode steps are cheap.

Change: --prefill-interleave auto (default stays 0). After a chunk that ran beside decoding
sequences with its prompt continuing, as many decode-only steps follow as fit in a quarter
of a chunk step's time at a decode step's (running means of both, fed by step_finished from
the step wall times; at most 16; 1 until a decode step has been timed; 0 where a decode step
costs more than that quarter). The prefill gives up at most a fifth of its rate however
many sequences decode. The hold mechanics (no admission while held, steps issued ahead
count, the stager not armed for a held chunk) are --prefill-interleave N's, unchanged.
Under auto which steps carry a chunk follows the device's timing; a number keeps a
reproducible schedule. A chunk's cut and every row's computation are unchanged.

Evidence: sched_test interleave_auto_* (the count from given costs, the step shapes it
produces, nothing held for a lone prefill or when decode steps are too dear); config_test
parses auto. Host simulation of the scheduler (next commit), 32 x 128K prompts sent at
once, 512 tokens each, MTP 3, step costs fitted to a lone 2048-token prefill and to decode
alone: decode of the sequences decoding while prompts wait 6.5 -> 31 tokens/s each, last
first token 826 -> 875 s (+6 %), TTFT p50 453 -> 480 s; fixed N=2 gives 18 tokens/s at
the same cost. Device numbers: the commit that makes auto:1 the served default.
2026-11-05 20:20:13 +01:00
AnimusNull f713f449c2 glm5next: the width split is for all-MXFP4 experts
The layout rule chose the width split at four ranks and up before it knew the
weights' format. MoeFP8 refuses to slice a plain bf16 expert, so a container
of bf16 experts, or of MXFP4 with protected bf16 ones, that main serves at TP4
was refused unless --weights-disk-tier was set.

Read the container's encodings first, on every rank alike, and take the width
split only when every routed expert is MXFP4. The check declares no name map,
so no pinned graph moves.
2026-11-05 14:25:05 +00:00
AnimusNull e0c386ee85 docs: GLM-5.3-Flash lays its experts out by what the deployment needs 2026-11-05 14:24:14 +00:00
AnimusNull 8ef50a7708 glm5next: experts split by width at four ranks and up, whole for the file tier
Whole experts on their rank let the routed weights live on the drive, which
a two-card host needs, but at four and eight ranks they leave the shapes the
MXFP4 kernels are tuned for: glm_prefill wants 288 experts an op and finds 72.
On 4 x R9700 that cost prefill two thirds and four-stream throughput 37%.

Keep the width split at four ranks and up, as the kernels expect, and take
whole experts at two ranks or when --weights-disk-tier needs them (ABI 37,
RadBuildCtx::expert_file_tier). The file tier's graph at eight ranks keeps
main's pin, and the route-count fix that came with expert parallelism stays.
2026-11-05 14:19:17 +00:00
AnimusNull b954585f9f moe_mxfp4: the small-M form at GLM's TP4 slices too
At TP4 the launcher fell back to the expert-major form for every decode step. The small-M form
now takes gate_up from 9 to 384 routed rows (past one token's 8, where it reads 5 % slower) and
down up to 384 at the K256 x4 tiles. perfmx --perfmx-tp 4, cold, gfx1201, output byte-identical:
gate_up 3 to 18 % faster from 2 to 48 tokens, down 37 % at one token and 4 % at 48.

Served at TP4 with --vision-tower-placement ram, BetterBench against the same tree without it:
decode 52.3 -> 55.7 tok/s, 1/2/3/4 conversations 49.8/73.5/85.6/91.1 -> 52.7/76.5/90.0/96.4,
prefill unchanged. Temp-0 replies identical, needles 8/8 at 4 x 119k.
2026-11-05 14:18:21 +00:00
AnimusNull 220cb3f12c moe_mxfp4: a pin for the small-M form, and --perfmx-tp 4 to time it at the TP4 slices
r4d_moe_mxfp4_pin_small takes the small-M form where the rule does not (any GLM slice up to
384 routed rows, at either tiling) or keeps it off. r4d_selftest --perfmx-tp 4 times GLM's TP4
slices, gate_up 1024 x 4096 and down 4096 x 512, the rule's form beside the pinned ones, and
fails if their outputs differ by a byte. The rule itself is unchanged.
2026-11-05 14:17:44 +00:00
AnimusNull be623ba1dc glm indexer: a step that takes all its blocks does not split
A prefill chunk past the row threshold split the indexer over the ranks
even when every row's history fit the selection, so it scored rows whose
selection was already decided and gathered the result. Such a step now
takes the unsplit take-all path on every rank: zeros into a plane of its
own, [max_tok, topk + 1] (the score plane holds only a run of rows where
a step may split), and a selection over the whole step, with no query
side, scorer or gathers.

Temp-0 replies byte-identical to the scoring path; 114/114 tests.
2026-11-05 14:17:07 +00:00
AnimusNull c9e34d534c glm5next_test: the indexer's tests take both paths, scored and taking all
The fixtures' sixteen- and eight-column tables reach fewer blocks than the
selection, so their steps now take all (DsaCache::takes_all). Where a test is
about the scored path, its batch carries enough history to score; the steps
that take all assert that no query side or scorer runs and that the selection
reads the fill. The pinned graph adds the fill.
2026-11-05 14:16:30 +00:00
AnimusNull 8fa226e620 glm indexer: a step whose every row takes all its blocks skips the query side
With topk or fewer live blocks a row, qsa_select takes every live block in
block order whatever the finite scores, so the query projection, its copy,
the head gates, dsa_query and dsa_score decide nothing. Such a step fills the
score columns with zeros instead; the key side still runs, so the index cache
stays current. The decision reads the host bound splits() reads, so every rank
and every recorded pass agrees. Split steps keep scoring, since their
selection's rebased bounds come off the scorer.
2026-11-05 14:15:00 +00:00
AnimusNull bd38e7eced dma lane: the room check drops a reused fence slot and keeps what it once knew read
dma_read takes the end of the last finished list from ends[k % kDmaEnds]. The lane can have
more than kDmaEnds lists behind the engine (the prefill stager and the mover queue far more
than the prefetch's three), and once a later list has taken list k's slot that value would
overstate what the engine has read, letting the host write over a part of the ring not yet
read. The slot is now used only while fewer than kDmaEnds lists are behind it.

The check also keeps the most it has known read, so a list number it can no longer use does
not send it back to a stale written-back read pointer and wedge a ring that has room.
2026-11-05 14:14:24 +00:00
AnimusNull 8c389c02e7 docs: glm5next serves an fp8 latent cache
GUIDE.md no longer says glm5next refuses --kv-cache-dtype fp8: it narrows the latent-attention
cache alone. ARCHITECTURES.md's KV group table gives kv_latent's E4M3 form and its host-tier size.
2026-11-05 14:13:48 +00:00
AnimusNull d858aa722b glm5next: --kv-cache-dtype fp8 narrows the latent attention cache to E4M3
The plugin refused fp8. It now takes bf16 or fp8 and applies it to kv_latent alone: Geom::kv_dtype
is the configured cache dtype, kv_latent is declared in it, and GlmMla's kv_store and
kv_store_streamed name it, as does every mla_attn over the latent (head form, row form and the
MTP layer's), which then resolves to the fp8kv rows. The store keeps kv_store's default descale of
1, which the attention reads, as vLLM's fp8 cache does. kv_index_tail, kv_dsa_index and the KDA
groups keep their dtypes; the indexer reads only the latent group's tables. Host-tier, streamed
and replicated sizing follow the group dtype already. Under bf16 the attention states no
kv_dtype and the graph is the one declared before.

At 4 x 262144 tokens the latent cache is 12 layers of 512 bytes a token instead of 1024.

glm5next_test: fp8 declares the latent group E4M3 and the other four unchanged, every latent store
and attention names fp8_e4m3, and bf16 (stated or default) leaves the attention without kv_dtype;
the refusal test now refuses f16.
2026-11-05 14:13:11 +00:00
AnimusNull f776ecbf2e r4d_selftest: the mla_attn fp8kv rows against libref
mla_check states kv_dtype fp8_e4m3 for an *_fp8kv row and fills the cache with E4M3 codes over most
exponents, subnormals included; libref reads the same codes. Cases per twin cover its kernel forms:
the wave row, the matrix row's pairings (union, positional, element-wise load) and the rows row's
forms (rule, pinned rows kernel, element-wise load, 32 heads a workgroup).
2026-11-05 14:12:36 +00:00
AnimusNull e494369ed9 libref, libavx mla_attn: an optional kv_dtype, the cache shaped from it
Both schemas take `kv_dtype` beside `dtype`; libref's shape gives the cache operand that dtype when
it is named, the query's otherwise. The kernels already read the cache through ldt, so an E4M3
cache is read as its codes' values. ref_test covers an E4M3 cache under a bf16 query.
2026-11-05 14:10:58 +00:00
AnimusNull 17f0eae420 r4d mla_attn: E4M3 latent cache twins of the three rows
mla_attn takes an optional `kv_dtype`; at fp8_e4m3 the cache is E4M3 as kv_store_fp8 writes it at its
default descale of 1. mla_attn_fp8kv, mla_attn_matrix_fp8kv and mla_attn_rows_fp8kv are the bf16
rows' kernels with the cache element as a template parameter: the key load decodes E4M3 to bf16
(v_cvt_pk_f32_fp8, then the high half), which is exact since every E4M3 value is a bf16, so the
tiles and all arithmetic past the load are the bf16 instance's. The twins carry the bf16 rows'
constraints plus kv_dtype fp8_e4m3 and rank above all three bf16 rows, in their order. At uint16_t
the loads are the plain loads the bf16 kernels made; their launchers still refuse any cache that
is not bf16.

r4d_emu test_mla runs every kernel form (wave, matrix and its element load, rows forms 0-3) on E4M3
codes against its bf16 instance on the decoded cache: bit-identical on all 23 form/case pairs, and
each launcher refuses the other cache dtype.
2026-11-05 14:09:13 +00:00
mici81andClaude Opus 5.5 b632c72f5d sched: an overdue preempted prefill keeps its place ahead of the queue
A preempted request waiting for its whole-recompute gate (kAdmitWait) let the admission walk ask the
next request in the queue. For an overdue one that undoes the overdue path: the room it made in this
step went to a request queued behind it. With preempted prompts published, the victim forced off for
it needs almost nothing to come back, so it was re-admitted at once and forced off again on the next
step. Under KV pressure the same victim was forced off and re-admitted 26 times in 16 s while the
overdue request waited. An overdue preempted request that is still refused now stops the walk, as a
refused fresh request already does.

2x R9700, Qwen3.8-Flash-Next TP2, production flags with the KV cache cut to 6.45 GiB a card
(--gpu-headroom-mib 3072), 16 concurrent 58.6k-token prompts with 4000-token answers:
- without publishing preempted prompts:  wall 390.6 s, mean 338.5 s, 9 preemptions, 1 forced
- publishing them:                       wall 346.4 / 344.1 s, mean 306.6 / 299.8 s, 36 / 32 preemptions, 28 / 26 forced
- publishing them, with this change:     wall 331.0 / 324.4 s, mean 289.4 / 284.0 s, 8 / 9 preemptions, 1 / 1 forced

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 14:59:28 +01:00
mici81andClaude Opus 5.5 12b7b7889b sched: an overdue preempted prefill is failed only when waiting cannot help
On an idle engine the overdue path failed a preempted prefill on any refusal. A restore waiting a step
for a deferred release is a wait, and so is a refusal behind requests this step already admitted (the
budget or a card went to them); both clear by the next step. With preempted prompts published, the
restore path is common: under KV pressure two of ten preempted requests failed with "overdue
preempted prefill could not be admitted with nothing running", the debug log showing "the restore
waits a step for 1 deferred release(s)" right before. The path now fails only when nothing was
admitted this step and the refusal is not such a wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 14:59:28 +01:00
mici81andClaude Opus 5.5 01c7a3334a sched: a preempted request publishes its prefix; the recompute adopts it
Scheduler::preempt_back dropped everything a request had computed: unlike
close_request it published nothing, so a preempted 96.6k-token prompt was
computed again from its first token. The publish block of close_request is
now Scheduler::publish_prefix, called by both. Its blocks stay in the cache,
so a preemption that published gives eviction its rounds back (the decode
ensure loop and the overdue path) and the cache gives them back, the newest
last, before another request is preempted. preempted_can_prefill counts the
blocks the recompute adopts from the cache (pc_->lookup), so a preempted
request is not held back for room its own cached prompt already covers.

Shared KV with RADIANCE_KV_GUARANTEE=1 (nine Qwen requests preempted for
TranslateGemma's start pool): Qwen 587 -> 458 s, TranslateGemma 139 -> 80 s;
without the guarantee unchanged (340 / 58 vs 339 / 56). Test:
a_preempted_request_publishes_its_prefix; sched 187, engine_e2e and the
related suites pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 14:59:28 +01:00