Archived
radiance 2.0.0
Radiance becomes a multi-model engine: one process serves several models behind one port, loads each when a request names it, parks it in host memory or restores it from its container, and shares the cards between them (docs/MULTIMODEL.md). The configuration is one YAML file; the command line flags are gone (`radiance --config FILE`, hot reload on SIGHUP). Formats. IQ8R (rotated int8) and IQR-V4 replace FP8 and MXFP4 as whole-model formats, with an int8 KV cache (`kv-cache-dtype: i8`) in place of the fp8 one. Containers whose weights are block FP8, MXFP4, M2XFP4, NVFP4 or ParoQuant are refused at startup by the name of the first such weight. Not served until they have int8 containers: GLM-5.3-Flash, Ornith-1.5, Sage-A1.5, Nemotron-3.5-Bolt-74B, Ling-3.0-flash, drama-3 and Anima's FP8 container; Nemotron-3.5-Bolt-E4B, the Gemma 4 31B DFlash containers and MiniCPM5-2B bf16 serve without their drafter. 1.17.0 serves all of them. Speed. Chained launches for Qwen3.8-27B, Gemma 4, Gemma 3 and the small bf16 models, a new Qwen3.8-Flash-Next container (IQR-V4 experts, int8 trunk) with its decode step and prefill reworked, and a reworked adaptive draft window. Deployment. deploy/compose has two fleet files, tp1.yaml and tp2.yaml, each with its configuration beside it, in place of the per-model files. `host-pool-mib` is a model's host pool in all, split among its ranks. The dashboard is rebuilt: an hour of history kept by the server, each accelerator's memory by model, model states over time. Merged since 1.17.0: Nemotron-3.5-Bolt-74B-A9B by keptn42 (#339); GLM-5.3-Flash on four cards by AnimusNull (#397); chained launches for Flash-Next's decode step (#396) and preempted requests keeping their prefix and place (#405) by mici81; --prefill-interleave auto by Code000 (#410); eight more libr3d kernels and the w4a4 reference by RikshaDriver (#403, #407, #408); libr3d large-BAR and E4M3 decode fixes by neuromanMD (#438, #439); int4/int5 decode tiles by Kezi (#426); attention for Nanbeige 4.3 33B by everplays (#417); expert_stats_report.py by baKon (#431). Fixed: #398, #402, #419, #437 (dschmitz's patch); added the metrics of #392, and multi-model serving as asked for in #367 and #109. Plugin ABI 39: out-of-tree plugins need to be rebuilt. Thanks to @keptn42, @AnimusNull, @mici81, @Code000, @RikshaDriver, @neuromanMD, @Kezi, @everplays, @baKon and @dschmitz.
This commit is contained in:
1 parent
b4c04b6042
commit
ddcb9c69bb
696 files changed
+120770
-56596
No files matched your search
+60
-23
@@ -80,6 +80,7 @@ struct Gather {
|
||||
std::vector<uint8_t> kind; /* per row: a RowCache::Found, or PAD / DONE below */
|
||||
std::vector<SpanRead> reads; /* the rows this thread reads */
|
||||
std::vector<long long> waits; /* rows another thread is reading */
|
||||
std::vector<long long> later; /* the other ranks' share of a decode gather, unclaimed so far */
|
||||
std::vector<long long> again; /* rows whose slot changed under the decode */
|
||||
/* One decode batch: each row's source and destination and, for cached rows, its call index
|
||||
* and the slot word it was read under. */
|
||||
@@ -618,12 +619,13 @@ int read_and_publish(const TableFile& tf, RowCache& rc, ReadRing& rr, Gather& g,
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
/* The decode regime: a step wants a hundred-odd rows now, and never waits on another thread's read.
|
||||
* Rows READY in the cache decode from it; a missing row whose slot is free to take is claimed and
|
||||
* read into the cache, so the ranks' gathers and the later steps that meet the same trigram find it
|
||||
* READY instead of reading the file again (Flash-Next decode at c4 lost 2.5% when these reads were
|
||||
* never cached); a row another thread is reading, or one with no slot, is read straight into its
|
||||
* output row. */
|
||||
/* The decode regime: a step wants a hundred-odd rows now, and never waits on the reader thread's
|
||||
* read. Rows READY in the cache decode from it; a missing row whose slot is free to take is claimed
|
||||
* and read into the cache, so the ranks' gathers and the later steps that meet the same trigram
|
||||
* find it READY instead of reading the file again (Flash-Next decode at c4 lost 2.5% when these
|
||||
* reads were never cached); a row the reader thread holds, or one with no slot, is read straight
|
||||
* into its output row, and one another rank's gather is reading is waited for. The ranks split a
|
||||
* step's missing rows between them (gather_ondemand). */
|
||||
constexpr long long kOnDemandMaxRows = 4096;
|
||||
|
||||
/* Decode-sized gathers reading now. The reader thread starts no batch while any is (see the reader
|
||||
@@ -660,31 +662,66 @@ int gather_ondemand(const TableFile& tf, RowCache& rc, ReadRing& rr, const avx::
|
||||
g.reads.clear();
|
||||
g.again.clear();
|
||||
g.waits.clear();
|
||||
g.later.clear();
|
||||
const uint64_t reader = g_reader_tag.load(std::memory_order_acquire);
|
||||
for (long long m = 0; m < M; ++m) {
|
||||
uint16_t* dst = q.out + m * x_ld;
|
||||
if (pad(row_of(m))) { std::memset(dst, 0, (size_t)ne * sizeof(uint16_t)); continue; }
|
||||
auto hit = [&](long long m, int64_t s, uint64_t key) {
|
||||
g.src.push_back(rc.data + (size_t)s * (size_t)n);
|
||||
g.dst.push_back(q.out + m * x_ld);
|
||||
g.dm.push_back(m);
|
||||
g.dw.push_back(RowCache::ready(key));
|
||||
};
|
||||
auto theirs_waits = [&](int64_t s) {
|
||||
return s >= 0 && ((rc.word[s].load(std::memory_order_acquire) >> 2) & 255) != reader;
|
||||
};
|
||||
/* Finds or claims row m: READY decodes from the cache, a row another rank thread is reading is
|
||||
* waited for below instead of read a second time (both ranks gather the same rows, so reading
|
||||
* it again doubled decode's reads), and the reader's THEIRS, MINE (a row twice in one call)
|
||||
* and NONE are read directly. */
|
||||
auto claim = [&](long long m) {
|
||||
const uint64_t key = key_of(m);
|
||||
int64_t s = -1;
|
||||
const RowCache::Found f = rc.find_or_claim(key, me, &s);
|
||||
g.slot[m] = s;
|
||||
if (f == RowCache::HIT) hit(m, s, key);
|
||||
else if (f == RowCache::THEIRS && theirs_waits(s)) g.waits.push_back(m);
|
||||
else g.reads.push_back({m, key, f == RowCache::CLAIMED ? s : -1});
|
||||
};
|
||||
/* A direct read costs its thread a few microseconds to submit and to complete, and the ranks'
|
||||
* threads gather the same rows at the same moment: whichever scanned first used to claim every
|
||||
* missing row and read them all alone while the other waited (47 rows, 380 us, on Flash-Next
|
||||
* at one sequence under the draft head, longer than the first layer runs: the card idled). So
|
||||
* a rank first claims only its share, the rows m with m % world_size == rank, and leaves the
|
||||
* rest, which it takes up after its own reads: by then the other ranks have claimed theirs and
|
||||
* it waits for those, and whatever nobody claimed (a rank that is not there) it reads itself. */
|
||||
const long long share = q.world_size > 1 ? q.world_size : 1;
|
||||
for (long long m = 0; m < M; ++m) {
|
||||
if (pad(row_of(m))) {
|
||||
std::memset(q.out + m * x_ld, 0, (size_t)ne * sizeof(uint16_t));
|
||||
continue;
|
||||
}
|
||||
if (m % share == q.rank % share) { claim(m); continue; }
|
||||
const uint64_t key = key_of(m);
|
||||
int64_t s = -1;
|
||||
const RowCache::Found f = rc.lookup(key, &s);
|
||||
g.slot[m] = s;
|
||||
if (f == RowCache::HIT) {
|
||||
g.src.push_back(rc.data + (size_t)s * (size_t)n);
|
||||
g.dst.push_back(dst);
|
||||
g.dm.push_back(m);
|
||||
g.dw.push_back(RowCache::ready(key));
|
||||
} else if (f == RowCache::THEIRS && s >= 0 &&
|
||||
((rc.word[s].load(std::memory_order_acquire) >> 2) & 255) != reader) {
|
||||
/* Another rank thread is reading it: wait below instead of reading it a second time
|
||||
* (both ranks gather the same rows, so reading it again doubled decode's reads). */
|
||||
rc.ref[s].store(1, std::memory_order_relaxed);
|
||||
hit(m, s, key);
|
||||
} else if (f == RowCache::THEIRS && theirs_waits(s)) {
|
||||
g.waits.push_back(m);
|
||||
} else {
|
||||
/* The reader's THEIRS, MINE (a row twice in one call) and NONE are read directly. */
|
||||
g.reads.push_back({m, key, f == RowCache::CLAIMED ? s : -1});
|
||||
g.later.push_back(m);
|
||||
}
|
||||
}
|
||||
const UrgentReads urgent;
|
||||
if (!g.reads.empty()) {
|
||||
/* This rank's share, then what is left of the others' (see above): each batch is read and
|
||||
* published before the next is claimed. */
|
||||
for (int pass = 0; pass < 2; ++pass) {
|
||||
if (pass == 1) {
|
||||
g.reads.clear();
|
||||
for (long long m : g.later) claim(m);
|
||||
}
|
||||
if (g.reads.empty()) continue;
|
||||
const int rs = read_and_publish(tf, rc, rr, g, g.reads.data(), g.reads.size(), n, ne,
|
||||
decode, lut, q.out, x_ld);
|
||||
if (rs != RAD_OK) return rs;
|
||||
@@ -697,9 +734,9 @@ int gather_ondemand(const TableFile& tf, RowCache& rc, ReadRing& rr, const avx::
|
||||
g.dw.push_back(RowCache::ready(r.key));
|
||||
}
|
||||
}
|
||||
/* Wait for the other rank's reads, as gather_rows does. This thread's own reads are done, so no cycle: the other rank reads its claims before it
|
||||
* waits. A row that turns READY decodes from the cache; one released or taken over is read
|
||||
* directly below. */
|
||||
/* Wait for the other ranks' reads, as gather_rows does. This thread's own reads are done, so
|
||||
* no cycle: every rank reads its claims before it waits. A row that turns READY decodes from
|
||||
* the cache; one released or taken over is read directly below. */
|
||||
while (!g.waits.empty()) {
|
||||
const uint32_t e = rc.published.load(std::memory_order_acquire);
|
||||
size_t keep = 0;
|
||||
|
||||
Reference in new issue
Block a user