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
+67
-13
@@ -7,6 +7,7 @@
|
||||
#include "engine_priv.h"
|
||||
#include "rad_internal.h"
|
||||
#include "engine_hostmem.h"
|
||||
#include "kld.h"
|
||||
#include "gen/driver.h"
|
||||
#include "gen/audio_driver.h"
|
||||
#include "gen/video_driver.h"
|
||||
@@ -987,6 +988,12 @@ RadBuildCtx Engine::build_ctx(int rank, int64_t max_tok) const {
|
||||
bc.attn_prefill_fp8 = cfg_.attn_prefill_fp8;
|
||||
bc.tp_attn_rows = cfg_.tp_attn_rows;
|
||||
bc.weight_prefetch_off = cfg_.weight_prefetch ? 0 : 1;
|
||||
bc.calib_dir = cfg_.calib_dir.empty() ? nullptr : cfg_.calib_dir.c_str();
|
||||
bc.calib_layer_lo = cfg_.calib_layer_lo;
|
||||
bc.calib_layer_hi = cfg_.calib_layer_hi;
|
||||
bc.calib_tokens = calib_ ? calib_->n_tokens() : calib_tokens_;
|
||||
bc.gen_max_pixels = cfg_.image_gen_max_pixels;
|
||||
bc.gen_max_refs = cfg_.image_gen_max_refs;
|
||||
bc.state_dtype = cfg_.state_cache_dtype == "f16" ? RAD_F16 : 0;
|
||||
bc.draft_coupling = cfg_.draft_coupling ? 1 : 0;
|
||||
bc.tp_wire_min_bytes = cfg_.tp_wire_min_kb * 1024;
|
||||
@@ -1020,7 +1027,7 @@ RadBuildCtx Engine::build_ctx(int rank, int64_t max_tok) const {
|
||||
int Engine::declare() {
|
||||
/* An architecture that declares no streamed ops cannot stream, so with --kv-resident set on one
|
||||
* the flag is turned off here, with the decision named, before anything is planned for it. */
|
||||
(void)rad_tools_probe(plugins_, meta_, &arch_probe_);
|
||||
(void)rad_tools_probe(plugins_, meta_, &arch_probe_, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
if (cfg_.kv_resident > 0 && arch_probe_.kv_stream_ok == 0) {
|
||||
cfg_.kv_resident = 0;
|
||||
decide("--kv-resident", "0",
|
||||
@@ -1045,13 +1052,43 @@ int Engine::declare() {
|
||||
"the KL mode: a prefix hit would start a document past positions the reference holds";
|
||||
decide("--no-prefix-cache", "prefix caching off", prefix_off_why_);
|
||||
}
|
||||
/* --calib-corpus: every token of the corpus through prefill exactly once, so no prefix hit
|
||||
* skips any and no drafter adds rows; the corpus is loaded here, before the plugins declare,
|
||||
* because they are told its size. */
|
||||
if (cfg_.calib()) {
|
||||
if (cfg_.n_spec > 0) {
|
||||
RAD_ERR("--num-speculative-tokens %d: a calibration run drafts nothing; leave it at "
|
||||
"auto or 0", cfg_.n_spec);
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
cfg_.n_spec = 0;
|
||||
cfg_.prefix_cache = false;
|
||||
if (cfg_.mm_max_patches < 0) cfg_.mm_max_patches = 0;
|
||||
decide("--num-speculative-tokens", "0", "a calibration run records the trunk's rows only");
|
||||
prefix_off_why_ = "a calibration run: a prefix hit would skip tokens the statistics must count";
|
||||
decide("--no-prefix-cache", "prefix caching off", prefix_off_why_);
|
||||
calib_ = std::make_unique<Kld>();
|
||||
RAD_TRY(calib_->load(cfg_.calib_corpus, vocab_));
|
||||
RAD_INFO("calib: %zu documents, %lld tokens from %s", calib_->n_docs(),
|
||||
(long long)calib_->n_tokens(), cfg_.calib_corpus.c_str());
|
||||
}
|
||||
/* --kld-record beside --calib-dir: the reference's run records the statistics too, over the
|
||||
* KL corpus, whose size the plugins are told here; run_kld then feeds the documents so that
|
||||
* none is preempted. */
|
||||
if (!cfg_.kld_record.empty() && !cfg_.calib_dir.empty()) {
|
||||
Kld count;
|
||||
RAD_TRY(count.load(cfg_.kld_corpus, vocab_));
|
||||
calib_tokens_ = count.n_tokens();
|
||||
RAD_INFO("calib: recorded beside the reference, %zu documents, %lld tokens from %s",
|
||||
count.n_docs(), (long long)calib_tokens_, cfg_.kld_corpus.c_str());
|
||||
}
|
||||
/* An image generator sizes the step itself (RadArchProbe::gen_rows): a denoise pass carries all
|
||||
* of an image's latent rows (twice with guidance), and a conditioning pass encodes every
|
||||
* reference picture of a request. Operator-given values are kept. No drafting (no tokens) and
|
||||
* no prefix cache (a conditioning is read only by its own request). */
|
||||
{
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
if (pb.gen_rows > 0 && pb.gen_audio) {
|
||||
if (!cfg_.given.count("--max-num-batched-tokens")) {
|
||||
cfg_.max_tok = pb.gen_rows;
|
||||
@@ -1131,7 +1168,7 @@ int Engine::declare() {
|
||||
if (cfg_.kv_cache_dtype == "fp8_v4" || cfg_.kv_cache_dtype == "k6_v4") {
|
||||
const int q = cfg_.kv_cache_dtype == "fp8_v4" ? RAD_KVQ_V4 : RAD_KVQ_K6V4;
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
if (!(pb.kv_quant_ok & (1 << q))) {
|
||||
RAD_ERR("--kv-cache-dtype %s: the '%s' plugin does not serve it for this model "
|
||||
"(fp8 does)", cfg_.kv_cache_dtype.c_str(), plugins_.arch_plugin.c_str());
|
||||
@@ -1144,7 +1181,7 @@ int Engine::declare() {
|
||||
* than ignored. */
|
||||
if (cfg_.tp_attn_rows) {
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
if (!pb.tp_attn_rows_ok) {
|
||||
RAD_ERR("--tp-attn-split rows: the '%s' plugin does not split attention by rows for "
|
||||
"this model (heads does)", plugins_.arch_plugin.c_str());
|
||||
@@ -1163,7 +1200,7 @@ int Engine::declare() {
|
||||
* under a flag that promised half the state memory. */
|
||||
if (cfg_.state_cache_dtype == "f16") {
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
if (!pb.state_f16_ok) {
|
||||
RAD_ERR("--state-cache-dtype f16: the '%s' plugin does not declare its recurrent state "
|
||||
"at f16 for this model (f32 does)", plugins_.arch_plugin.c_str());
|
||||
@@ -1178,7 +1215,7 @@ int Engine::declare() {
|
||||
* drafter configuration. */
|
||||
if (cfg_.n_spec < 0) {
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
cfg_.n_spec = pb.draft_depth > 0 ? pb.draft_depth : 0;
|
||||
if (cfg_.n_spec > 0)
|
||||
RAD_INFO("speculation: depth %d, this drafter's own operating point "
|
||||
@@ -1196,7 +1233,7 @@ int Engine::declare() {
|
||||
* speculatively. */
|
||||
{
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
const bool pays = cfg_.n_spec > 0 && pb.chain_pays;
|
||||
rad_dev_chain_infer(pays);
|
||||
const bool on = rad_dev_chain_enabled() != 0;
|
||||
@@ -1213,7 +1250,7 @@ int Engine::declare() {
|
||||
* A tree changes no token, only how many drafts land a step. */
|
||||
{
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
/* A tree is verified only behind a step issued ahead (step_loop). The KL mode, which issues
|
||||
* none, drafts nothing either (n_spec is 0 there by now), so this never runs under it. */
|
||||
draft_tree_ = cfg_.n_spec > 0 && pb.tree_pays != 0;
|
||||
@@ -1229,7 +1266,7 @@ int Engine::declare() {
|
||||
const char* enc = rad_meta_gets(&meta_, "radiance.encoder", "");
|
||||
const bool named = enc && std::strstr(enc, "audio") != nullptr;
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
const bool text_only = cfg_.mm_max_patches == 0;
|
||||
cfg_.mm_audio_frames = !text_only && pb.audio_frames > 0 && (named || !file_)
|
||||
? pb.audio_frames : 0;
|
||||
@@ -1247,7 +1284,7 @@ int Engine::declare() {
|
||||
cfg_.mm_max_patches = (enc && *enc) || (!file_ && tower) ? 16384 : 0;
|
||||
/* Whole output rows a pass: the plugin's merge, when it states one. */
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
if (cfg_.mm_max_patches > 0 && pb.enc_merge > 1)
|
||||
cfg_.mm_max_patches -= cfg_.mm_max_patches % pb.enc_merge;
|
||||
if (cfg_.mm_max_patches == 0 && tower)
|
||||
@@ -1273,7 +1310,7 @@ int Engine::declare() {
|
||||
"refused");
|
||||
} else {
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
if (!pb.control_vector_ok) {
|
||||
RAD_ERR("--control-vector %s: the '%s' plugin does not apply control vectors for this "
|
||||
"model", cfg_.control_vector.c_str(), plugins_.arch_plugin.c_str());
|
||||
@@ -1496,6 +1533,12 @@ int Engine::declare() {
|
||||
RAD_INFO("speculation: '%s' proposes a tree of %d node(s); each verify follows the deepest "
|
||||
"path the target agrees with, and that path's K and V move into place",
|
||||
drafter_.name, drafter_.depth);
|
||||
if (cfg_.spec_ngram > 0 && drafter_.kind != RAD_DRAFT_NONE) {
|
||||
RAD_ERR("--spec-ngram drafts by prompt lookup alone, and this container declares the draft "
|
||||
"head '%s'; serve it with --num-speculative-tokens N, where prompt lookup fills in "
|
||||
"for the sequences the head declines", drafter_.name);
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
if (drafter_.kind != RAD_DRAFT_NONE) {
|
||||
/* A zero proposal handle means the sampler's token buffer: the head's logits go through
|
||||
* the ordinary sampler chain. */
|
||||
@@ -1540,7 +1583,7 @@ static constexpr int64_t kArenaGuard = 1ll << 20;
|
||||
void Engine::probe_arena_levels() {
|
||||
for (auto& r : ranks_) r->arena_levels.clear();
|
||||
RadArchProbe pb{};
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb);
|
||||
(void)rad_tools_probe(plugins_, meta_, &pb, cfg_.image_gen_max_pixels, cfg_.image_gen_max_refs);
|
||||
if (!pb.shape_probe_ok) {
|
||||
RAD_INFO("activation arena: not lent -- the '%s' plugin does not declare at a smaller step "
|
||||
"size (RadArchProbe::shape_probe_ok)", plugins_.arch_plugin.c_str());
|
||||
@@ -1698,6 +1741,10 @@ int Engine::plan() {
|
||||
rad_dev_props(r->device, &props);
|
||||
f.capacity = props.vram_bytes;
|
||||
f.free = props.vram_free;
|
||||
/* Unified memory: the pinned host pool is the same RAM as the card, so the
|
||||
* budget charges it against the one ledger. */
|
||||
f.unified = props.unified != 0;
|
||||
f.host_pinned = f.unified ? cfg_.host_pool_mib * ((int64_t)1 << 20) : 0;
|
||||
/* On integrated graphics an eighth of host memory stays the host's, on top of the free
|
||||
* figure's own bound (core/device/hip.cpp), so the OS is not driven to reclaim and
|
||||
* kill. */
|
||||
@@ -3478,7 +3525,11 @@ int Engine::configure_kv() {
|
||||
"to move. --prefix-cache-mib does nothing here.");
|
||||
} else {
|
||||
IdleTiers::Config tc;
|
||||
tc.host_cap_bytes = cfg_.prefix_cache_mib << 20;
|
||||
/* Unified memory: the host tier is the same RAM as the device tier, so the
|
||||
* tiers collapse to resident -- no capacity on the host side, nothing moves. */
|
||||
RadDeviceProps tprops{};
|
||||
rad_dev_props(ranks_[0]->device, &tprops);
|
||||
tc.host_cap_bytes = tprops.unified ? 0 : (cfg_.prefix_cache_mib << 20);
|
||||
tc.entry_bytes = slot_bytes;
|
||||
tc.ckpt_bytes = ck_slot_bytes;
|
||||
tc.ckpt_slots = ck_store_.capacity();
|
||||
@@ -3659,6 +3710,9 @@ int Engine::start() {
|
||||
cfg_.tp, cfg_.tp, devs.size(), inventory.c_str());
|
||||
return RAD_E_DEVICE;
|
||||
}
|
||||
/* The machine before the model: a refusal here costs a second, after the load it costs the
|
||||
* load. */
|
||||
RAD_TRY(check_configuration(devs));
|
||||
|
||||
RAD_TRY(read_metadata());
|
||||
if (cfg_.max_ctx == 0)
|
||||
|
||||
Reference in new issue
Block a user