mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2511] [Engine] Report batch MTP draft counts across slot handoffs #4085
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4085
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2511
Author: @hotschmoe
Created: 10/14/2026
Status: 🔄 Open
Base:
main← Head:batch-mtp-restore-accounting📝 Commits (1)
9e73689Report batch MTP draft counts across slot handoffs📊 Changes
6 files changed (+119 additions, -9 deletions)
View changed files
📝
docs/BATCHING.md(+6 -1)📝
serve/server.py(+11 -1)📝
serve/test_parallel.py(+14 -1)➕
serve/test_slot_drafts.py(+70 -0)📝
src/program/generate.cpp(+11 -4)📝
sycl/src/program/generate.cpp(+7 -2)📄 Description
Problem and result
When a request's decode moves between the solo path and a batch slot (it is promoted into a slot when a second request arrives, and goes back to solo when that one ends, #1869), the API's
timings.draft_n/draft_n_acceptedand the/metricstotals reported only the last leg's drafts.BDONEcarried no draft counts at all. Still the case on 0.2.0-beta: a 512-token request reported 220 accepted / 312 offered while the engine's own DONE lines for it summed to 300 / 435.With this change every leg is counted: the same test reports 300 / 438, equal to the engine's per-DONE sums and to the
/metricsdelta.Related discussion
none (a reporting fix; no change to decoding or defaults).
Approach
BDONEappends the slot leg's accepted / offered draft counts (CUDAsrc/program/generate.cppand SYCLsycl/src/program/generate.cpp;0 0without--batch-mtp).serve/server.py:_apply_bdoneadds them to the admission's counts;carry_leg/add_carrykeep them when a slot request goes back to the solo path, so a final solo DONE adds to the earlier counts instead of replacing them. An older engine's four-fieldBDONEleaves the admission's counts as they were; a missing count stays unreported, an explicit zero stays known.docs/BATCHING.md: the optional protocol fields.serve/test_slot_drafts.py(new) andserve/test_parallel.py: the mixed-leg and handoff cases.Validation
Setup: 0.2.0-beta
maine88ee39dagainst this branch rebased on it (head9e736891). 2x Intel Arc Pro B70 32 GB, kernel 7.1, Compute Runtime 26.22.38646.4, SYCL AOTbmg-g31built with the repository dev image. Qwen3.8-Flash-Next ISTA GSQ-RCO IQ3_XXS,--layer-split 30,"parallel": 2,--max-context 16384 --vram-reserve-mib 512 --kv int8 --spec 4 --mtp <BF16 draft layer> --mtp-max-t 4.Test (the same script for both builds): (1) a 512-token request decodes alone, a 64-token request arrives 4 s later (the first is promoted into a slot, then handed back to solo when the short one ends); (2) two 256-token requests together. The API's draft counts are compared with the sum of the engine's per-request DONE / BDONE draft lines in the same log window and with the
/metricstotals delta.Passed:
/metricsdelta. Case 2: 0 / 0 everywhere (a layer split runs no MTP in the slots).maine88ee39d, case 1: API 220 / 312 against an engine sum of 300 / 435 (the first solo leg's 80 / 123 dropped);/metricsmatches the API, so both under-report. Case 2: 0 / 0.python -m unittest serve.test_slot_drafts serve.test_parallelin the runtime image:Ran 47 tests ... OK.strata, AOT bmg-g31). Per-card health passed after both runs.Failed: none observed.
Not run: CUDA build (the CUDA
BDONEemitter was edited and reviewed, not compiled: no NVIDIA card here); non-zero slot-leg counts on SYCL (needs--batch-mtp, refused on a layer split; on 0.1.x an expert-parallel development stack gave BDONE 40 / 46 plus final DONE 304 / 371 = API 344 / 417, not re-run on 0.2.0).Limits
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.