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:
mici81andClaude Opus 5.5 committed 2026-10-23 11:24:45 +00:00
1 parent 90e14c5015
commit da52bc8593
6 files changed
+55 -9

No files matched your search

+12 -1
View File
@@ -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;
}