Archived
review fixes of the block drafter's short block (independent review)
- declare_drafter: a block drafter's proposal_pitch, now the row pitch the engine reads row s at, defaults to depth (it defaulted to 1, which a pitch-reading engine would take as packed rows: wrong drafts from the second sequence and a read past the readback) and is refused under depth. The engine's fallback goes. - run_block_drafter: hysteresis -- the short block goes on at --draft-short-from decoding sequences and off only two below, so a load wavering at the threshold does not switch the block (a new pass shape, the adaptive estimates) every step. Comment: the proposals are for the next step. - block_begin's comment: after a long block a short one's reservation stops short of the trunk step's end; the rejected rows past it land on freed pages with slot -1, which every kv_store drops. Named as the load-bearing rule it is. - The --draft-short-from warning names a serial head as such; the arch_test stub returns the real builder's codes. - build_test: the pitch's default and refusal. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
90e14c5015
commit
da52bc8593
6 files changed
+55
-9
No files matched your search
@@ -1780,6 +1780,13 @@ int Builder::declare_drafter(const RadDrafterDecl* d) {
|
||||
(long long)d->proposal_pitch);
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
if (d->kind == RAD_DRAFT_BLOCK && d->proposal_pitch > 0 && d->proposal_pitch < d->depth) {
|
||||
err(RAD_E_INVAL, "declare_drafter '%s': proposal_pitch %lld under depth %d. A block pass "
|
||||
"writes each sequence's %d proposals into one row of the proposal buffer, "
|
||||
"so a row must hold them.", nm, (long long)d->proposal_pitch, d->depth,
|
||||
d->depth);
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
/* A block pass embeds the mask id at every unfilled position, so it needs one. */
|
||||
if (d->kind == RAD_DRAFT_BLOCK && d->mask_token < 0) {
|
||||
err(RAD_E_INVAL, "declare_drafter '%s': RAD_DRAFT_BLOCK with no mask_token. Every "
|
||||
@@ -1823,7 +1830,11 @@ int Builder::declare_drafter(const RadDrafterDecl* d) {
|
||||
prog_.drafter_name = nm;
|
||||
prog_.drafter.name = nullptr;
|
||||
prog_.drafter.block = block;
|
||||
if (prog_.drafter.proposal_pitch == 0) prog_.drafter.proposal_pitch = 1;
|
||||
/* A block drafter's proposal row holds its whole block's tokens, and the engine reads row s
|
||||
* at s * pitch (a short block fills only its front), so its pitch defaults to depth; a serial
|
||||
* one writes a token a pass, at pitch 1 by default. */
|
||||
if (prog_.drafter.proposal_pitch == 0)
|
||||
prog_.drafter.proposal_pitch = prog_.drafter.kind == RAD_DRAFT_BLOCK ? prog_.drafter.depth : 1;
|
||||
return RAD_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -341,6 +341,7 @@ private:
|
||||
/* The block drafter's shorter block (rad_drafter_short_block), 0 when it has none or
|
||||
* --draft-short-from is 0. */
|
||||
int64_t drafter_short_ = 0;
|
||||
bool short_on_ = false; /* the short block runs now (run_block_drafter) */
|
||||
|
||||
/* Serial driver (spec §10): `depth` dependent passes after the step commits, each embedding
|
||||
* the previous proposal. MTP, EAGLE and Medusa-serial have this shape. */
|
||||
|
||||
@@ -1306,9 +1306,10 @@ int Engine::declare() {
|
||||
drafter_short_ = drafter_.kind == RAD_DRAFT_BLOCK && cfg_.draft_short_from > 0
|
||||
? p0.drafter_short_block : 0;
|
||||
if (cfg_.draft_short_from > 0 && drafter_.kind != RAD_DRAFT_NONE && !drafter_short_)
|
||||
RAD_WARN("--draft-short-from %lld: '%s' declares no shorter block, so its block stays %lld",
|
||||
(long long)cfg_.draft_short_from, drafter_name_.c_str(),
|
||||
(long long)drafter_.block);
|
||||
RAD_WARN("--draft-short-from %lld: '%s' %s", (long long)cfg_.draft_short_from,
|
||||
drafter_name_.c_str(),
|
||||
drafter_.kind == RAD_DRAFT_BLOCK ? "declares no shorter block, so its block stays"
|
||||
: "is a serial head, which proposes no block");
|
||||
if (drafter_short_)
|
||||
RAD_INFO("speculation: from %lld decoding sequences on, '%s' runs its short block of %lld "
|
||||
"row(s), %lld token(s), on the host's block driver", (long long)cfg_.draft_short_from,
|
||||
|
||||
@@ -2374,8 +2374,12 @@ void Scheduler::serial_end(int rounds_done) {
|
||||
* also propose. Called while plan() still describes that step, because the context pass mirrors
|
||||
* it exactly, rejected suffix included: the drafter reads hidden states positionally from its
|
||||
* own buffer, so batch row i must be buffer row i. The rejected positions lie in [n_computed,
|
||||
* n_computed + block), which the query pass overwrites before anything reads them, and the
|
||||
* ensure() below covers them since n_computed + block reaches the trunk step's own end.
|
||||
* n_computed + the trunk step's block), which a query pass overwrites before anything reads them.
|
||||
* The ensure() below covers n_computed + `block`; with the block the trunk step verified that
|
||||
* reaches its end. A short block (rad_drafter_short_block) after a long one does not: rejected
|
||||
* rows past it fall on pages the commit's rollback freed, whose slot is -1, and every kv_store
|
||||
* drops a negative slot. That rule is what keeps such a step from writing into another
|
||||
* sequence's pages.
|
||||
*
|
||||
* On the card the step has not committed yet. The step began at n_computed (a row issued ahead
|
||||
* was staged at its furthest reach; it really continued from the committed end, as commit()
|
||||
|
||||
Reference in new issue
Block a user