Archived
sched: an over-cap request would stall every queue behind it
A plugin that declared plugin_words gets a fixed carrier in the batch -- [max_seqs * plugin_words] rows, carved only because the program said how many words a sequence may carry. The build stage already refuses a sequence past that bound, but nothing at admission did, and a refused build restages its step forever: one request carrying more words than the plugin declared stalls every queue behind it, permanently. add_locked now reads the same bound the batch carves by (BatchBuilder:: plugin_words_cap, the program's declaration) and refuses an over-cap request with RAD_E_INVAL, where the server turns it into a clean 400. The current route caps its own words already; this is the promise no future route can miss, checked once at the gate every request passes.
This commit is contained in:
1 parent
981cd1e4e1
commit
b44f7a9bb1
2 files changed
+11
No files matched your search
@@ -135,6 +135,10 @@ public:
|
||||
|
||||
/* The last build's batch for one rank: build()'s result with that rank's slab pointers. */
|
||||
const RadBatch* batch_for(int rank) const;
|
||||
/* Program::plugin_words as declared: the most words one request may carry. Admission checks
|
||||
* it -- the build stage refuses an over-cap sequence, and a refused build restages forever,
|
||||
* so a request admitted past the cap stalls every queue behind it. */
|
||||
int64_t plugin_words_cap() const { return pw_cap_; }
|
||||
|
||||
/* The last build's slab and offsets on one rank, for the advance. The caller supplies mode,
|
||||
* round, slot state and inputs (advance.h). */
|
||||
|
||||
@@ -388,6 +388,13 @@ 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;
|
||||
/* The words a request hands the plugin are bounded by the plugin's declaration. The batch
|
||||
* stage refuses a sequence past it, and a refused build restages the step forever -- an
|
||||
* over-cap request admitted here would stall every queue behind it. The server-side route
|
||||
* caps its own words; this is the promise no future route can miss. */
|
||||
if (!r->plugin_words.empty() &&
|
||||
(int64_t)r->plugin_words.size() > builder_.plugin_words_cap())
|
||||
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) --
|
||||
|
||||
Reference in new issue
Block a user