Archived
e4ca20ddf85f424838ecebf5e33ca42e4dfb7ea5
15
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b264e9bd0c |
Scale the prefill softmax by row, not by wave
The h256 prefill online-softmax branch must remain wave-uniform, but the previous branch let one row's growth vote make every row update its reference maximum. A row's rounding could therefore depend on which other rows shared the launch. Keep the branch uniform and make each row update only when its own cross-half maximum exceeds its own `m_ref + PGROW`. Rows below threshold retain `m_ref`. This fixes row-coupled rescaling; it does not claim full-model bitwise invariance across chunk sizes, since other shape-dependent paths remain. The dedicated regression selector is `--case attn_prefill_rows` (exact match; `--case rows` is not recognized). The older kernel-name selector runs the regression only for that named GQA row; rerunning it for GQA4 also passes the row checks. Three launch pairs run on six BF16 head-256 rows: GQA 2/4/6/8/12 and GQA6 with 4-token pages (18 assertions). Against v1.15.1, 17/18 assertions failed; with this change 18/18 pass bit-identically. For Spark GQA4, the baseline 58/128 pair differs in 588/118,784 elements (max abs 0.00195). Although this implementation file is named `gqa6`, the parameterized body is included by the other head-256 GQA wrappers too. Controlled 917-token Spark BF16 rerun (same prompt, binary, model, TP1, BF16 KV, no prefix cache; only libr4d changed): chunk 128 vs 1024 kept top token 198 and all 20 candidates in common before and after. Maximum shared top-20 log-probability delta was 0.23717 on v1.15.1 and 0.28474 with this patch. This example does not improve; it is included to avoid claiming general chunk invariance. The earlier raw full-vocabulary pre-fix result (131,070/131,072 logits changed, max abs 0.46925) has no matching post-fix capture; the paired API top-20 comparison is the comparable result. On a separate 32-document, 31,391-position BF16 evaluation, chunk-1024 vs chunk-128 reference achieved 99.49% top-1 agreement (31,231/31,391): 160 positions still choose a different top token between chunk shapes, not against external ground truth. Mean KL was 0.000879, median 1.29e-5, p99 0.00462, p99.9 0.10119, max 3.2961. The pre-fix result on this exact set was not measured. At the separately investigated scored row 461 (document 20, token position 477), prefix replay's recorded top token 62594 was replaced by 2561 before the fix; after it, token 62594 was restored with a 0.184-nat top-token log-probability gap. That 0.184 is not a full-set KL, and the 3.296 maximum comes from the separate 31,391-position evaluation. Fast CTest: 141/141. Full card selftest still has one unrelated `hc_read_e4m3` prefill-tile failure, reproducible on untouched v1.15.1. No throughput improvement is claimed or measured. |
||
|
|
9ed3ef7a7b |
radiance 1.15.0
New models and formats: - IQR for Qwen3.8-27B: weights on the int8 grid under GPTQ, a trellis down each GPTQ column (IQR-V2), and IQR-V3, a computed trellis code under one scale a row, kept at its codes' width in VRAM and decoded in the GEMM; 15 IQR-V3 recipes from ~2 to ~7 bits a weight (data/recipes/q38-27b-*-v3.recipe, docs/IQR.md) - libhalo: a kernel library for Strix Halo (gfx1151), preferred there over libr3d - Nemotron 3.5 Embed 1B and 8B (nemotron35_embed): text and image embeddings through a Pixtral tower, on the card and on the CPU - Nemotron 3.5 Rerank 8B - /v1/systemone: Cloudflare's clef and clef-flash, Convai Innovations' Laya and Mica beside LiquidAI d1; scored steps read the candidates' logits from the head table with no lm_head pass - LFM2's 8-bit trunk: block-fp8 or int8 linears with the fused producers, and the d1-3B recipe - DeepSeek-V4.1's reply format with DSML tool calls and typed argument tags Weights on the drive: - The file tier reads only the experts the pass routes rows to; the draft head's weights stay in the host pool - A hot VRAM cache for routed experts read off the drive, reads deposited straight into free host pool slots, and copyless evictions; the file tier's counters are now ssd_* - GLM-5 Next shards its routed experts by expert, not by width, so they can live on the drive - The stall watch counts drive reads as progress, and the DMA lane's room check reads the lane's own completion fence Quantisation tooling: - --calib-corpus, --calib-dir and --calib-layers record each linear's input Hessian; beside --kld-record the reference's own run records them - --kld-top N records a sparse KL reference (the N most likely tokens and the tail's mass) - GPTQ in a third of the time with the same codes, trellis GPTQ on the card, vector codebooks with coordinate descent, and rad-convert --reuse repeated, each container supplying what the earlier ones lack Speculation: - Prompt lookup alone (--spec-ngram K, --spec-ngram-min/-max): each sequence keeps an index of its n-grams, and a proposal is verified only when its measured step cost says it pays; --draft-window adaptive follows it Speed: - IQR decode: the narrow tile splits K for four times the int8 tile's waves and folds each 128-K block once; at 8 tokens down and the output projections run in 0.61-0.82x and 0.70-0.92x FP8's time (2-6 bits); IQ6R-S-V3 with its DFlash2 drafter steps in 26.3 ms at TP2, against 29.4 ms before and FP8's 27.3 - Qwen MXFP4 feed-forward: the gated fold up to 16 rows, not 8 - libr4d: the gated prefill fold, the short-prompt split row, and the rows forms of rmsnorm and rope; KLATE again for the head-256 gqa6 paged prefill; gram_accum on the matrix cores Features: - /health, /v1/health and /ping answer 503 with "status": "stuck" once the device has advanced nothing for a minute or a queue has faulted, so a supervisor can restart a wedged server (#356) - --image-gen-max-pixels and --image-gen-max-refs size an image generator's buffers (#344) - The startup report lists only the options not at their default, with a count; -v lists all (#250) - --preempt-wait-ms bounds how long a preempted prefill waits for its whole-recompute room - --placement layer_offload spills dense layers so one --max-model-len sequence fits - Startup refuses amdgpu with CWSR off and says how to fix it; --proceed-with-incompatible-configuration starts anyway under an UNSUPPORTED banner Fixes: - The n-gram read-ahead hands each row to the reader once and reads only as far ahead as the row cache holds, and pauses while decode reads: about one drive read a row instead of two (#355) - A file-tier window reads each of its runs once, not once a run per run - The decode split law's verify floor is bounded by the batch's workgroups: max_seqs 256 no longer declares 64x the scratch (#342) - A prefetch DMA list's mark stays out of the signal pool until the engine has read it, and a prefill stage copies only the blocks its own tables name (#343) - The split-KV row sum is read with fetch-inactive (#328) - LFM2 on the host backend: libref and libavx serve the row-form ops it declares (#348) - The preempted-prefill gate skips a KV group that holds no blocks (#352) - Every request entry point bounded, gated and sanitised (JSON depth, invalid UTF-8, control bytes in the log, the dashboard's CSP, cross-origin browsers on the loopback-only routes); a prompt id outside the vocabulary refused at admission; --api-key "" refused at startup - The telemetry the HTTP thread reads is atomic - An RMS norm row no longer depends on how many rows its launch carries; prefill attention's rescale is decided by live rows only - A --kld-record prefill chunk that finishes no sequence gets its logits on a tied-head model - A kernel's lazily made counter block is zeroed outside the lock other ranks take (a TP2 first-step hang) Changes: Plugin ABI 32. Every plugin exports a layout fingerprint of the ABI structs and the loader refuses a plugin without it or with another (#302), so out-of-tree plugins must be rebuilt. Appended: RadBuildCtx calib_* and gen_max_*, RadArchProbe gen_max_*, RadBatch score_only and plugin_words, RadDeviceProps::unified, RadChatFormat arg_json_value_prefix. |
||
|
|
167595a9b4 |
libr4d: the split-KV row sum read with fetch-inactive (#328)
The prefill KV split (
|
||
|
|
6645337f69 |
radiance 1.13.0
New models: - Tencent Hy-Memory (HYV3) from its BF16, FP8 and GGUF checkpoints, with its native tool calls - M2XFP4: metadata-augmented MXFP4 weights for Qwen3.8-27B and its DFlash2 drafter (top-1 89.1% -> 92.4% against plain MXFP4), its quantiser and recipe, and ParoQuant's M2XFP4 checkpoints - Gemma 4 E2B/E4B audio input; NVIDIA-Nemotron-3.5-Bolt-E4B in int8 and 4-bit, on two cards by default; Ornith-1.5-122B compose files Speed: - Weight reads beside the decode all-reduces (qwen35_fp8, gemma3; --weight-prefetch, on by default): the 27B MXFP4 with DFlash2 61.2 -> 67.9 tok/s at c1, TranslateGemma 27B +13% - Head-256 split-KV decode attention at 256 workgroups and without bank conflicts (27B: +3-5% a step at 25-41K context), and the prefill KV split for small launches (a short turn over a long context decodes the other sequences 27% faster in that step) - MXFP4 decode gate_up, activation and fp8 quantiser in one launch (27B, Gemma 3 up to 64 rows: TranslateGemma +2-5% at 2-8 streams) - ParoQuant int4/int5 tiled GEMMs 6-9% faster - Speculation: a step's tokens are sent before the drafter's passes end, no step waits behind one that ends its requests, and the MTP head's first draft no longer collapses after short chats in the prefix cache Features: - --kv-resident N: KV streaming for a context bigger than VRAM (qwen4exp_fp8, GLM-5.3) - MiniMax-H3: reference media and keyframe conditioning with the VAE encoders - Krea 2 rebalance presets balanced, detail and subtle - The dashboard's request history; a stall watch that reports a frozen step's thread and stack - rad-tune at the served configuration, collectives measured as the exchange; Gemma 4 E2B/E4B's per-layer embeddings read ahead off the step path - A GPTQ calibration tap and recipe for Gemma 4 31B's w4a8 container Fixes: - The two-rank all-reduce checks that a peer's push has landed before reducing it - z-lab's DFlash drafter on Gemma 4 31B keeps drafting after a prefix-cache hit - MiniMax-H3's modulation rows Changes: Plugin ABI 31: out-of-tree plugins must be rebuilt. RADIANCE_PREFETCH_BESIDE is --weight-prefetch now; RADIANCE_NO_HUGE_PAGES, RADIANCE_IDS_EARLY, RADIANCE_ATTN_BAND_SPLIT, R4D_PREFILL_SPLITS, RAD_PLE_TIMING and RAD_PLE_CACHE_ROWS are gone. |
||
|
|
96bc0465b3 |
attn prefill h256: the small-launch KV split for every GQA geometry
The KV split of the head-256 / GQA-6 prefill kernel (few workgroups -> split the KV walk into segments, f32 partials, the split-KV merge with a cu span) now serves every head-256 prefill row: GQA 12 (4-token pages: fp8, bf16, fp8_v4, k6_v4), GQA 6 with 4-token pages (the same four), GQA 8, GQA 4 and GQA 2 (fp8, bf16). The fewer KV heads a rank holds, the more it matters: at TP 2 Qwen4-Exp (GQA 12) and Qwen3.5-35B-A3B (GQA 8) keep one KV head per rank, so a 53-row tail runs 2 workgroups on 32 WGPs. The host side (the law, the scratch sweep, the scratch-capped count, R4D_PREFILL_SPLITS, the merge launch) moves into r4d_attn_prefill_split.h; each unit passes its own geometry (query rows per workgroup = 24 * 16 / gqa, tile 48). The GQA-6 unit is refactored onto it with the same law (Qwen3.8-27B in the engine: greedy top-5 logprobs bit-identical before and after at 300 positions after 25k and 41k prompts). Left unsplit: GQA-2 launches with a sliding window (the partition has no window floor; a 1024 window walks at most ~26 tiles), the lossy e4m3 legs, and the head-128 / head-64 legs sharing the bodies. Split count, one sequence, N query rows -> S: GQA 12 with 1 KV head: 1-32 -> 32, 53 -> 16, 160 -> 6, 1024 -> 1; GQA 8 with 1 KV head: 53 -> 16, 345 -> 4; GQA 2 with 4 KV heads: up to 160 -> 8. Scratch at declare at most 25.4 MB per row. Split vs unsplit: at most 0.000488 (fp8 KV) and 0.0039 (bf16, fp8_v4, k6_v4; about 1 bf16 ulp). Tests: the split tests generalised over geometry for all 18 split rows (query lengths 1-640 over 8k-20k keys, empty segments, ragged batches, pipelined pieces, poisoned scratch, oracle rows at each tile edge, declare-time scratch): 1782 ok; the mixed-step case over 9 geometry x cache pairs: 54 ok. Every kernel that existed before is byte-identical (311 of 311). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
6a7824a837 |
attn prefill h256 gqa6: split the KV walk when the launch has too few workgroups
The prefill attention kernel gives each workgroup 64 query rows of one KV head and walks the whole causal context serially. A launch with few query rows therefore has few workgroups: the tail chunk of a prompt (53 rows) or a follow-up turn of a few hundred tokens runs 2-10 workgroups on 32 WGPs, each walking up to 188k keys (17.7 ms per layer at 188k). When kv_heads * qtiles * seqs is below the WGP count, the launch now splits the KV range into S segments (blockIdx.x = qtile * S + segment), writes unnormalised f32 partials (O, m, l) in the decode partial layout and merges them with the existing split-KV combine. S is the smaller of one or two rounds of workgroups, capped by the context's tiles and the declared scratch. A segment past a workgroup's causal end still writes an empty partial; the merge reads every segment it counts. The merges take a SPAN parameter so a launch over part of a step (pipelined pieces) only rewrites its own rows; the decode instances are unchanged (identical ISA). R4D_PREFILL_SPLITS: unset/0 = the law, 1 = off, N = force N (debug/tuning). Measured on 2x Radeon AI PRO R9700, Qwen3.8-27B MXFP4, TP 2, k6_v4 KV: - r4d_selftest --perfpaged, off -> on: 53 rows over 40k 3.71 -> 0.47 ms, 80 rows 3.64 -> 0.68 ms, 345 rows 3.80 -> 1.79 ms, 1024 rows 4.29 -> 4.29 ms (no split). - Engine, 188k prompt, time to first token: 62.78 -> 62.54 s (the tail chunk). - KLD vs the bf16 reference: chunk 64 0.040384 -> 0.040337, chunk 2048 0.040237 -> 0.040220; top-1 agreement 93.985 -> 93.998 %. Split vs unsplit outputs differ by at most 1 bf16 ulp. - With R4D_PREFILL_SPLITS=1 the engine is bit-identical to before (top-5 logprobs, 100 positions). Tests: attn_split_case / attn_split_scratch_case for k6_v4, fp8_v4, fp8 and bf16 KV (q 1-345 over 8k-20k keys, empty segments, ragged batches, pipelined pieces), scratch poisoned; 410/410 ok. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
75b4c92e7e |
libr4d: the paged prefill attention (head 256, gqa 6) without its exposed global waits
The tile loop waited out a global round trip every tile with every wave of the workgroup (the only one on its WGP) stalled: the wide K fetch sat in a branch whose join made the compiler drain every load in flight right after it, and the fp8_v4 / k6_v4 V scales were packed right after their prefetch was issued, so it was waited on at once. Now the K fetch is branch-free (the launch's thread count is stated to the compiler), the scales are packed at the store, and on the fp8 and k6_v4 caches tile t+1's K is fetched once tile t's last m-tile has its scores (O_KLATE), so the staging phase between the barriers only widens and stores. Load order only: the bytes are the same (greedy texts of a server identical, r4d_selftest 8124 ok / 0 FAIL on both trees). r4d_selftest --perfpaged on the R9700, three interleaved rounds, medians, k6_v4: 2048 queries over 100k keys 25.91 -> 21.47 ms (-17.2 %), over 160k 41.43 -> 33.97 (-18.0 %), over 25k 5.63 -> 5.45 (-3.3 %), 1024 queries over 50k 5.69 -> 5.48 (-3.7 %). fp8: -7.8 % at 100k and 160k, within noise at 25k and 50k. bf16 (the stated thread count alone): 0 to -3.5 %. fp8_v4 keeps the old order on all three counts: with them it gained 19 % at 100k but lost 3 % at 25k and 50k. The gap is widest where the cache no longer holds the KV (k6_v4 at 100k is 70 MB against 64 MB of Infinity Cache), so the round trip is a DRAM one. Qwen3.8-27B MXFP4 at tp 2, production flags, cold prefill, three rounds: 100k 3830..3856 -> 3932..3935 tok/s, 25k 5255..5292 -> 5292. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
9eaf10da6e |
radiance 1.11.0
New models: - GLM-5.3-Flash reads pictures: its vision tower and processor (--image-tokens sets the budget), with decode kernels for a few rows and the DSA indexer split over the ranks - Sage-A1.5 (fp8 and MXFP4) with its vision tower and a DFlash2 drafter - Unlimited-OCR (bf16) - Gemma 4 31B with z-lab's DFlash and RedHatAI's DFlash2 drafters; at four cards its all-reduces are fused with the junctions, overlapped with the compute and sent compressed - Ornith-1.5-35B-A3B w4a8 compose files Speed: - Block drafters (DFlash, DFlash2) accept their drafts on the card, and the next step is issued ahead - The four-rank all-reduce is faster for every --tp 4 model - qwen35_w8a8: the norms and SiLU write the int8 linears' operands directly - --attn-prefill-fp8 off|qk|pv|both: fp8 QK and PV legs for the h256 prefill attention (about +20% prefill on a 221K-token prompt for the 27B MXFP4 at TP2); lossy, off by default Features: - Control vectors: --control-vector off|on|disabled (disabled by default), a per-request switch, and the published Qwen3.8-Flash-Next refusal-direction vector (its license is in NOTICE) - Krea 2: the `rebalance` request field, as ComfyUI's ConditioningKrea2Rebalance - Cards with a small PCI BAR run, with kernel arguments kept in host memory - Dashboard: live acceptance figures; statsdump rotates its file at a size cap - KV caches every rank holds whole (GLM-5.3's latent and index caches) take one host-tier slot Fixes: - Long conversations taking turns no longer fall back to an early snapshot: a host-tier restore makes room as memory pressure does and waits a step for the previous turn's release (two conversations of 142K and 147K tokens sent back to back: 31.3 s per turn before, 2.8 s now) - Kernels before Linux 6.16 (amdgpu below 3.64) no longer hang at startup: virtual memory management is turned off there, with a warning - Gemma 4 dense scales its token embeddings as Hugging Face does (bf16), which changes its output - The four-rank all-reduce fences prefill-sized messages, for a rare divergence after a fresh start - GLM-5.3: every refusal names the setting and the reason; its template keeps string content - Several pictures in one request no longer refuse processors that take one image at a time Changes: Plugin ABI 26: out-of-tree plugins must be rebuilt. The environment switches the PRs added are fixed rules or flags now (R4D_ATTN_FP8 is --attn-prefill-fp8). |
||
|
|
51db508f91 |
libr4d: R4D_ATTN_FP8 also for the fp8_v4 and k6_v4 caches
fp8_v4's K is E4M3 already and goes to LDS as raw bytes, as on the fp8 cache. k6_v4's K and the int4 V of both layouts are widened to the value times its group scale (as for the f16 legs) and rounded once to e4m3 at staging. The launcher reads R4D_ATTN_FP8 for all three fp8-family caches. The eight new prefill instantiations spill no registers. Measured with radiance 1.10.0, fp8_v4 KV, otherwise as above (KL against the fp8-KV reference with R4D_ATTN_FP8=0): - R4D_ATTN_FP8=0 with fp8_v4 matches the shipped libr4d (mean KL 0.006713 in both) - 3: mean KL 0.0073, p99.9 0.89, max 5.2, top-1 98.3 % - prompt 200K: 2,609-2,611 -> 3,073-3,091 t/s; 5 x 200K joint prefill 2,403 -> 2,834 t/s; decode unchanged |
||
|
|
cdc0ae26df |
libr4d: opt-in fp8 QK and PV legs for the h256/gqa6 prefill attention (R4D_ATTN_FP8)
Ports the 8-bit prefill legs of radiance-vllm-mxfp4's r4d_radiance_extras.patch (commit afa21b5 there) to the h256/gqa6 prefill kernel as two separable bits, off by default: - O_QK8 (32): Q is quantised to e4m3 once at load (after the folded scale), K stays raw bytes in LDS, and Q.K^T runs as fp8 WMMA. - O_PV8 (64): P is packed to e4m3, V stays raw bytes in LDS, and P.V runs as fp8 WMMA. PGROW tightens to 8 octaves (e4m3 max 448) and DOT2 is off. Both need CONTIG and are compiled out for bf16 KV. Byte tiles halve the K/V LDS footprint. prefill_launch reads R4D_ATTN_FP8 once: 0 = f16 (unchanged), 1 = QK8, 2 = PV8, 3 = both. Measured with radiance 1.9.0 on 2x R9700 (230 W), Qwen3.8-27B MXFP4, TP 2, fp8 KV, --tp-wire wht6: - kernel, ctx 200K, chunk 6592: 161.8 ms -> 113.9 ms with 3 (x1.42); per-row relative error against fp32 1.7e-3 -> 3.1e-2 - prompt throughput at 200K: 2,621 -> 3,082-3,127 t/s; at 25K: 4,746 -> 4,861-5,011 t/s - --kld-ref against the unpatched build: R4D_ATTN_FP8=0 is bit-identical (KL 0 on 10,198 positions); 3 gives mean KL 0.0076, p99.9 0.94, max 14.3, top-1 98.4 %, PPL x1.0024 - decode and DFlash2 acceptance unchanged (the decode kernel keeps its f16 legs) |
||
|
|
c00a650bce |
libr4d: fp8_v4 and k6_v4 caches -- stores, folded prologues, h256/gqa6 attention
Two narrower layouts of an attention cache, a head's dims in groups of 32 with an f16 scale: fp8_v4 (E4M3 K, int4 V; 25 * head_dim / 16 bytes a token and head) and k6_v4 (int6 K, int4 V; 22 / 16). kv_store and qk_norm_rope_gate_kv_store write them (the folds byte-identical to the pairs); attn_prefill / attn_decode at h256 gqa6 widen the codes to f16 in a tile's staging, V a key pair's 8 dims a thread fetched a tile ahead and widened with packed f16 (one rounding, a dword store holding both keys), K6's high bits laid out so one mask and shift join them to the low nibbles. r4d_selftest: the stores against an exactly representable set, the folds, and the attention rows against the inline oracle extended to the layouts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1e968f6e1d |
radiance 1.7.0
- every model serves without a GPU: libavx covers every op, so `--kernels libavx` alone serves every shipped container - Qwen3-ASR (zivius): speech to text on /v1/audio/transcriptions and live over /v1/realtime - /v1/messages works with Claude Code as it ships (gearwave00001) - a long agent conversation keeps its cached history when the client rewrites its last turn (manueloverride) - a stream's first event goes out with the first token, so llama-benchy measures prefill right - opt-in --prefill-interleave (Smellyyyy, baKon) and --prefill-span (keptn42) - four-rank TP releases the link early; four-rank selftests and docs/TP4.md (goodman-b) - NVFP4 and FP8 compressed-tensors imports (devmilan); tools/rad-export for finetunes and LoRA adapters (baKon) - many fixes, among them lost tokens on stop strings under concurrency, keep-alive, MiniCPM5 tool arguments and the CPU's vision and audio encoders - plugin ABI 17 and changed op schemas: out-of-tree plugins must be rebuilt |
||
|
|
cb5e812ccc |
attn prefill: a windowed CTA starts its KV walk at its own first row's window
The windowed prefill took the walk's first tile from the chunk's row 0, so every CTA of a long chunk walked from the chunk's window start to its own causal limit. Tiles below the window of a CTA's first row are masked for every row it holds, so starting there changes no value. |
||
|
|
dd3310849a |
kernels: paged attention at h512/gqa8 and h256/gqa2, windowed prefill band
head 512 (gqa 8) — a head width the library had not compiled before — for the global layers, head 256 (gqa 2) for sliding-window decode, plus the >=32-token windowed prefill fix. Numeric selftests vs an inline port of ref_attn_paged with negative control; env-gated attn-verify probes (R4D_VERIFY_ATTN, default off) at the decode entries. |
||
|
|
ae74a8aebf | radiance 1.0.0 |