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
+6
-96
@@ -16,9 +16,6 @@
|
||||
* - a restore in makes the COMPUTE stream wait for it, so the step that reads the restored
|
||||
* blocks runs after they land without the host having waited for anything.
|
||||
*
|
||||
* The disk store is the one part that is synchronous by nature, and it runs on a thread of its own
|
||||
* (TierIO below), so the engine thread never waits on a file either.
|
||||
*
|
||||
* ============================== THE TRANSFER, AND WHY IT IS SHAPED THIS WAY ====================
|
||||
*
|
||||
* A paged pool is LAYER-MAJOR: layer l of group g owns `[base + l*layer_stride, + layer_stride)`
|
||||
@@ -44,20 +41,13 @@
|
||||
#include "plugin/registry.h"
|
||||
#include "rad_core.h"
|
||||
|
||||
#include <functional>
|
||||
#include <condition_variable>
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace rad {
|
||||
|
||||
class SSDTier;
|
||||
|
||||
class TierExec {
|
||||
public:
|
||||
~TierExec();
|
||||
@@ -68,10 +58,10 @@ public:
|
||||
* `max_batch` is the staging buffer in entries, `max_copy` the most entries one copy out may
|
||||
* carry, and `max_chain` the longest chain one restore brings back -- the index buffers are
|
||||
* sized from the last two. */
|
||||
int configure(Registry* reg, KVManager* kv, IdleTiers* tiers, SSDTier* disk,
|
||||
int configure(Registry* reg, KVManager* kv, IdleTiers* tiers,
|
||||
const std::vector<int32_t>& groups, int max_batch, int64_t max_copy,
|
||||
int64_t max_chain, bool leader, int device, int64_t slot_off,
|
||||
const HostArena* ck_store, RadStream shared);
|
||||
RadStream shared);
|
||||
void close();
|
||||
bool enabled() const { return enabled_; }
|
||||
std::string report() const { return report_; }
|
||||
@@ -115,34 +105,14 @@ public:
|
||||
|
||||
/* ---------------- restore ----------------
|
||||
*
|
||||
* Enqueue a chain of ToDevice jobs, in chain order, and make `compute` wait for them. Every
|
||||
* job's bytes are in host memory -- a disk entry was read in first (run_fetch) -- so nothing
|
||||
* here waits on a file. The leader chooses every block first, recalling the loan for the
|
||||
* Enqueue a chain of ToDevice jobs, in chain order, and make `compute` wait for them. The
|
||||
* leader chooses every block first, recalling the loan for the
|
||||
* whole chain at once; a chain the pool cannot hold is cut where the reservation ran out, and
|
||||
* the jobs past the cut are left unstarted. `ok[i]` is whether job i was fully enqueued on
|
||||
* this rank. */
|
||||
int issue_restore(std::vector<TierJob>& jobs, RadStream compute, std::vector<char>* ok);
|
||||
/* A MARK ON THIS RANK'S TRANSFER STREAM, after everything enqueued on it so far -- or on
|
||||
* `on`, the rank's compute stream, when it is given. A restore reads host slots
|
||||
* asynchronously, and a slot it is still reading may be given up and handed to a read off
|
||||
* disk the moment the restore has reported; the IO thread waits for this mark before it
|
||||
* writes into any slot it was handed. A snapshot's store slot is read and written by copies
|
||||
* on the compute stream (KVManager::checkpoint_save), so a disk write or read of one waits
|
||||
* for that stream's mark. Null when nothing was ever enqueued on the transfer stream. The
|
||||
* caller owns the event. */
|
||||
int fence(RadEvent* out, RadStream on = nullptr);
|
||||
|
||||
/* ---------------- the disk store (leader only; TierIO's thread) ---------------- */
|
||||
void run_disk(std::vector<TierJob>& jobs, std::vector<char>* ok);
|
||||
/* One ToDisk job; true when it was written. */
|
||||
bool run_write(TierJob& j);
|
||||
/* ToHost jobs: the blocks read in parallel into the host slots they were given, then the
|
||||
* snapshots into their store slots. `ok[i]` is the blocks' result, `ck_ok` the snapshot's. */
|
||||
void run_fetch(std::vector<TierJob>& jobs, std::vector<char>* ok);
|
||||
|
||||
/* Leader only. Gives back what a failed job held -- a restore's blocks -- reports every job to
|
||||
* the policy, and frees the store slots a finished write or an unclaimed read was holding on
|
||||
* the cache's behalf. `now_ns` is when the pass ran: a promotion is a use. */
|
||||
/* Leader only. Gives back what a failed job held -- a restore's blocks -- and reports every
|
||||
* job to the policy. `now_ns` is when the pass ran: a promotion is a use. */
|
||||
void report_pass(std::vector<TierJob>& jobs, const std::vector<char>& ok, uint64_t now_ns);
|
||||
|
||||
/* A lookup hit off-device: the job that would bring it back, or false when the entry is not
|
||||
@@ -209,14 +179,8 @@ private:
|
||||
Registry* reg_ = nullptr;
|
||||
KVManager* kv_ = nullptr;
|
||||
IdleTiers* tiers_ = nullptr;
|
||||
SSDTier* disk_ = nullptr;
|
||||
std::vector<GroupInfo> gi_;
|
||||
int64_t entry_bytes_ = 0;
|
||||
/* ---- the linear half ----
|
||||
* The engine's snapshot store, whose slots the disk thread writes out and reads back whole --
|
||||
* every rank's shard of a snapshot together. Null on a model with no recurrent state, which
|
||||
* is the whole of the "off" path here. */
|
||||
const HostArena* ck_store_ = nullptr;
|
||||
int max_batch_ = 0;
|
||||
int64_t max_copy_ = 0;
|
||||
int64_t max_chain_ = 0;
|
||||
@@ -275,58 +239,4 @@ private:
|
||||
Stats st_;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------ the disk thread */
|
||||
/* THE DISK STORE ON A THREAD OF ITS OWN. A host-to-disk move is a file write of the whole slot,
|
||||
* and a pass that makes room for a conversation's worth of copies is hundreds of megabytes of it
|
||||
* -- the engine thread would build no step for as long as the writes took. So a batch is handed
|
||||
* over and collected later. The thread touches the host arena and the disk store and nothing
|
||||
* else: every decision about the records is made before the hand-over and after the collection,
|
||||
* on the engine thread, under the scheduler's lock.
|
||||
*
|
||||
* TWO KINDS OF WORK, AND THE READS GO FIRST. A write batch is the background copy to disk: one at
|
||||
* a time, and the engine does not hand over the next until it has collected the last. A read
|
||||
* batch is a conversation a request is waiting on (IdleTiers::plan_fetch), so reads queue in the
|
||||
* order they were asked for and each one is taken ahead of whatever write is out -- between two
|
||||
* of its jobs, not after the whole batch. */
|
||||
class TierIO {
|
||||
public:
|
||||
~TierIO();
|
||||
void start(TierExec* leader);
|
||||
void stop();
|
||||
/* False when a batch is already out. `fences` are waited on before the first job is written --
|
||||
* a snapshot's store slot is filled by a copy on the compute stream (TierExec::fence) -- and
|
||||
* come back with the batch from take(), still the caller's to destroy. */
|
||||
bool submit(std::vector<TierJob>&& jobs, std::vector<RadEvent>&& fences = {});
|
||||
/* The finished batch, when there is one. */
|
||||
bool take(std::vector<TierJob>* jobs, std::vector<char>* ok,
|
||||
std::vector<RadEvent>* fences = nullptr);
|
||||
bool busy() const;
|
||||
|
||||
/* A read off disk. `tag` is the caller's (the request waiting on it); `fences` are waited on
|
||||
* before the first byte is written (TierExec::fence) and stay the caller's to destroy. */
|
||||
struct Fetch {
|
||||
uint64_t tag = 0;
|
||||
std::vector<TierJob> jobs;
|
||||
std::vector<RadEvent> fences;
|
||||
std::vector<char> ok;
|
||||
};
|
||||
/* False when the thread is not running. */
|
||||
bool submit_fetch(Fetch&& f);
|
||||
/* A finished read, oldest first. */
|
||||
bool take_fetch(Fetch* out);
|
||||
|
||||
private:
|
||||
void loop();
|
||||
TierExec* x_ = nullptr;
|
||||
std::thread th_;
|
||||
mutable std::mutex mu_;
|
||||
std::condition_variable cv_;
|
||||
std::vector<TierJob> work_, done_;
|
||||
std::vector<RadEvent> work_fences_, done_fences_;
|
||||
std::vector<char> ok_;
|
||||
size_t work_at_ = 0; /* the next write job; the thread's alone while has_work_ */
|
||||
bool has_work_ = false, has_done_ = false, stop_ = false;
|
||||
std::deque<Fetch> fetch_q_, fetch_done_;
|
||||
};
|
||||
|
||||
} /* namespace rad */
|
||||
Reference in new issue
Block a user