Archived
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
This commit is contained in:
1 parent
b068190326
commit
1e968f6e1d
739 files changed
+128447
-84632
No files matched your search
+25
-31
@@ -1,11 +1,9 @@
|
||||
/* encoding.h -- the core's half of a weight encoding: decoding one to f32, and cutting a plane for
|
||||
/* encoding.h -- the core's half of a weight encoding: decoding to f32, and cutting a plane for
|
||||
* tensor parallelism. The encoding itself is abi/rad_encoding.h; spec.md §4.1.
|
||||
*
|
||||
* The core decodes the two schemes it defines, "plain" and "affine", under every transform the
|
||||
* ABI names, and nothing else: a quantiser that invents a scheme decodes it (abi/rad_quant.h). The
|
||||
* decoder is what the oracle checks a kernel through, what rad-convert measures a quantiser's
|
||||
* error with, and what a weight is read back through to be quantised again -- three consumers
|
||||
* that must agree on what a stored weight means, which is why there is one of it.
|
||||
* The core decodes its two schemes, "plain" and "affine", under every ABI transform; a quantiser
|
||||
* that defines another scheme supplies its decoder (abi/rad_quant.h). The oracle, rad-convert's
|
||||
* error measurement and re-quantisation all decode through this one implementation.
|
||||
*/
|
||||
#pragma once
|
||||
#include "../rad_internal.h"
|
||||
@@ -34,23 +32,22 @@ struct EncodedView {
|
||||
void enc_view(const RadEncoding& e, int64_t rows, int64_t cols, const void* const* data,
|
||||
EncodedView* v);
|
||||
|
||||
/* Decode logical rows [row0, row0 + n) into `out`, f32 [n, cols]. Returns RAD_OK, or
|
||||
* RAD_E_UNSUPPORTED for a scheme the core does not decode (with `why` saying which), RAD_E_SHAPE
|
||||
* when a transform does not fit the row, or RAD_E_FORMAT for a malformed encoding or a code its
|
||||
* codebook has no entry for -- a corrupt file, said so, rather than a read past a table. */
|
||||
/* Decode logical rows [row0, row0 + n) into `out`, f32 [n, cols]. RAD_OK; RAD_E_UNSUPPORTED for
|
||||
* a scheme nobody decodes (`why` names it); RAD_E_SHAPE when a transform does not fit the row;
|
||||
* RAD_E_FORMAT for a malformed encoding or a code outside its codebook (rather than a read past
|
||||
* the table). */
|
||||
int enc_decode_rows(const EncodedView& v, int64_t row0, int64_t n, float* out,
|
||||
std::string* why = nullptr);
|
||||
|
||||
/* THE DECODERS FOR SCHEMES THE CORE DOES NOT DEFINE: quantisers' own (RadQuantDecodeFn). The
|
||||
* plugin loader adds each loaded quantiser's and removes them when it unloads; enc_decode_rows
|
||||
* asks them in that order for any scheme but plain and affine. */
|
||||
/* Decoders for schemes the core does not define (RadQuantDecodeFn), registered by the plugin
|
||||
* loader per quantiser; enc_decode_rows asks them in order for any scheme but plain and affine. */
|
||||
void enc_add_decoder(RadQuantDecodeFn fn);
|
||||
void enc_remove_decoder(RadQuantDecodeFn fn);
|
||||
|
||||
/* The unnormalised Sylvester Walsh-Hadamard transform of `n` values in place, `n` a power of two.
|
||||
* The butterfly keeps (a + b) in the lower index and (a - b) in the upper, which is H_n in
|
||||
* natural (Sylvester) order -- the transform libr4d's r4d_fwht_wave computes in registers, and the
|
||||
* one an "fwhtN" encoding names. H_n is symmetric and H_n H_n = n I. */
|
||||
/* Unnormalised Walsh-Hadamard transform of `n` values in place, `n` a power of two. The butterfly
|
||||
* keeps (a + b) in the lower index and (a - b) in the upper: H_n in natural (Sylvester) order, as
|
||||
* libr4d's r4d_fwht_wave computes and an "fwhtN" encoding names. H_n is symmetric and
|
||||
* H_n H_n = n I. */
|
||||
void fwht_inplace(float* v, int64_t n);
|
||||
|
||||
/* The canonical spelling of an encoding (rad_enc_format), as a string. */
|
||||
@@ -58,15 +55,13 @@ std::string enc_name(const RadEncoding& e);
|
||||
|
||||
/* ================================================================== a selection, as a reader reads it
|
||||
*
|
||||
* The `n_sel` planes of `e` a declaration selects (RadWeightDecl::planes) -- plane `sel[k]` at
|
||||
* `data[k]`, dense [rows[k], cols[k]] in its own elements -- as `n` elements of dtype `dt` at
|
||||
* `out`: the tensor a reference implementation reads where a kernel reads the stored form. One
|
||||
* plane is converted element by element (a bf16 scale plane into an f32 reference, codes as their
|
||||
* values); codes with the scalar codebook they index, each code as its table entry; a scale with
|
||||
* the levels of its chain above it, each scale as their product; the whole encoding is decoded.
|
||||
* RAD_OK, or RAD_E_SHAPE with `why` when the planes do not make that tensor -- part of an
|
||||
* encoding, which decodes to nothing on its own, or extents that disagree with `n`; or the
|
||||
* decoder's own refusal. */
|
||||
* The `n_sel` planes of `e` a declaration selects (RadWeightDecl::planes; plane `sel[k]` at
|
||||
* `data[k]`, dense [rows[k], cols[k]] in its own elements) as `n` elements of dtype `dt` at `out`:
|
||||
* the tensor a reference implementation reads in place of the stored form. A single plane converts
|
||||
* element by element; codes with their scalar codebook become table entries; a scale with its
|
||||
* chain's higher levels becomes their product; the whole encoding is decoded. RAD_OK, or
|
||||
* RAD_E_SHAPE with `why` when the planes do not form that tensor (an incomplete encoding, or
|
||||
* extents disagreeing with `n`), or the decoder's refusal. */
|
||||
int enc_selection_logical(const RadEncoding& e, const int* sel, int n_sel, const int64_t* rows,
|
||||
const int64_t* cols, const void* const* data, uint32_t dt, int64_t n,
|
||||
void* out, std::string* why);
|
||||
@@ -78,11 +73,10 @@ struct PlaneRect {
|
||||
int64_t col0 = 0, cols = 0;
|
||||
};
|
||||
|
||||
/* The part of plane `p` that covers logical rows [r0, r1) and columns [c0, c1) of a [rows, cols]
|
||||
* weight. Refused, with `why`, when a bound would split one of the plane's blocks -- a scale that
|
||||
* covers rows two ranks own between them belongs to neither, and taking it twice gives each a
|
||||
* plane that decodes to the right numbers for the wrong rows. The weight's own end is never a
|
||||
* split: a last block may be short. */
|
||||
/* The part of plane `p` covering logical rows [r0, r1) and columns [c0, c1) of a [rows, cols]
|
||||
* weight. Refused, with `why`, when a bound would split one of the plane's blocks (a scale shared
|
||||
* by two ranks' rows belongs to neither). The weight's end never splits: a last block may be
|
||||
* short. */
|
||||
int enc_plane_rect(const RadEncPlane& p, int64_t rows, int64_t cols, int64_t r0, int64_t r1,
|
||||
int64_t c0, int64_t c1, PlaneRect* out, std::string* why);
|
||||
|
||||
|
||||
Reference in new issue
Block a user