radiance 1.5.0

- Gemma 4 31B (PRs #74, #75, #81, #86; sfjes, keptn42): sliding and global attention with their
  own kernels, the assistant head as a drafter that reads the trunk's cache, the vision tower, a
  fused w4a8 decode step, bf16 and compressed-tensors int4 checkpoints, and window snapshots so a
  prefix hit on a sliding-window model resumes instead of prefilling again.
  deploy/compose/gemma4-31b-w4a8.yaml serves keptn42's container on two cards
- ParoQuant (PRs #65, #66, #67; malic): Qwen3.8-27B checkpoints with learned Givens rotations,
  as int4, int5 and MXFP4, imported without re-quantising, the prefill's rotations on the matrix
  cores. deploy/compose/qwen3.8-27b-paro.yaml serves them on one card. A ParoQuant container made
  with the PR builds is refused: convert it again with --reuse <old container>
- Gemma 4 26B-A4B with z-lab's DFlash drafter (PR #88; Perire): arch/gemma4 serves Google's bf16
  checkpoint with the routed experts in block fp8 or bf16 (data/recipes/gemma4-26b-a4b-df*.recipe),
  and libr4d gains its windowed paged attention, the fused sandwich-norm joins, expert_scale and
  the sharded draft head's pair_argmax. A prefill chunk runs as two slices with its all-reduces
  beside the compute, bit-exact with the whole step. The 31B's global layers take the windowed
  attention too: an 11.5K-token prefill on two R9700s in 3.1 s instead of 4.9
- a startup that logs nothing for two minutes says where it waits (#89): the system call (a KFD
  request by name), the library that made it, and its stack, which addr2line resolves against the
  binary
- the prefix cache is kept in VRAM and host memory only (#70): the disk tier wrote every block and
  snapshot a prompt produced, and its copies never outlived the process. --prefix-cache-host-mib
  is renamed --prefix-cache-mib; --prefix-cache-dir and --prefix-cache-disk-mib are removed, and
  startup refuses all three with what replaced them. The compose files no longer mount /data, and
  .env no longer needs RADIANCE_STATE
- --prefix-cache-ttl S (default 3600, 0 never): a conversation no request has used for that long
  leaves the cache, whichever tier holds it; radiance:prefix_cache_expired_total counts them. A
  full host tier now drops its least recently used conversations
- --vision-tower-placement vram|ram (#84): ram keeps an encoder tower in pinned host memory and
  gives its VRAM to the KV cache, read over the link once an image
- timings carry ttft_ms and total_ms (#85): the server's own time from the request body's arrival
  to the first and the last token, queueing and tokenisation included
- a KV-cache recall that found a moved expert with nowhere to go stopped halfway and leaked the
  slots it had already freed: after it every recall failed, the cache stayed short until a
  restart, and requests failed with HTTP 500. A recall now waits for the slots it is owed and
  always finishes
- a tool result or tool-call arguments that are not JSON are no longer refused as nesting past
  1024 levels for their unmatched brackets (#90): only text that parses as JSON is held to the
  bound, since nothing else is parsed into a tree
- the host-pool refusal names the limit that applies to pinned memory (RAM less 1/64 and
  1.5 GiB), not ttm.pages_limit
- --embedding-placement auto, removed in 1.3.0, is refused with what replaced it
- for out-of-tree kernel libraries: gemm_nt_q gains two operands (pb1, pb2, the part bounds), and
  the loader requires identical op schemas, so a library built against 1.4.0 must be rebuilt. For
  architecture plugins, rad_op_declared(b, op) asks whether an op is in the loaded vocabulary
  without declaring it
This commit is contained in:
Deadcode committed 2026-10-13 19:35:16 +02:00
commit b93b531f63
127 files changed
+9609 -4796

No files matched your search

+40 -9
View File
@@ -36,6 +36,14 @@ enum {
* caller selecting an entry point by hand would make. */
R4D_PRIO_ATTN_DECODE = 70,
R4D_PRIO_ATTN_PREFILL = 60,
/* The windowed kernels (r4d_attn_paged_window.hip) serve every q_len, so where their geometry
* meets another leg's -- h256 at gqa 2 -- they match in both of that leg's bands, and rank
* below both: timed by rad-kbench on two R9700s at the 31B's shapes (window 1024, fp8 cache),
* the h256/gqa2 decode kernel takes 0.26-0.71 of the windowed kernel's time at q_len 1..32 and
* its prefill kernel 0.43-0.67 at 33..512, a bf16 cache the same order. The windowed rows keep
* that geometry's non-causal band past q_len 32, and attn_paged_qrow, which no other kernel
* serves. */
R4D_PRIO_ATTN_WINDOW = 50,
/* At M<=16 with K%256==0 both bf16 skinny rows match and the m16 (dot2) kernel is taken.
* The m64 WMMA kernel is faster on every shape measured, so a caller that wants it at low M
@@ -97,6 +105,37 @@ int64_t r4d_rad_attn_decode_h128_scratch(const RadArgs*);
int r4d_rad_attn_decode_h256_gqa2_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_decode_h256_gqa2_bf16 (const RadArgs*, RadStream);
int64_t r4d_rad_attn_decode_h256_gqa2_scratch(const RadArgs*);
/* Paged attention at head_dim 256 and 512, 1/2/4/8 queries per KV head, any window, causal or not
* (r4d_attn_paged_window.hip): one entry point a geometry and cache dtype, serving every q_len and
* reading q at any row pitch, so the same entry points serve attn_paged and attn_paged_qrow. */
int r4d_rad_attn_window_h256_gqa1_bf16(const RadArgs*, RadStream);
int r4d_rad_attn_window_h256_gqa1_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_window_h256_gqa2_bf16(const RadArgs*, RadStream);
int r4d_rad_attn_window_h256_gqa2_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_window_h256_gqa4_bf16(const RadArgs*, RadStream);
int r4d_rad_attn_window_h256_gqa4_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_window_h256_gqa8_bf16(const RadArgs*, RadStream);
int r4d_rad_attn_window_h256_gqa8_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_window_h512_gqa1_bf16(const RadArgs*, RadStream);
int r4d_rad_attn_window_h512_gqa1_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_window_h512_gqa2_bf16(const RadArgs*, RadStream);
int r4d_rad_attn_window_h512_gqa2_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_window_h512_gqa4_bf16(const RadArgs*, RadStream);
int r4d_rad_attn_window_h512_gqa4_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_window_h512_gqa8_bf16(const RadArgs*, RadStream);
int r4d_rad_attn_window_h512_gqa8_fp8 (const RadArgs*, RadStream);
int64_t r4d_rad_attn_window_h256_scratch(const RadArgs*);
int64_t r4d_rad_attn_window_h512_scratch(const RadArgs*);
/* The top-1 of a row of all-gathered (id, value) pairs, written one id a row: the vocab-sharded
* draft head's merge (r4d_pair_argmax_f32.hip). */
int r4d_rad_pair_argmax_f32(const RadArgs*, RadStream);
/* Gemma 4's two sandwich-norm joins, each one kernel for a chain of rmsnorm / add / mul_weight
* launches (r4d_norm_join_bf16.hip), and expert_scale, the embed_lookup + mul pair that scales
* each routing weight by its expert's scale (r4d_expert_scale_bf16.hip). */
int r4d_rad_norm_add_norm_bf16 (const RadArgs*, RadStream);
int r4d_rad_norm_add_norm_route_bf16(const RadArgs*, RadStream);
int r4d_rad_join_add_scale_bf16 (const RadArgs*, RadStream);
int r4d_rad_expert_scale_bf16 (const RadArgs*, RadStream);
int r4d_rad_attn_vit (const RadArgs*, RadStream);
int r4d_rad_attn_dense (const RadArgs*, RadStream);
/* Eight queries per KV head (r4d_attn_paged_gqa8.hip): the routed 35B-A3B at head_dim 256
@@ -122,15 +161,6 @@ int64_t r4d_rad_attn_decode_h256_gqa4_scratch(const RadArgs*);
/* ...and its head_dim 64 prefill leg, LFM2's geometry, which serves every query length. */
int r4d_rad_attn_prefill_h64_gqa4_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_prefill_h64_gqa4_bf16(const RadArgs*, RadStream);
/* Eight queries per KV head at head_dim 512, full attention -- the Gemma 4 dense GLOBAL layers.
* Its own instantiation, not the gqa8 body above: that one's prefill tile is 48, which 512-channel
* tiles do not fit in LDS, so head_dim 512 is a stand-alone dispatch
* (r4d_attn_paged_h512_gqa8.hip). The verify width is the gqa bound, 64/8 = 8. */
int r4d_rad_attn_prefill_h512_gqa8_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_prefill_h512_gqa8_bf16(const RadArgs*, RadStream);
int r4d_rad_attn_decode_h512_gqa8_fp8 (const RadArgs*, RadStream);
int r4d_rad_attn_decode_h512_gqa8_bf16 (const RadArgs*, RadStream);
int64_t r4d_rad_attn_decode_h512_gqa8_scratch(const RadArgs*);
/* Twelve queries a KV head, head_dim 256 only -- Qwen3.8-Flash-Next's QSA layers. Same body,
* different instantiation; r4d_attn_paged_h256_gqa12.hip is four lines. */
int r4d_rad_attn_prefill_h256_gqa12_fp8 (const RadArgs*, RadStream);
@@ -600,6 +630,7 @@ int r4d_shape_moe_gather (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_scale_rows (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_scale (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_row_topk_merge (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_pair_argmax (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_quant_act_i8 (const RadParam*, int, int operand, RadOpdDesc*);
int r4d_shape_had_quant_act_i8 (const RadParam*, int, int operand, RadOpdDesc*);