Archived
radiance 1.14.0
New models and formats: - libr3d: a kernel library for RDNA3 (gfx11) cards - nomic-embed-text-v2-moe (the nomicbert plugin) - Gemma 4 E2B with its per-layer MLP width, and Google's unmodified E2B/E4B directories in bf16 - DeepSeek-V4.1-Flash converted straight from its release: the Engram tables, the fused imatrix and rad-convert --chat-template for a release that ships no template - GGUF Q8_0, Q4_K and Q6_K tensors import as their planes; rad-convert writes them without a recipe - Qwen3.8-Flash-Next-FP8 converts and serves through qwen4exp_fp8 Speed: - hc_read's decode kernels as one grid (34.7 -> 25.2 us at 4 rows) and its tiled up-mix pipelined - gemm_fp8a8: the narrow form's scales staged through LDS (Flash-Next int8 at 32 rows 83.6 -> 68.3 us), the gated three-tile form at 8 waves (gate_up at 48 rows 272.9 -> 180.6 us) - Qwen3.8-27B: the delta net's out-projection read beside its decode recurrent update (x1 19.40 -> 19.10 ms a step), and the verify's split-KV attention sized by context depth (x3 at 180K 42.4 -> 40.3 ms a step) - Hy-Memory (HYV3) decode: fused QK norm, RoPE and KV store, residual adds folded into the norms, coalesced one-token expert GEMMs - spechub: the coupled verify walks the live candidates only (151 -> 31 us a launch) Speculation: - DFlash2: lossless coupled acceptance at T > 0 (--draft-coupling on) - A block drafter's proposals verified as a tree, on by default for the Gemma 4 31B's DFlash2, with a block-16 tree that runs its short block under load Features: - Decode-hot residency: --draft-expert-placement host, --expert-profile, --expert-pin-top, and --expert-stats FILE for the routed experts each layer selects - --ngram-placement ram=DIR: one n-gram table shared by engines on separate cards - Prefix cache: --prefix-resume exact (default) resumes a hit on the cold run's own chunk grid, so it answers bit-identically; snapshots at a head other prompts share, from 528-token prompts, and for tip-only one drafter window below the tip; hits on models whose KV groups have different block sizes; the snapshot store keeps a floor of 8 ahead of --host-headroom-mib - Typed tool-call argument tags; rad-chatparse --request renders and reads back one request as the server does - MiniMax-H3: keyframes ride a latent upscale - Gemma 3's fused all-reduce junction on the lossy wire Fixes: - A speculative step shorter than its band (an MTP step of 4 rows at gqa 8) no longer stops the engine with a scratch refusal at issue (#293) - --p2p off: prefill back to 1.12.0's rate; 1.13.0's push check read a host-memory slot over the link twice (#323) - A chat template that cannot render a conversation is refused at load, not mid-request - imatrix entries found under llama.cpp's spelling; the W4A8 prefill's tail scale read; the GDN conv kernels on an f32 weight; dense integer rows at the group they compute (a Q8_0 weight at group 32) - --expert-profile refuses a profile recorded on another model - hc_read's one-grid wait traps past its deadline instead of reading a stale value Changes: Plugin ABI 31, unchanged. RADIANCE_DRAFT_TREE, DFLASH2_TREE_NODES, DFLASH2_TREE_TEMP and DFLASH_Q_TEMP are gone (trees run where the probe says they pay; temperatures 1.25 / 0.6).
This commit is contained in:
1 parent
481fcd5df0
commit
4a61d7296b
160 files changed
+8790
-6819
No files matched your search
+101
-43
@@ -146,7 +146,10 @@ int Scheduler::init(Program& prog, const Config& cfg, IKVManager* kv, IPrefixCac
|
||||
RAD_INFO("draft refill: a prefix hit ends %lld tokens before the prompt's end, so the "
|
||||
"drafter's window is recomputed", (long long)draft_refill_);
|
||||
}
|
||||
if (pc) pc->set_drafter_floor(draft_refill_);
|
||||
|
||||
/* A tree drafter (rad_drafter_tree): every trunk step verifies its proposals as trees. */
|
||||
tree_ = cfg.n_spec > 0 && prog.drafter.kind == RAD_DRAFT_BLOCK && prog.drafter_tree;
|
||||
serial_shared_ = cfg.n_spec > 0 && prog.drafter.kind == RAD_DRAFT_SERIAL &&
|
||||
prog.drafter_shared_kv;
|
||||
serial_rot_shift_ = serial_shared_ ? prog.drafter_pos_offset : 0;
|
||||
@@ -363,12 +366,18 @@ bool Scheduler::committed_seq(uint64_t seq, uint64_t* n_out, bool* live) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
int Scheduler::set_draft(uint64_t id, const int32_t* tokens, int n) {
|
||||
int Scheduler::set_draft(uint64_t id, const int32_t* tokens, int n, const int32_t* parents) {
|
||||
std::lock_guard<std::mutex> lk(mu_);
|
||||
auto it = by_id_.find(id);
|
||||
if (it == by_id_.end()) return RAD_E_NOTFOUND;
|
||||
SchedReq& s = *reqs_[(size_t)it->second];
|
||||
if (n < 0) return RAD_E_INVAL;
|
||||
/* A tree's parents travel with its tokens; a prefix of a tree is a tree (every parent
|
||||
* precedes its child), so the caps below keep them valid. */
|
||||
s.draft_tree = parents != nullptr;
|
||||
if (parents)
|
||||
for (int i = 0; i < n && i < RAD_SCHED_MAX_SPEC; ++i) s.draft_par[i] = parents[i];
|
||||
s.req->draft_parent = parents ? s.draft_par : nullptr;
|
||||
|
||||
/* The step issued ahead already verifies these: it was planned with the drafter's count and
|
||||
* the card has the tokens. The host copy is what its commit emits accepted tokens from, so it
|
||||
@@ -479,9 +488,9 @@ void Scheduler::trim_prefix_cache() {
|
||||
if (!pc_ || !cfg_.prefix_cache) return;
|
||||
const std::vector<int32_t>& cg = pc_->cached_groups();
|
||||
if (cg.empty()) return;
|
||||
/* An entry covers the lcm of the cached groups' blocks and holds that over a group's block of
|
||||
* its blocks (PrefixCache::blocks_per_entry); the trim asks for entries, as many as the group
|
||||
* furthest short needs. */
|
||||
/* An entry covers the lcm of the cached groups' block sizes and holds lcm / B blocks of a
|
||||
* group with B-token blocks (PrefixCache::blocks_per_entry). The trim asks for entries, as
|
||||
* many as the group furthest short needs. */
|
||||
int64_t entry = 0;
|
||||
for (int32_t g : cg) {
|
||||
const int64_t bs = kvgeom_.g[(size_t)g].block_size;
|
||||
@@ -874,10 +883,10 @@ int64_t Scheduler::plan_chunk(int64_t n_computed, int64_t n_target, int64_t budg
|
||||
if (geo_.checkpoints() && geo_.exact) {
|
||||
/* --prefix-resume exact: checkpoints only where an idle cold prefill of this prompt starts
|
||||
* a chunk (ChunkGeometry::grid), so a hit that resumes at one recomputes the cold run's
|
||||
* own chunks. Splits as below at the interval and a span's end; the tail snapshot is at
|
||||
* the start of the prompt's last chunk (tail_checkpoint), a boundary an idle chunk already
|
||||
* ends on, so it costs a copy and no step. A step that shares the budget (another
|
||||
* request, decode rows) may straddle it, and is split there. */
|
||||
* own chunks. Splits at the interval and a span's end as nearest does (below). The tail
|
||||
* snapshot is at the start of the prompt's last chunk (tail_checkpoint), a boundary an
|
||||
* idle chunk already ends on, so it costs a copy and no step. A step that shares the
|
||||
* budget (another request, decode rows) may straddle it, and is split there. */
|
||||
const int64_t I = geo_.checkpoint_interval;
|
||||
const bool periodic = !geo_.window_ckpt || geo_.window_periodic;
|
||||
const int64_t next = periodic ? ((n_computed / I) + 1) * I : INT64_MAX;
|
||||
@@ -895,28 +904,27 @@ int64_t Scheduler::plan_chunk(int64_t n_computed, int64_t n_target, int64_t budg
|
||||
} else if (periodic && (n_computed + want) % I == 0 && geo_.on_grid(n_computed + want)) {
|
||||
if (checkpoint_pos) *checkpoint_pos = n_computed + want;
|
||||
}
|
||||
/* A request's own checkpoint (Request::checkpoint_at) as below, wherever it falls: the
|
||||
* head the request shares with others resumes there by design. */
|
||||
/* A request's own checkpoint (Request::checkpoint_at), wherever it falls, as nearest
|
||||
* takes it: the head the request shares with others resumes there by design. */
|
||||
const int64_t keep = keep_at / geo_.quantum * geo_.quantum;
|
||||
if (keep > n_computed && keep <= n_computed + want && keep <= n_target) {
|
||||
want = keep - n_computed;
|
||||
if (checkpoint_pos) *checkpoint_pos = keep;
|
||||
}
|
||||
} else if (geo_.checkpoints()) {
|
||||
/* --prefix-resume nearest, or no prefix cache: interval checkpoints, and a tail snapshot
|
||||
* as deep in the prompt as the rules below allow. */
|
||||
const int64_t I = geo_.checkpoint_interval;
|
||||
int64_t next = ((n_computed / I) + 1) * I; /* strictly after n_computed */
|
||||
if (geo_.window_ckpt && !geo_.window_periodic) {
|
||||
/* An explicit tail-only policy should not pay for intermediate
|
||||
* window copies or chunk splits just to retire those snapshots. */
|
||||
next = INT64_MAX;
|
||||
} else if (geo_.window_ckpt) {
|
||||
/* A tail-only window snapshot is unreachable after a prompt edit.
|
||||
* Keep interval checkpoints too; the ordinary retention policy bounds
|
||||
* their storage. Preserve the tail before the template's changed suffix,
|
||||
* even when the prompt ends exactly on an interval boundary. */
|
||||
const int64_t tail = tail_checkpoint(n_target);
|
||||
if (tail > n_computed) next = std::min(next, tail);
|
||||
}
|
||||
/* Otherwise a window keeps interval snapshots too (a tail-only one is unreachable after a
|
||||
* prompt edit; the ordinary retention policy bounds their storage), each splitting the
|
||||
* prefill at its boundary. The tail's is taken inside the chunk that carries it
|
||||
* (wtail below), so it splits nothing. */
|
||||
/* A span (ChunkGeometry::span) starts only on an interval boundary past the first
|
||||
* interval, and its chunk is the span's intervals in a row, each the piece a span of 1
|
||||
* makes a chunk of its own. Not from a prompt's start: the first interval may be served on
|
||||
@@ -930,16 +938,26 @@ int64_t Scheduler::plan_chunk(int64_t n_computed, int64_t n_target, int64_t budg
|
||||
want = far - n_computed;
|
||||
else if (n_computed + want > next && n_computed + want < n_target)
|
||||
want = (n_computed + want) / I * I - n_computed;
|
||||
if ((geo_.window_ckpt && n_computed + want == next) ||
|
||||
(!geo_.window_ckpt && (n_computed + want) % I == 0)) {
|
||||
/* A window snapshot at the prompt's tail, a block short of its end (the next turn's
|
||||
* rendering may differ there), even where the prompt ends on an interval boundary. The
|
||||
* window's rows behind it are still held when the chunk ends (a window slides from a
|
||||
* step's first query, KVManager::recycle_window), so it is taken inside whichever chunk
|
||||
* carries that position, and the prompt is not split there: no extra step. It wins over
|
||||
* an interval snapshot at the same chunk's end, which lies past it. */
|
||||
const int64_t wtail = geo_.window_ckpt ? tail_checkpoint(n_target) : -1;
|
||||
if (wtail > n_computed && wtail <= n_computed + want) {
|
||||
if (checkpoint_pos) *checkpoint_pos = wtail;
|
||||
} else if ((geo_.window_ckpt && n_computed + want == next) ||
|
||||
(!geo_.window_ckpt && (n_computed + want) % I == 0)) {
|
||||
if (checkpoint_pos) *checkpoint_pos = n_computed + want;
|
||||
} else if (n_computed + want == n_target) {
|
||||
/* Also one at the prompt's tail. The next turn resumes from the deepest snapshot
|
||||
* under its hit, which on the interval alone can be nearly an interval short of this
|
||||
* prompt's end, re-prefilled every turn. The final chunk splits at the last quantum
|
||||
* boundary, and the remainder (under a quantum) runs as the next step's chunk
|
||||
* (tail_checkpoint decides when that is worth it). */
|
||||
const int64_t tail = tail_checkpoint(n_target);
|
||||
* prompt's end, re-prefilled every turn. Linear state is what the chunk's last token
|
||||
* leaves, so the final chunk splits at the last quantum boundary and the remainder
|
||||
* (under a quantum) runs as the next step's chunk (tail_checkpoint decides when that
|
||||
* is worth it). A window's tail snapshot is taken above, inside its chunk. */
|
||||
const int64_t tail = geo_.window_ckpt ? -1 : tail_checkpoint(n_target);
|
||||
if (tail > n_computed) {
|
||||
want = tail - n_computed;
|
||||
if (checkpoint_pos) *checkpoint_pos = tail;
|
||||
@@ -974,36 +992,46 @@ int64_t Scheduler::plan_chunk(int64_t n_computed, int64_t n_target, int64_t budg
|
||||
}
|
||||
if (aligned < end) {
|
||||
want = aligned - n_computed;
|
||||
if (checkpoint_pos) *checkpoint_pos = -1;
|
||||
/* A checkpoint at the old end goes with it (the chunk that reaches it takes it); a
|
||||
* window's tail snapshot the trimmed chunk still carries stays, or the next chunk
|
||||
* would start past it and the prompt take none. */
|
||||
if (checkpoint_pos && *checkpoint_pos > aligned) *checkpoint_pos = -1;
|
||||
}
|
||||
}
|
||||
return want;
|
||||
}
|
||||
|
||||
/* The tail checkpoint of a `target`-token prompt, or -1: its last quantum boundary, only past the
|
||||
* first interval (a shorter prompt is cheap to redo) and only where it gains at least a quarter
|
||||
* interval over the interval checkpoint below it, which pays for the extra step. */
|
||||
/* The tail checkpoint of a `target`-token prompt, or -1. Under --prefix-resume exact, where its
|
||||
* last chunk starts (below). Under nearest, its last quantum boundary, only past the first
|
||||
* interval (a shorter prompt is cheap to redo) and only where it gains at least a quarter
|
||||
* interval over the interval checkpoint below it, which pays for the extra step; a window
|
||||
* snapshot follows its own rule (below). */
|
||||
int64_t Scheduler::tail_checkpoint(int64_t target) const {
|
||||
const int64_t I = geo_.checkpoint_interval, Q = geo_.quantum;
|
||||
if (I <= 0 || Q <= 0) return -1;
|
||||
if (geo_.exact) {
|
||||
/* --prefix-resume exact: where the prompt's last chunk starts on the resume grid, so an
|
||||
* exact repeat re-prefills that chunk as the cold run did, and an appended turn that chunk
|
||||
* and what it added. A window snapshot keeps its margin below (next comment): the grid
|
||||
* point under the end less a block. Past the first interval, as below. */
|
||||
* and what it added. A window snapshot keeps nearest's margin (next comment): the grid
|
||||
* point under the end less a block. From the first interval on, as nearest's linear-state
|
||||
* rule (a window's lower floor, kWindowSnapshotMin, is nearest's only). */
|
||||
const int64_t margin = geo_.window_ckpt ? std::max<int64_t>(Q, 16) : 1;
|
||||
const int64_t t = geo_.grid_floor(target - margin);
|
||||
if (geo_.window_ckpt) return t >= I ? t : -1;
|
||||
return t > I ? t : -1;
|
||||
}
|
||||
const int64_t tail = target / Q * Q;
|
||||
/* A window snapshot is taken at the tail of any prompt of an interval or more, a block short
|
||||
* of the end: the next turn re-renders the last few tokens (the generation prompt is replaced
|
||||
* by the reply), and a snapshot past where the two renderings diverge is unreachable. Prompts
|
||||
* that left fewer than ~8 tokens in their last block always missed. */
|
||||
/* A window snapshot is taken at the tail of a prompt, a block short of its end: the next turn
|
||||
* re-renders the last few tokens (the generation prompt is replaced by the reply), and a
|
||||
* snapshot past where the two renderings diverge is unreachable. Prompts that left fewer than
|
||||
* ~8 tokens in their last block always missed. It is taken where that position is at least
|
||||
* kWindowSnapshotMin, or an interval where that is lower: from a 528-token prompt at a quantum
|
||||
* of 16. The snapshot is the only way a hit resumes on a model whose windowed layers the cache
|
||||
* does not index, so the floor is low: copying the window out and back costs a few
|
||||
* milliseconds, recomputing the prompt a prefill. */
|
||||
if (geo_.window_ckpt) {
|
||||
const int64_t t = (target - std::max<int64_t>(Q, 16)) / Q * Q;
|
||||
return t >= I ? t : -1;
|
||||
return t >= std::min<int64_t>(I, kWindowSnapshotMin) ? t : -1;
|
||||
}
|
||||
return tail > I && tail - tail / I * I >= std::max<int64_t>(Q, I / 4) ? tail : -1;
|
||||
}
|
||||
@@ -1248,8 +1276,10 @@ int Scheduler::admit_one(SchedReq& s, int64_t budget, int64_t reserve) {
|
||||
* tenant wrote, so the model would attend to the previous request's KV. Zero the reuse
|
||||
* and re-prefill unless a window snapshot covers it.
|
||||
*
|
||||
* A drafter's own group (bound at base_layer and above) is not this clamp's business:
|
||||
* draft refill caps the hit so the recompute covers the drafter's window. */
|
||||
* A drafter's own group (bound at base_layer and above) is not this clamp's business: it
|
||||
* rides in the window snapshot where the engine puts it there
|
||||
* (IKVManager::window_snapshot), and otherwise draft refill caps the hit so the recompute
|
||||
* covers the drafter's window. */
|
||||
if (reuse > 0 && (hit_holes_trunk_ || (hit_needs_window_ && !win_hit))) {
|
||||
reuse = 0;
|
||||
s.hit_cut = SchedReq::HitCut::Window;
|
||||
@@ -1407,6 +1437,7 @@ const RadBatch* Scheduler::step() {
|
||||
if (pc_) pc_->begin_step();
|
||||
|
||||
plan_.reset();
|
||||
plan_.spec_is_tree = tree_;
|
||||
step_prefill_tok_ = 0;
|
||||
step_decode_tok_ = 0;
|
||||
|
||||
@@ -1623,14 +1654,17 @@ const RadBatch* Scheduler::step() {
|
||||
e.n_draft = s.n_draft;
|
||||
e.is_prefill = prefill;
|
||||
e.ngram = !prefill && s.draft_ngram && s.n_draft > 0;
|
||||
/* A tree drafter's parents, unless prompt lookup replaced its proposal with a chain. */
|
||||
e.draft_parent = (!prefill && s.draft_tree && !e.ngram) ? s.draft_par : nullptr;
|
||||
r.draft_parent = e.n_spec ? e.draft_parent : nullptr;
|
||||
e.produces_token = (r.n_computed + want >= target);
|
||||
/* The snapshot a hit resumes from, consumed once: the state is in the slot for the whole
|
||||
* sequence after this, and restoring it again on a later chunk would rewind it. */
|
||||
e.ckpt_restore = s.ckpt_src;
|
||||
s.ckpt_src = -1;
|
||||
/* The checkpoint is the state after the chunk's last token, which the split put at the
|
||||
* interval boundary. */
|
||||
if (ckpt > 0) reserve_ckpt(e, r, ckpt, (int32_t)(want - 1));
|
||||
/* The checkpoint is the state after the chunk's token at `ckpt`: its last, where the split
|
||||
* put the interval boundary there, or inside it for a window snapshot (plan_chunk). */
|
||||
if (ckpt > 0) reserve_ckpt(e, r, ckpt, (int32_t)(ckpt - r.n_computed - 1));
|
||||
s.entry = (int32_t)plan_.e.size();
|
||||
s.sched_tokens = (int32_t)want;
|
||||
plan_.e.push_back(e);
|
||||
@@ -1698,6 +1732,7 @@ const RadBatch* Scheduler::step() {
|
||||
* preemption may still carry a drafter's proposal. */
|
||||
r.n_draft = 0;
|
||||
r.draft = nullptr;
|
||||
r.draft_parent = nullptr;
|
||||
e.n_accepted = 1; /* one-based; a prefill rolls nothing back */
|
||||
e.conv_cursor = s.conv_cursor;
|
||||
e.draft = s.draft;
|
||||
@@ -1708,7 +1743,8 @@ const RadBatch* Scheduler::step() {
|
||||
* restoring again on a later chunk would rewind the recurrence to the hit. */
|
||||
e.ckpt_restore = s.ckpt_src;
|
||||
s.ckpt_src = -1;
|
||||
if (s.pending_ckpt > 0) reserve_ckpt(e, r, s.pending_ckpt, s.sched_tokens - 1);
|
||||
if (s.pending_ckpt > 0)
|
||||
reserve_ckpt(e, r, s.pending_ckpt, (int32_t)(s.pending_ckpt - r.n_computed - 1));
|
||||
s.entry = (int32_t)plan_.e.size();
|
||||
plan_.e.push_back(e);
|
||||
plan_.n_tok += s.sched_tokens;
|
||||
@@ -1748,7 +1784,7 @@ const RadBatch* Scheduler::step() {
|
||||
if (grown > had && kv_->ensure_from(r.id, r.n_computed + grown, r.n_computed) >= 0) {
|
||||
e.n_tokens = (int32_t)grown;
|
||||
e.produces_token = (r.n_computed + grown >= s.seq_len());
|
||||
if (ckpt > 0) reserve_ckpt(e, r, ckpt, (int32_t)(grown - 1));
|
||||
if (ckpt > 0) reserve_ckpt(e, r, ckpt, (int32_t)(ckpt - r.n_computed - 1));
|
||||
s.sched_tokens = (int32_t)grown;
|
||||
plan_.n_tok += grown - had;
|
||||
budget -= grown - had;
|
||||
@@ -2003,6 +2039,7 @@ const RadBatch* Scheduler::step_next_locked() {
|
||||
if (ends_every_request()) return nullptr;
|
||||
|
||||
plan_next_.reset();
|
||||
plan_next_.spec_is_tree = tree_;
|
||||
for (const StepEntry& e : plan_.e) {
|
||||
if (e.slot < 0 || (size_t)e.slot >= reqs_.size()) return nullptr;
|
||||
SchedReq& s = *reqs_[(size_t)e.slot];
|
||||
@@ -2034,6 +2071,8 @@ const RadBatch* Scheduler::step_next_locked() {
|
||||
n.n_accepted = 1; /* the card's: StepSlot::n_acc */
|
||||
n.conv_cursor = s.conv_cursor;
|
||||
n.draft = s.draft; /* published before this step commits (set_draft) */
|
||||
/* And the tree drafter's parents, which the card verifies by (ADV_BTAKE took them). */
|
||||
n.draft_parent = tree_ ? s.draft_par : nullptr;
|
||||
n.n_draft = d;
|
||||
n.is_prefill = false;
|
||||
n.produces_token = true;
|
||||
@@ -2080,7 +2119,11 @@ void Scheduler::promote_next() {
|
||||
s.entry_next = -1;
|
||||
s.draft_next = 0;
|
||||
s.sched_tokens = plan_.e[i].n_tokens;
|
||||
if (s.req) { s.req->n_draft = plan_.e[i].n_spec; s.req->draft = s.draft; }
|
||||
if (s.req) {
|
||||
s.req->n_draft = plan_.e[i].n_spec;
|
||||
s.req->draft = s.draft;
|
||||
s.req->draft_parent = tree_ && plan_.e[i].n_spec ? s.draft_par : nullptr;
|
||||
}
|
||||
}
|
||||
++m_.steps_decode;
|
||||
/* A step issued ahead during a hold is one of its decode-only steps. */
|
||||
@@ -2241,7 +2284,12 @@ int Scheduler::commit(StepResult& res) {
|
||||
if (lp_failed || (lp && lp->token < 0)) { lp_failed = true; return; }
|
||||
if (!server::sink_push(r.sink, t, lp)) overflowed = true;
|
||||
};
|
||||
for (int32_t j = 0; j < a; ++j) emit(s.draft[j], j);
|
||||
/* On a tree step the accepted drafts are the path's nodes, in path order. */
|
||||
const int32_t* path = res.path ? res.path + (size_t)i * RAD_SCHED_MAX_SPEC : nullptr;
|
||||
for (int32_t j = 0; j < a; ++j) {
|
||||
const int32_t d = path ? path[j] - 1 : j;
|
||||
emit(d >= 0 && d < e.n_spec ? s.draft[d] : s.draft[j], j);
|
||||
}
|
||||
if (res.token) emit(res.token[i], a);
|
||||
r.n_computed = valid;
|
||||
step_decode_tok_ += 1 + a;
|
||||
@@ -2692,6 +2740,7 @@ int Scheduler::block_begin(int block, int depth, int window, int32_t mask, Block
|
||||
d.card = e.card;
|
||||
d.ctx_len = e.ctx_len;
|
||||
d.n_tokens = e.n_tokens;
|
||||
d.n_spec = e.produces_token && !e.is_prefill ? e.n_spec : 0;
|
||||
|
||||
/* Every entry of the trunk step gets a row, in order, running or not: the context pass's
|
||||
* row i must be the trunk's row i, so leaving out a sequence the commit just finished
|
||||
@@ -2811,6 +2860,15 @@ const RadBatch* Scheduler::block_context(int step) {
|
||||
/* The context pass reads tapped hidden states, not token ids: nothing to shift and no
|
||||
* draft. */
|
||||
e.produces_token = false;
|
||||
/* A tree verify's rows are restaged on the card from its accepted path (ADV_CTXTREE):
|
||||
* only that path is context, each node at its committed position. Not a placeholder,
|
||||
* whose blocks may already be free. */
|
||||
if (tree_ && d.dev && !d.mirror && d.n_spec > 0 && d.n_tokens == 1 + d.n_spec) {
|
||||
e.dev = true;
|
||||
e.dev_tok = (int32_t)block_plan_.n_tok;
|
||||
e.dev_out = -1;
|
||||
e.dev_aux = 0;
|
||||
}
|
||||
block_plan_.e.push_back(e);
|
||||
block_plan_.n_tok += e.n_tokens;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user