Archived
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.
This commit is contained in:
commit
9ed3ef7a7b
452 files changed
+167762
-1346
No files matched your search
@@ -88,9 +88,56 @@ struct Grid {
|
||||
int l1_lo = 0, l1_hi = 0; /* its range */
|
||||
float l1max = 0.0f; /* the largest first-level value its dtype holds */
|
||||
|
||||
/* A vector codebook (vq=FILE): one code per `vdim` consecutive columns, indexing `vq`
|
||||
* (`ventries` rows of `vdim` integer values in -127..127), stored as the encoding's `grid`
|
||||
* table. A block's scale matches its rms to the codebook's: a value v is the entry over
|
||||
* `vq_unit`, the units a unit-rms vector the codebook was fitted to spans. */
|
||||
std::vector<float> vq;
|
||||
int64_t vdim = 0, ventries = 0;
|
||||
double vq_unit = 1.0;
|
||||
/* The search's layout: vq_soa[j * ventries + k] = entry k's j-th value, vq_n2[k] its squared
|
||||
* norm, so the distances to every entry vectorise across entries. */
|
||||
std::vector<float> vq_soa, vq_n2;
|
||||
|
||||
/* A trellis (tcq=L): the codes of a column, one per row, are the bits a bitshift trellis
|
||||
* shifts in. Row r's value is tcq_lut[state_r] times its block's scale, where state_r =
|
||||
* (state_{r-1} << k | code_r) mod 2^L, k the code's bits. Each run of tcq_rows rows is
|
||||
* tail-biting: the state before its first row is the one after its last, which its last
|
||||
* ceil(L/k) codes make. A block's scale matches its rms to the table's, as a vector grid's
|
||||
* does (vq_unit). */
|
||||
int tcq_L = 0, tcq_k = 0;
|
||||
int64_t tcq_rows = 0;
|
||||
std::vector<float> tcq_lut; /* 2^L integer values in -127..127 */
|
||||
float tcq_peak = 0.0f; /* tcq_peak=1: the table's largest magnitude, which no
|
||||
block's largest value may pass; else 0 */
|
||||
/* tcq_rb=R: the values on the int8 grid an int8 GEMM reads with one scale per R rows (and the
|
||||
* block's 128 columns), the largest of the R rows' scales: row r's value is
|
||||
* B * rint(lut[state] * (s_r / B)), B that largest. The row holding it keeps its values; the
|
||||
* others' are rounded onto B's grid, inside the trellis's search. 0: off. */
|
||||
int64_t tcq_rb = 0;
|
||||
/* tcq_colf=1 (one scale a row, block=1x*): each 128-column block's values also take a factor
|
||||
* shared by every row, its share of the weight's energy, so a value's scale is its row's times
|
||||
* its block's. A GEMM folds the factor into the activation's per-128 scale, which it multiplies
|
||||
* anyway, and the row's in its epilogue. Chosen from the weight before GPTQ. */
|
||||
bool tcq_colf = false;
|
||||
/* tcq_code=mad: the states' values are computed, not chosen: with h = (st * A + B) mod 2^32
|
||||
* (the product of the factors' low 24 bits), state st's value is bytesum(h & 0x3F3F3F3F) - 126
|
||||
* (tcq_lut_mad). A reader needs no table: a multiply-add, a mask and a byte-sum dot a value. The
|
||||
* table is still stored, A and B beside it ("trellis.mad"). */
|
||||
bool tcq_mad = false;
|
||||
uint32_t tcq_a = 0, tcq_b = 0;
|
||||
|
||||
/* The planes of the encoding, by index; -1 when the grid has none. */
|
||||
int plane_zero() const { return asym ? 2 : -1; }
|
||||
int plane_grid() const {
|
||||
return vq.empty() && !tcq_L ? -1 : 2 + (asym ? 1 : 0) + (lv2 ? 1 : 0);
|
||||
}
|
||||
int plane_scale2() const { return lv2 ? (asym ? 3 : 2) : -1; }
|
||||
int plane_mad() const { return tcq_mad ? plane_grid() + 1 : -1; }
|
||||
/* A trellis under one scale a row (block=1x*) carries the 128-column blocks' factors beside it,
|
||||
* tcq_colf's or ones, so a reader has one form for both (libr4d's kRowF32). */
|
||||
bool row_scaled() const { return tcq_L && br == 1 && bc == 0 && !lv2; }
|
||||
int plane_colf() const { return row_scaled() ? plane_grid() + (tcq_mad ? 2 : 1) : -1; }
|
||||
int plane_table() const {
|
||||
return table.empty() ? -1 : 2 + (asym ? 1 : 0) + (lv2 ? 1 : 0);
|
||||
}
|
||||
@@ -129,8 +176,41 @@ BlockScale grid_block_scale(const Grid& g, const float* w, int64_t cols, int64_t
|
||||
|
||||
/* One value onto the grid: its code, and the value the code decodes to (for error feedback). */
|
||||
int grid_code(const Grid& g, const BlockScale& b, float v);
|
||||
/* A vector grid's code for the `vdim` values at `v`: the entry nearest v times b.inv. */
|
||||
int grid_vq_code(const Grid& g, const BlockScale& b, const float* v);
|
||||
float grid_decode(const Grid& g, const BlockScale& b, int code);
|
||||
|
||||
/* tcq_code=mad's value of every one of the 2^L states (Grid::tcq_mad). */
|
||||
std::vector<float> tcq_lut_mad(int L, uint32_t a, uint32_t b);
|
||||
|
||||
/* A trellis grid's search state for one run, reused across runs. */
|
||||
struct TcqWork {
|
||||
std::vector<float> cost, next, best, rx, rs, rr;
|
||||
std::vector<uint8_t> back;
|
||||
std::vector<int64_t> path;
|
||||
};
|
||||
/* A trellis grid's codes for a run of n <= tcq_rows rows of one column: a tail-biting path (the
|
||||
* state before the first row is the state after the last) of least sum over the rows of
|
||||
* (x_r - v_r)^2, v_r = s_r * lut[state_r], its codes into `codes` and the values they decode to
|
||||
* into `dq`. With `ratio` (tcq_rb), v_r = s_r * rint(lut[state_r] * ratio_r) instead: s_r is then
|
||||
* the row block's scale and ratio_r the row's own scale over it. */
|
||||
void grid_tcq_run(const Grid& g, const float* x, const float* s, int64_t n, int32_t* codes,
|
||||
float* dq, TcqWork& w, const float* ratio = nullptr);
|
||||
|
||||
/* A trellis grid's two-level scales are read as one bf16 a block: the bf16 of the first level
|
||||
* (b->stored) times the second's stored value s2, which is what libr4d widens them to for its
|
||||
* int8 GEMMs. Settle b's scale to that. */
|
||||
void grid_tcq_settle(const Grid& g, float s2, BlockScale* b);
|
||||
/* A trellis block's two-level scale from its ideal (unrounded) scale under the second level's
|
||||
* stored s2, settled: dyn=1's choice when GPTQ reaches the block. */
|
||||
BlockScale grid_tcq_block_lv2(const Grid& g, double ideal, float s2);
|
||||
|
||||
/* Rows [row0, row0 + rows) of a "trellis" weight of rows_all x cols back to f32 in its logical
|
||||
* basis (the transform undone), from the plane starts: abi/rad_quant.h's decode hook. Whole runs
|
||||
* only, but for the weight's last. RAD_E_UNSUPPORTED for any other encoding. */
|
||||
int grid_tcq_decode(const RadEncoding* e, int64_t rows_all, int64_t cols, const void* const* planes,
|
||||
int64_t row0, int64_t rows, float* out);
|
||||
|
||||
/* Write a scale (and a zero) into element `i` of its plane row. */
|
||||
void grid_store_scale(const Grid& g, const BlockScale& b, void* scale_row, void* zero_row,
|
||||
int64_t i);
|
||||
@@ -143,6 +223,10 @@ struct Planes {
|
||||
uint8_t* zero = nullptr;
|
||||
uint8_t* scale2 = nullptr;
|
||||
uint8_t* table = nullptr;
|
||||
uint8_t* grid = nullptr;
|
||||
uint8_t* mad = nullptr;
|
||||
uint8_t* colf = nullptr;
|
||||
int64_t colf_cols = 0;
|
||||
int64_t codes_row = 0, scale_row = 0, zero_row = 0, scale2_row = 0; /* bytes */
|
||||
int64_t scale_cols = 0, scale2_cols = 0; /* elements a row */
|
||||
};
|
||||
@@ -159,6 +243,7 @@ struct Scales {
|
||||
int64_t br = 1, bc = 1; /* their extents, resolved against the call */
|
||||
std::vector<float> s2; /* the second level as stored */
|
||||
int64_t nr2 = 0, nc2 = 0;
|
||||
std::vector<float> colf; /* tcq_colf: each 128-column block's factor, all rows' */
|
||||
const BlockScale& at(int64_t r, int64_t c) const {
|
||||
return b[(size_t)((r / br) * nc + c / bc)];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user