Archived
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:
commit
b93b531f63
127 files changed
+9609
-4796
No files matched your search
+63
-5
@@ -80,7 +80,7 @@ int strategy_parse(const char* s, Strategy* out) {
|
||||
Budgets Budgets::from(const Config& c) {
|
||||
Budgets b;
|
||||
b.vram_weights = c.vram_weights_mib * 1024 * 1024;
|
||||
b.host_pool = (c.host_pool_mib + c.embedding_host_mib) * 1024 * 1024;
|
||||
b.host_pool = c.host_pool_total_mib() * 1024 * 1024;
|
||||
b.ssd = c.weights_disk_tier;
|
||||
return b;
|
||||
}
|
||||
@@ -146,7 +146,8 @@ void weight_footprint(const Program& prog, WeightFootprint* out, TablePlacement
|
||||
/* build_units: a model-level weight is its own unit, everything else groups by the declared
|
||||
* (layer, expert). Ordered, for the same reason build_units is. */
|
||||
struct U { int32_t layer = -1, expert = -1; int64_t bytes = 0; bool mapped = false;
|
||||
bool emb = false, ngram = false, host = true, direct = true; };
|
||||
bool emb = false, ngram = false, host = true, direct = true;
|
||||
int access = -1; };
|
||||
std::map<std::pair<int32_t, int32_t>, size_t> by_group;
|
||||
std::vector<U> units;
|
||||
|
||||
@@ -177,6 +178,9 @@ void weight_footprint(const Program& prog, WeightFootprint* out, TablePlacement
|
||||
if (w < device_ok.size() && !device_ok[w]) mu.mapped = true;
|
||||
if (!weight_file_direct(wi, prog.ctx.world_size)) mu.direct = false;
|
||||
if (w < host_ok.size() && !host_ok[w]) mu.host = false;
|
||||
/* build_units: the group's strongest access class, which says whether it is a tower's. */
|
||||
if (mu.access < 0 || access_strength(wi.decl.access) > access_strength(mu.access))
|
||||
mu.access = wi.decl.access;
|
||||
/* The placement flags' tables: model-level, so the unit is this one weight. */
|
||||
if (layer < 0) {
|
||||
mu.emb = is_embedding_table(prog, w);
|
||||
@@ -198,6 +202,8 @@ void weight_footprint(const Program& prog, WeightFootprint* out, TablePlacement
|
||||
if (mu.emb && !mu.mapped) out->embedding += b;
|
||||
if (mu.ngram) out->ngram += b;
|
||||
if (mu.ngram && !mu.mapped) out->ngram_device = true;
|
||||
/* pin_towers moves an encoder tower's unit out of the statics on the same test. */
|
||||
if (mu.access == RAD_ACCESS_PER_REQUEST && !mu.mapped && mu.expert < 0) out->tower += b;
|
||||
/* pin_mapped: an n-gram table a device kernel reads stays off the card unless it was
|
||||
* placed in VRAM. */
|
||||
if (mu.mapped || (mu.ngram && ngram != TablePlacement::Vram)) out->mapped += b;
|
||||
@@ -1073,7 +1079,7 @@ void Planner::finish(const Program& prog, Plan* p) {
|
||||
pl.reason = mu.reason;
|
||||
pl.bytes = weight_bytes(prog.weights[w]);
|
||||
p->totals.bytes[(int)mu.tier] += pl.bytes;
|
||||
if (mu.host_forced) p->embedding_host_used += pl.bytes;
|
||||
if (mu.host_forced) p->forced_host_used += pl.bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1142,6 +1148,53 @@ int Planner::pin_embedding(const Program& prog, const Config& cfg, Plan* p) cons
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* --vision-tower-placement ram: EVERY UNIT OF AN ENCODER TOWER goes to the pinned host pool before
|
||||
* any strategy runs, as the embedding does, at the DeviceZeroCopy site: the encoder's kernels read
|
||||
* the weights over the link in place, once an image or a clip, and a text-only request never
|
||||
* touches them. A tower's unit is one whose every weight the architecture declared read once per
|
||||
* request (RAD_ACCESS_PER_REQUEST) -- the test weight_footprint counted out of the statics with,
|
||||
* so the budget the card was split by is the one spent here. The test is the access class and not
|
||||
* the unit's level: a tower is model-level weights (a stem, a merger) and a layer unit a block. */
|
||||
int Planner::pin_towers(const Config& cfg, Plan* p) const {
|
||||
if (cfg.tower_resolved != TablePlacement::Ram) return RAD_OK;
|
||||
auto tower = [](const MoveUnit& mu) {
|
||||
return mu.access == RAD_ACCESS_PER_REQUEST && mu.expert < 0 && mu.tier != Tier::Mapped &&
|
||||
!mu.host_forced;
|
||||
};
|
||||
int64_t need = 0, n = 0;
|
||||
for (const MoveUnit& mu : p->units)
|
||||
if (tower(mu)) { need += mu.slot_bytes; ++n; }
|
||||
/* Engine::plan resolves Ram only where weight_footprint found a tower with this same test. */
|
||||
if (!n) {
|
||||
RAD_ERR("placement: --vision-tower-placement ram, and this rank's program has no weight it "
|
||||
"reads once per request");
|
||||
p->notes.push_back("--vision-tower-placement ram: no encoder tower to place");
|
||||
return RAD_E_STATE;
|
||||
}
|
||||
if (need > p->host_budget) {
|
||||
RAD_ERR("placement: --vision-tower-placement ram: the encoder towers need %s of the pinned "
|
||||
"host pool and %s of it is left%s", humanb(need).c_str(),
|
||||
humanb(p->host_budget).c_str(),
|
||||
p->file_stage_reserve ? " after the file tier's staging" : "");
|
||||
p->notes.push_back(fmt("--vision-tower-placement ram: the encoder towers (%s) do not fit "
|
||||
"the host pool", humanb(need).c_str()));
|
||||
return RAD_E_NOMEM;
|
||||
}
|
||||
for (MoveUnit& mu : p->units) {
|
||||
if (!tower(mu)) continue;
|
||||
p->host_budget -= mu.slot_bytes;
|
||||
p->tower_host_bytes += mu.slot_bytes;
|
||||
mu.tier = Tier::HostPinned;
|
||||
mu.site = Site::DeviceZeroCopy;
|
||||
mu.movable = false;
|
||||
mu.host_forced = true;
|
||||
mu.reason = "--vision-tower-placement ram; read over the link in place";
|
||||
}
|
||||
RAD_INFO("placement: the encoder towers, %lld units (%s), in the pinned host pool, read in place "
|
||||
"(--vision-tower-placement ram)", (long long)n, humanb(need).c_str());
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ plan */
|
||||
int Planner::plan(Plan* out) {
|
||||
if (!out || !in_.program || !in_.config) return RAD_E_INVAL;
|
||||
@@ -1216,7 +1269,9 @@ int Planner::plan(Plan* out) {
|
||||
}
|
||||
|
||||
/* NOT a RAD_TRY: a refusal still leaves `out` filled in far enough to print. */
|
||||
const int hrc = pin_embedding(prog, cfg, out);
|
||||
int hrc = pin_embedding(prog, cfg, out);
|
||||
const int trc = pin_towers(cfg, out);
|
||||
if (hrc >= 0) hrc = trc;
|
||||
|
||||
int rc = assign(out);
|
||||
enforce_op_site_agreement(prog, out);
|
||||
@@ -1329,7 +1384,7 @@ std::string Plan::report(const Program& prog) const {
|
||||
humanb(totals.bytes[(int)Tier::VRAM]).c_str());
|
||||
s += fmt(" host pinned %12s %12s\n",
|
||||
host_budget > 0 ? humanb(host_budget).c_str() : "none",
|
||||
humanb(totals.bytes[(int)Tier::HostPinned] - embedding_host_used).c_str());
|
||||
humanb(totals.bytes[(int)Tier::HostPinned] - forced_host_used).c_str());
|
||||
if (totals.bytes[(int)Tier::HostPageable])
|
||||
s += fmt(" host pageable %12s %12s\n", "-",
|
||||
humanb(totals.bytes[(int)Tier::HostPageable]).c_str());
|
||||
@@ -1354,6 +1409,9 @@ std::string Plan::report(const Program& prog) const {
|
||||
if (embedding_host_bytes)
|
||||
s += fmt(" embedding %12s %12s (--embedding-placement ram, pinned, read in place)\n",
|
||||
"-", humanb(embedding_host_bytes).c_str());
|
||||
if (tower_host_bytes)
|
||||
s += fmt(" encoder tower %12s %12s (--vision-tower-placement ram, pinned, read in place)\n",
|
||||
"-", humanb(tower_host_bytes).c_str());
|
||||
if (ngram_copy_bytes)
|
||||
s += fmt(" n-gram copy %12s %12s (--ngram-placement ram, %s, filled at load)\n",
|
||||
"-", humanb(ngram_copy_bytes).c_str(),
|
||||
|
||||
Reference in new issue
Block a user