Archived
sched: an anchor row with no anchor is row zero, not row minus one
LiLiCorr's correlator gathers each sequence's context state by the row the advance pass wrote into h_arow (RadBatch::anchor_rows), and the gather validates the index plane in shape, not values: an index of -1 reaches one int32 before the context buffer and reads off the end of a device allocation. The reset that opens a build filled the plane with -1 -- honest for a host reader, poison for an index -- so a row that reached the query pass without advancing, in any path that skips the advance, gathered out of bounds instead of gathering a wrong row. The sentinel becomes row 0: always in range, and a row that really did skip its advance reads an anchor that fails acceptance and is discarded, which is the same outcome with no fault and no neighbour's state read.
This commit is contained in:
1 parent
b44f7a9bb1
commit
d7e3c2a58a
1 file changed
+6
-1
@@ -1132,7 +1132,12 @@ const RadBatch* BatchBuilder::build(const StepPlan& plan, const IKVManager& kv,
|
||||
s.h_q[i] = e.n_tokens;
|
||||
s.h_ctx[i] = e.ctx_len;
|
||||
s.h_acc[i] = e.n_accepted;
|
||||
s.h_arow[i] = -1;
|
||||
/* Row 0, not -1: the query pass gathers the context state by these values, and the
|
||||
* gather's index plane is validated in shape only -- a row that reaches the correlator
|
||||
* without having advanced would gather one row BEFORE the context buffer (device OOB).
|
||||
* Row 0 is always in range; a row that skipped its advance reads a wrong anchor, which
|
||||
* the acceptance path discards, instead of faulting or reading a neighbour's state. */
|
||||
s.h_arow[i] = 0;
|
||||
if (e.is_prefill) { if (e.n_tokens > max_q_pf) max_q_pf = e.n_tokens; }
|
||||
else { if (e.n_tokens > max_q_dec) max_q_dec = e.n_tokens; }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user