Archived
sched: a bound on the preempted-prefill gate's wait
This commit is contained in:
1 parent
0792d86375
commit
33108e488b
16 files changed
+1522
-150
No files matched your search
@@ -59,6 +59,9 @@ struct KernelRow {
|
||||
bool reference = false;
|
||||
/* rad_kernel_chain: its launches can wait in the kernel instead of behind the barrier bit. */
|
||||
bool chain = false;
|
||||
/* rad_kernel_fetches_rows: it reads a mapped table's rows itself, so the engine does not read
|
||||
* them ahead through the page cache (runtime/rowprefetch.h). */
|
||||
bool fetches_rows = false;
|
||||
};
|
||||
|
||||
/* A kernel bound to one geometry, one domain and one variant, with init() already run. */
|
||||
@@ -214,6 +217,9 @@ struct WeightInfo {
|
||||
void* ptr = nullptr;
|
||||
void* host_ptr = nullptr;
|
||||
uint64_t file_offset = 0;
|
||||
/* Each selected plane's offset in the container (file_offset is plane_offset[0]), for a
|
||||
* file-tier weight the loader relayouts on every read (weight_file_relaid). */
|
||||
uint64_t file_plane_offset[RAD_ENC_MAX_PLANES] = {0};
|
||||
|
||||
/* First and last op index that read the weight. Prefetch runs off these, so layer offload is
|
||||
* scheduling rather than prediction (spec §5). */
|
||||
@@ -532,6 +538,30 @@ public:
|
||||
|
||||
};
|
||||
|
||||
/* The kernel whose layout hook settled `w`'s stored form, or null when it is stored as is or
|
||||
* widened. */
|
||||
inline const RadKernelInfo* weight_layout_kernel(const Program& prog, const WeightInfo& w) {
|
||||
if (w.identity || w.widen || w.lay_op < 0 || (size_t)w.lay_op >= prog.ops.size()) return nullptr;
|
||||
const OpInfo& op = prog.ops[(size_t)w.lay_op];
|
||||
if (w.lay_band < 0 || (size_t)w.lay_band >= op.bands.size() || w.lay_dom < 0 ||
|
||||
w.lay_dom >= RAD_N_DOMAINS)
|
||||
return nullptr;
|
||||
const KernelRow* row = op.bands[(size_t)w.lay_band].dom[w.lay_dom].row;
|
||||
return row ? row->info : nullptr;
|
||||
}
|
||||
|
||||
/* Whether the file tier can serve `w` by relayouting it on every read, as the loader does once
|
||||
* for a resident weight: whole planes (no shard at a world above one, so each plane is one range
|
||||
* of the container), not widened, and a kernel that relayouts. The selected planes are read from
|
||||
* the container and the kernel's relayout writes the stored form into the pinned stage the copy
|
||||
* to the card reads. The mapped tier cannot do this: it hands kernels the container's bytes. */
|
||||
inline bool weight_file_relaid(const Program& prog, const WeightInfo& w, int world_size) {
|
||||
if (w.identity || w.widen) return false;
|
||||
if (w.decl.shard != RAD_SHARD_NONE && world_size > 1) return false;
|
||||
const RadKernelInfo* ki = weight_layout_kernel(prog, w);
|
||||
return ki && ki->relayout;
|
||||
}
|
||||
|
||||
/* ================================================================== requests */
|
||||
|
||||
enum class ReqState { Waiting, Running, Preempted, Finished, Failed, Cancelled };
|
||||
@@ -814,6 +844,10 @@ struct Config {
|
||||
* the chunk at N tokens on such a step. See Scheduler::step, docs/GUIDE.md. */
|
||||
int64_t busy_prefill_chunk = -1;
|
||||
int64_t prefill_interleave = 0; /* --prefill-interleave: decode-only steps between chunks */
|
||||
/* --preempt-wait-ms: how long a preempted prefill may wait for the whole-recompute gate
|
||||
* before the scheduler evicts cache blocks and preempts a lower-priority running request to
|
||||
* make room for it. 0 = fall back on the next step; default 5000 ms. */
|
||||
int64_t preempt_wait_ms = 5000;
|
||||
int64_t max_seqs = 256;
|
||||
int64_t max_ctx = 0; /* 0 = the model's training context */
|
||||
/* --rope-scaling: "yarn:FACTOR[:ORIG]" writes YaRN over the checkpoint's own rotary keys (the
|
||||
@@ -859,6 +893,14 @@ struct Config {
|
||||
* exact prefetch, a routed expert a routed layer at a time). Off by default because disk
|
||||
* paces the step, so an accidental spill makes the server orders of magnitude slower. */
|
||||
bool weights_disk_tier = false;
|
||||
/* --row-prefetch on|off: a host gather's rows on the mapped tier (a table on disk, read
|
||||
* through the container's mapping) are asked for ahead of its kernel (runtime/rowprefetch.h,
|
||||
* CtxDesc::row_prefetch). Output-neutral; on is the default. */
|
||||
bool row_prefetch = true;
|
||||
/* --mapped-rewarm on|off: at startup, the mapped tier's pages an earlier run left in the page
|
||||
* cache and the load's allocations reclaimed are asked for again, at most half of
|
||||
* MemAvailable (RadFile::rewarm). Output-neutral; on is the default. */
|
||||
bool mapped_rewarm = true;
|
||||
|
||||
std::string placement = "auto"; /* all_vram | layer_offload | expert_tiered | auto */
|
||||
/* --embedding-placement and --ngram-placement as given (see TablePlacement), and their
|
||||
@@ -958,6 +1000,18 @@ struct Config {
|
||||
* and rad-tune read the same operating point; defaulting to off would pay for the head in
|
||||
* VRAM and still decode one token a step. */
|
||||
int n_spec = -1; /* --num-speculative-tokens; -1 = auto, 0 = off */
|
||||
/* --spec-ngram K: speculate by prompt lookup alone, K drafts a step (core/sched/ngram.h), each
|
||||
* proposal verified only when it pays for its verify rows (core/sched/lookup.h).
|
||||
* Sets the window to K and tells the plugin to declare no draft head
|
||||
* (RadBuildCtx::draft_head_off), so a head the container carries costs no memory. 0 (the
|
||||
* default) is off: a deployment that speculates still uses prompt lookup for any sequence its
|
||||
* head declines, and a container without a head speculates by prompt lookup at
|
||||
* --num-speculative-tokens N. */
|
||||
int spec_ngram = 0;
|
||||
/* The pattern lengths prompt lookup tries, longest first (--spec-ngram-min/--spec-ngram-max),
|
||||
* wherever it runs. */
|
||||
int spec_ngram_min = 2;
|
||||
int spec_ngram_max = 4;
|
||||
DraftWindow draft_window = kDraftWindowDefault; /* --draft-window */
|
||||
/* A block drafter's short block (rad_drafter_short_block) from this many decoding sequences in
|
||||
* the step just run; 0 never. -1, auto: never for a chain, and from two for a tree
|
||||
@@ -1092,6 +1146,12 @@ struct Config {
|
||||
bool debug_graph = false;
|
||||
bool debug_selection = false;
|
||||
bool debug_placement = false;
|
||||
/* --debug-tape-dump: each rank lists the dispatches of the first recorded pass of each kind
|
||||
* (CtxDesc::tape_dump). */
|
||||
bool debug_tape_dump = false;
|
||||
/* --debug-draft-oracle FILE: prompt lookup proposes from these token ids, 30% of its drafts
|
||||
* corrupted -- the verify path's test harness (Scheduler::draft_ngram). Empty is off. */
|
||||
std::string debug_draft_oracle;
|
||||
bool profile_ops = false;
|
||||
/* --expert-stats FILE: count the routed experts every layer selects, by step kind, and write
|
||||
* the counts to FILE as JSON every 30 s and at shutdown (place/xstats.h). Empty is off. */
|
||||
|
||||
Reference in new issue
Block a user