This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
radiance-sycl/core/mm/item.cpp
T
Deadcode 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.
2026-10-27 16:47:35 +01:00

89 lines
3.8 KiB
C++

/* item.cpp -- the parts of Item the step path uses. The batch builder links only this unit from
* core/mm, so a test that fakes the device layer does not pull in the processor and, through its
* metadata reader, the real device layer. */
#include "mm/processor.h"
#include <algorithm>
namespace rad {
namespace mm {
void Item::coords(int64_t first, int64_t count, int32_t* planes) const {
/* An audio clip is 1-D (RadBatch::enc): frame index, whether the frame takes part in the
* convolution, the clip's real frame count and its staged frame count. A clip staged in
* chunks (AudioFamily::Qwen3ASR) reads each chunk's first `chunk_read` frames; the rest of the
* chunk is alignment the encoder reads as zero. */
if (kind == Kind::Audio) {
for (int64_t k = 0; k < count; ++k) {
const int64_t f = first + k;
planes[k] = (int32_t)f;
planes[count + k] = chunk_staged > 0 ? (f % chunk_staged < chunk_read ? 1 : 0)
: (f < valid ? 1 : 0);
planes[2 * count + k] = valid;
planes[3 * count + k] = grid_h;
}
return;
}
/* Merge-block order inverted: a patch's index within its segment is
* ((block_row * blocks_w + block_col) * merge + in_row) * merge + in_col. */
const int32_t merge = grid_h / rows_h;
int32_t s = 0;
while (s + 1 < n_seg && patch_at(s + 1) <= first) ++s;
for (int64_t k = 0; k < count; ++k) {
while (s + 1 < n_seg && patch_at(s + 1) <= first + k) ++s;
const int64_t within = first + k - patch_at(s);
const int64_t bw = seg_w(s) / merge;
int64_t row, col;
if (patch_raster) {
/* Raster order is its own inverse: patch i is row i / w, column i % w. */
row = within / seg_w(s);
col = within % seg_w(s);
} else {
const int64_t in_col = within % merge;
const int64_t in_row = (within / merge) % merge;
const int64_t blk = within / (merge * merge);
row = (blk / bw) * merge + in_row;
col = (blk % bw) * merge + in_col;
}
planes[k] = (int32_t)row;
planes[count + k] = (int32_t)col;
planes[2 * count + k] = seg_h(s);
planes[3 * count + k] = seg_w(s);
}
}
/* The rotary layout of one prompt: a run a segment, the text in front of a run counting up and a
* grid advancing the rotary by its longer side. Here, beside the accessors, so that code without
* the processor has it. */
void PromptMedia::layout() {
rope.runs.clear();
int64_t pos = 0, tok = 0;
for (size_t pi = 0; pi < items.size(); ++pi) {
const Placed& p = items[pi];
const Item& it = *p.item;
const int32_t m = it.rows_h > 0 ? it.grid_h / it.rows_h : 1;
for (int32_t s = 0; s < it.n_seg; ++s) {
const int64_t run_tok = (int64_t)p.tok + it.seg_at[(size_t)s];
pos += run_tok - tok; /* the text in front of the run counts up */
const int32_t rh = it.segments.empty() ? it.rows_h : it.seg_h(s) / m;
const int32_t rw = it.segments.empty() ? it.rows_w : it.seg_w(s) / m;
RopeLayout::Run r;
r.tok = (int32_t)run_tok;
r.n = (int32_t)(it.row_at(s + 1) - it.row_at(s));
r.w = rw;
r.base = (int32_t)pos;
r.flat = it.rope_1d;
/* A grid advances the rotary by its longer side; a 1-D run by its length. */
pos += it.rope_1d ? r.n : std::max(rh, rw);
tok = run_tok + r.n;
r.shift = (int32_t)(pos - tok);
r.item = (int32_t)pi;
r.row0 = (int32_t)it.row_at(s);
rope.runs.push_back(r);
}
}
}
} /* namespace mm */
} /* namespace rad */