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

+2 -3
View File
@@ -365,9 +365,8 @@ struct ChainOn {
extern "C" int rad_drafter_short_block(RadBuilder* b, int64_t block) {
const int64_t full = b ? (b->drafter.block > 0 ? b->drafter.block : b->drafter.depth + 1) : 0;
if (!b || b->drafter.kind != RAD_DRAFT_BLOCK || block >= full ||
block - (full - b->drafter.depth) < 1)
return RAD_E_STATE;
if (!b || b->drafter.kind != RAD_DRAFT_BLOCK) return RAD_E_STATE;
if (block >= full || block - (full - b->drafter.depth) < 1) return RAD_E_INVAL;
b->drafter_short = block;
return RAD_OK;
}
+30
View File
@@ -1105,6 +1105,36 @@ TEST(a_block_drafters_short_block_is_shorter_and_still_proposes) {
}
}
/* A block drafter's proposal pitch is its row pitch, which the engine reads row s at: left at 0 it
* defaults to depth, and under depth it is refused, since a row could not hold the proposals. */
TEST(a_block_drafters_proposal_pitch_holds_its_proposals) {
Registry reg;
RadBufDecl bd{};
bd.dtype = RAD_I32; bd.rank = 2; bd.shape[0] = 256; bd.shape[1] = 4;
{
Builder b(reg, make_meta(), make_ctx());
RadDrafterDecl d{};
d.kind = RAD_DRAFT_BLOCK; d.name = "df"; d.depth = 4; d.mask_token = 5;
d.proposal = rad_decl_buffer(&b, "prop", &bd);
CHECK_OK(rad_declare_drafter(&b, &d));
CHECK_EQ(b.program().drafter.proposal_pitch, 4);
}
{
Builder b(reg, make_meta(), make_ctx());
RadDrafterDecl d{};
d.kind = RAD_DRAFT_BLOCK; d.name = "df"; d.depth = 4; d.mask_token = 5;
d.proposal = rad_decl_buffer(&b, "prop", &bd); d.proposal_pitch = 3;
CHECK_EQ(rad_declare_drafter(&b, &d), RAD_E_INVAL);
}
{
Builder b(reg, make_meta(), make_ctx());
RadDrafterDecl d{};
d.kind = RAD_DRAFT_SERIAL; d.name = "mtp"; d.depth = 4;
CHECK_OK(rad_declare_drafter(&b, &d));
CHECK_EQ(b.program().drafter.proposal_pitch, 1);
}
}
/* rad_drafter_shared_kv applies only to a declared serial drafter. With none declared, a block
* drafter, or a position no head occupies, it is refused at declare; a head staged the wrong way
* silently costs acceptance. */