mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1290] [CLOSED] Fix shared MTP slot initialization and speculative row bounds #3362
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#3362
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/1290
Author: @jeremiahritchey
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:fix/batch-mtp-shared-state📝 Commits (3)
7bb814cfix: initialize shared MTP slots and bound speculative rows145bbaftest: use a valid out-of-vocabulary EOS sentinelae706fafix: bound retained batch MTP graph memory📊 Changes
4 files changed (+141 additions, -8 deletions)
View changed files
📝
docs/BATCHING.md(+23 -2)📝
src/core/mtp.cpp(+6 -1)📝
src/program/generate.cpp(+17 -5)➕
tools/batch_mtp_test.py(+95 -0)📄 Description
With
--batch 4 --batch-mtpand a native draft-vocabulary head, the first slot admission fails withmtp: unsupported native MMVQ GGML type. The slot borrows the head pointer but leaves its quantization type at-1. This fixes that shared initialization in the existing upstream multislot MTP path; it does not import the older experimental implementation.The slot also inherits the shared Q4 projections, their offsets, per-stream normalization setting and host vocabulary mapping. Only the owning drafter frees shared projections. At a request's output or context limit, the batch stages one row instead of a speculative second row; this prevents
verify: slot ... runs past its contextat the final cell. The actual row count is used for residual copies and subsequent drafts.Repeated live HTTP runs also exposed VRAM exhaustion while instantiating batch graphs: the previous 64-layout cache could outgrow the available reserve. Limit it to 16 layouts using the existing LRU eviction. The tested 24 GB configuration uses
--vram-reserve-mib 1536; the 700 MiB reserve with 64 retained layouts failed after two successful benchmark rounds.--batch-mtpremains opt-in and single-GPU, with one proposal per slot. AdditiveINFO batch_mtp=0/1and an idle-time acceptance count make activation observable. The new GPU regression checks four-slot token parity, short output limits and the final context cell; the existing interleave test covers conversation reuse, preemption and slot-to-solo continuation.Validation:
serve.test_parallel,serve.test_slots,serve.test_control_cancel,serve.test_restart_waiters.git diff --checkpassed.batch_mtp_test.py: all four slots equal solo for 64 tokens each; limits 1–4 equal solo prefixes; all four slots reach the final context cell. Passed with the native draft head and again with--mtp-q4 all --mtp-hnorm stream. Both runs accepted batch drafts.batch_interleave_test.py --max-new 100 --long 4096: token parity, next-turn reuse, turn checkpoints, BYIELD/resume, and BSTOP followed by solo resume passed.batch_test.py --batch 4 --n 4 --max-new 64 --keys "temperature=0.7 top_k=20 seed=123": all four slots equal solo, 96 of 154 batch proposals accepted.--prefill 1024 --vram-reserve-mib 1536to leave room for the parity tests' owned prompt buffers. The native/Q4 boundary tests override context to 512; the interleave and sampled tests used context 8192. These are correctness runs, not performance measurements.INFO batch_mtp=1confirmed. Final buildae706fapassed repeated four-client HTTP runs, six queued requests, mixed long/short prompts, solo/batch client disconnects, conversation reuse, Responses API and tool-call checks. The run captured 36 batch layouts, exercising eviction beyond the new 16-layout limit, and finished with about 700 MiB free on the GPU.HTTP measurement on that machine/configuration: one warm-up round, then three rounds of four concurrent requests × 256 tokens, temperature 0, thinking disabled. Median aggregate throughput 110.7 tokens/s, median time to first token 1.17 s. This is a local workload measurement, not a general speedup claim.
Reproduction commands with an existing model config containing
--mtp,--spec >= 2and enough VRAM reserved for owned prompt buffers:🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.