Archived
block drafter: a short block chosen per step by load (--draft-short-from N)
A block drafter proposes its block whole, so the block's length is paid for every drafting sequence whatever each verifies. At one sequence a long block pays: Qwen3.8-27B + DFlash2 (block 8, --draft-window adaptive) decodes one stream 135 -> 155-165 t/s against block 4. At sixteen it does not: block 8 750-790 t/s, block 4 900, its drafter rows and weaker first positions costing more than the extra drafts bring. --draft-window adaptive alone cannot help, since it only shortens what each sequence verifies. - rad_drafter_short_block(b, block): additive export (RAD_ABI_VERSION unchanged); the plugin declares that its query pass also runs at `block` rows a sequence. Builder validates it (block drafter, shorter than its own, still proposes). - --draft-short-from N (default 0 = never): the engine stages the short block once N sequences decoded in the step just run (Scheduler::decoded_seqs). - The engine reads the proposals at the drafter's declared row pitch, not at the step's count: dflash_select writes row s at s * pitch, and a short block fills only a row's front (with the pitch read as the count, every sequence but the first got the wrong tokens). - Dflash2: a short block of 4 rows (depth 3) wherever its own is longer: its own convolution and selector ops at that block (every other op is per row); the query pass picks by T / n_seq and fails the step on a block it has no ops for. qwen35_fp8 and gemma3 declare it. - Tests: build_test (the declaration's checks), arch_test (the qwen35 family's short query pass runs the short ops, a block without ops fails the step; the DFlash2 pin moves), config_test. Measured (Qwen, speculation 7 adaptive, short block from 4 sequences, against production's speculation 3 fixed): one stream +15-20 % (kratky) / +9 % (syslog), 4 streams +3 %, 16 streams equal (915 / 906 t/s). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9eaf10da6e
commit
90e14c5015
16 files changed
+211
-6
No files matched your search
@@ -1303,6 +1303,20 @@ int Engine::declare() {
|
||||
drafter_name_ = p0.drafter_name;
|
||||
drafter_.name = drafter_name_.c_str();
|
||||
if (cfg_.n_spec <= 0) drafter_ = RadDrafterDecl{};
|
||||
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);
|
||||
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,
|
||||
drafter_name_.c_str(),
|
||||
(long long)drafter_short_,
|
||||
(long long)(drafter_short_ - ((drafter_.block > 0 ? drafter_.block
|
||||
: drafter_.depth + 1) -
|
||||
drafter_.depth)));
|
||||
if (drafter_.kind != RAD_DRAFT_NONE) {
|
||||
/* A zero proposal handle means the sampler's token buffer: the head's logits go through
|
||||
* the ordinary sampler chain. */
|
||||
|
||||
Reference in new issue
Block a user