Archived
engine: a block drafter on the card's acceptance -- its passes queued behind the step, the next step issued ahead
A block drafter (DFlash) ran its two passes after the commit, staged from the committed sequence: the verify, a host wait and the commit, the context and query passes, a second host wait for the proposals, then the next step's build and issue, with the cards idle through each host turn and the ranks starting every pass at different times. Pipelining was off for block drafters. It now takes the serial drafters' path (sched/advance.h). After the trunk's ranks join, the acceptance runs on every rank (ADV_ACCEPT). block_begin runs before the commit (on_card): the context pass mirrors the trunk step, whose positions the host knows (a row issued ahead continued from the committed end, as commit() reads it); the query block's rows are device rows staged at the furthest anchor acceptance could leave, with the KV reservation that far, and ADV_BLOCK puts the anchor (the token the verify chose) and the masks at the card's committed end. After the query pass, ADV_BTAKE takes the proposals into each StepSlot behind the anchor, which is the token row the next verify reads (ADV_TRUNK), so issue_ahead verifies them with no host round trip. The slots come back with the step's one readback; finish_block_drafter checks the card's acceptance against the host's, as the serial driver does, publishes the proposals and moves the drafter's filled range. RADIANCE_DRAFT_BLOCK_HOST=1 keeps the host's driver, for the A/B, and has a row in GUIDE.md's environment table. On libref with the tiny 31B-shaped checkpoint (and one doctored so its drafter is right part of the time) the two drivers give the same replies, the same draft acceptance and the same sampled text, and greedy matches plain decoding. sched_test runs 24 pipelined steps against the host's driver: the same trunk steps and the same context and query passes, positions, lengths and slots (the context pass's token ids aside, which that pass does not read); advance_test covers the two modes and the chain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
015cba8837
commit
cb5a69ac3f
11 files changed
+508
-55
No files matched your search
+12
-1
@@ -333,6 +333,13 @@ public:
|
||||
*
|
||||
* The drafter writes its proposal to its declared proposal buffer, not through the sampler,
|
||||
* and the engine publishes it through set_draft().
|
||||
*
|
||||
* On the card (`on_card`), block_begin runs before commit() instead, right after the step is
|
||||
* issued, so both passes queue behind it with no readback in between. The context pass is
|
||||
* unchanged: it mirrors the trunk step, whose positions the host knows. The query pass's
|
||||
* anchor depends on acceptance, so its rows are device rows (advance.h, ADV_BLOCK) staged at
|
||||
* the furthest position acceptance could leave, and the reservation covers that far.
|
||||
* block_end still runs after commit().
|
||||
*/
|
||||
struct BlockRow {
|
||||
uint64_t seq = 0;
|
||||
@@ -343,7 +350,8 @@ public:
|
||||
* last `depth` rows), `window` its attention window (0 for none) and `mask` the token id its
|
||||
* masked query slots embed. Returns how many sequences may draft and fills `out` with them,
|
||||
* in the order block_query() emits them. */
|
||||
int block_begin(int block, int depth, int window, int32_t mask, BlockRow* out, int max);
|
||||
int block_begin(int block, int depth, int window, int32_t mask, BlockRow* out, int max,
|
||||
bool on_card = false);
|
||||
const RadBatch* block_context(int step);
|
||||
const RadBatch* block_query(int step);
|
||||
void block_end();
|
||||
@@ -570,6 +578,9 @@ private:
|
||||
int32_t n_tokens = 0;
|
||||
int64_t base_pos = 0; /* the anchor's position: the sequence's next one */
|
||||
bool can_draft = false;
|
||||
/* On the card: the anchor's position is the card's, and `base_pos` the furthest it can
|
||||
* be (Scheduler::block_begin). */
|
||||
bool dev = false;
|
||||
/* A placeholder: the trunk step finished this sequence, so it has no KV and drafts
|
||||
* nothing, but keeps its row so later rows stay aligned with the trunk's. The pass stores
|
||||
* nothing for it (a negative slot is padding). */
|
||||
|
||||
Reference in new issue
Block a user