Archived
[FIX] restore the prompt vocabulary check, the empty --api-key refusal and scored steps' issue-ahead rule
33108e48(the preempted-prefill gate's wait bound) was cut from an older main and, landing, took back three changes that had merged before it: -a28221eb: a prompt id outside the vocabulary is refused at admission (Scheduler::add_locked), never staged into a pass where the embedding gather faults the device and stops the engine; and its test, a_prompt_names_real_vocabulary_rows. -b9c685a9: --api-key "" is a startup error, not a server that looks guarded and answers every keyless request; and the guide's lines on it and on the loopback-only routes. -ed1e5caf: a scored row the step in flight finishes gets no step issued ahead; and its two tests, the non-scored one with a token left after the step in flight so that a step ahead exists (#349). The wait bound itself, the lookup index and the rest of33108e48are unchanged. sched_test 176, config_test 62 and server_test 177 cases pass. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qthwau4zwWgAaD8vZrycp1
This commit is contained in:
1 parent
8df9240d65
commit
d773992abc
4 files changed
+104
-5
No files matched your search
@@ -308,6 +308,17 @@ int Scheduler::add_locked(std::unique_ptr<Request> r) {
|
||||
/* An embedding input runs in one step or not at all (Request::embed); one longer than a step
|
||||
* could never be admitted. */
|
||||
if (r->embed && (int64_t)r->prompt.size() > cfg_.max_tok) return RAD_E_INVAL;
|
||||
/* Every prompt id, tokenised or client-supplied, names a real vocabulary row: an id past the
|
||||
* embedding table is refused at admission, never staged into a pass. Raw id arrays reach here
|
||||
* straight from the request body, and an op failing mid-step is a device fault (spec §17) —
|
||||
* the whole engine would die for one bad number. Same bound as the scored-prompt check below.
|
||||
*/
|
||||
for (int32_t t : r->prompt)
|
||||
if (t < 0 || t >= prog_->meta.n_vocab) {
|
||||
RAD_WARN("request %llu refused: prompt token id %d is outside the vocabulary [0, %lld)",
|
||||
(unsigned long long)r->id, t, (long long)prog_->meta.n_vocab);
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
/* Nor could a prompt the KV pool cannot hold even alone: admission takes only what the pool
|
||||
* holds, so it would wait at the head of the queue, and everything behind it, forever. The
|
||||
* prompt is the least a request needs: its first token comes from the prefill's last row.
|
||||
@@ -2248,6 +2259,12 @@ const RadBatch* Scheduler::step_next_locked() {
|
||||
* that cannot rewind decides at commit whether the next step may speculate; one that can,
|
||||
* or no grammar, keeps its answer. */
|
||||
if (!e.produces_token || !r.speculation_fixed) return nullptr;
|
||||
/* A SCORED row (Request::token_scores, a /v1/systemone question) that the step in flight
|
||||
* brings to max_tokens gets no step issued ahead: it would run a whole forward pass for a
|
||||
* request that finishes at the commit, and max_tokens=1 pays a decode step after its
|
||||
* prefill. Scored rows only -- every other decode keeps the step of overlap it had. */
|
||||
if (r.token_scores && r.max_tokens > 0 &&
|
||||
(int64_t)r.output.size() + 1 >= r.max_tokens) return nullptr;
|
||||
|
||||
/* The furthest context the row can reach: every position this step verifies committed,
|
||||
* counted from the last commit rather than this step's own bound (which would add a
|
||||
|
||||
Reference in new issue
Block a user