mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1599] [CLOSED] split: batch the draft layer's prompt K/V on a layer split, +3 to 8% prompt speed (opt-in) #3554
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#3554
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/1599
Author: @noon-at-cgn
Created: 10/8/2026
Status: ❌ Closed
Base:
main← Head:pr/split-mtp-batch📝 Commits (2)
763faaesplit: batched draft-layer prompt K/V on the last stage (STRATA_SPLIT_MTP_BATCH=1, opt-in)3d57d0cdocs: replace the evidence placeholder in the split MTP-batch paragraph with the measured result📊 Changes
9 files changed (+269 additions, -20 deletions)
View changed files
📝
CMakeLists.txt(+4 -0)📝
docs/MULTI_GPU.md(+22 -0)📝
include/strata/prefill/prefill.hpp(+2 -1)➕
include/strata/program/draft_kv_plan.hpp(+44 -0)📝
src/prefill/prefill.cpp(+14 -8)➕
src/program/draft_kv_plan_test.cpp(+62 -0)📝
src/program/generate.cpp(+26 -2)📝
sycl/src/prefill/prefill.cpp(+14 -9)➕
tools/split_mtp_batch_parity.py(+81 -0)📄 Description
Title
Issue: Related: none found (searched open PRs 2026-10-08; closed #453 added E-9 for a ring K/V on one GPU).
Summary
Why it matters: on a layer split, every prompt chunk ends with the draft layer's own pass, which blocks the pipeline (0.9-1.3 s per request in the host's "after each chunk" time). One GPU already avoids that with the batched E-9 pass (
Prefill::draft_kv), butgenerate.cpponly calls it when!multi_gpu. WithSTRATA_SPLIT_MTP_BATCH=1the last stage runs E-9 too: that time drops to 0.1-0.25 s, and long prompts read faster with the same greedy output.Default off; the default path is unchanged.
What changed
src/program/generate.cpp:on_chunkasksdraft_kv_plan::plan()which path to try; on a split with the variable on it callsdraft_kvon the drafter's stage. One log line per process says what the variable did.include/strata/program/draft_kv_plan.hpp(new): the choice as a pure function.src/program/draft_kv_plan_test.cpp+CMakeLists.txt: CPU test (18 checks).src/prefill/prefill.cpp,include/strata/prefill/prefill.hpp,sycl/src/prefill/prefill.cpp:draft_kvmakes the stage's device current and takes an optionalwhythat names the reason when it declines.tools/split_mtp_batch_parity.py(new),docs/MULTI_GPU.md: one paragraph.Extra Notes
Measured on engine 0.1.40.3 (
d5ea713) plus this change; the branch itself is cut from mainfb58e0d.Machine: 2x RTX 3080 20 GB (220 W), Xeon E5-2696 v4, UD-Q4_K_XL,
--batch-mtp, 2 slots,--prefill auto:16384. Same binary in both arms, only the env differs; full restarts in the order off/on/off/on. All 8 on/off prompt-read ratios are above 1 (1.03 to 1.08); the two off restarts differ by at most 2% at 25k and 0.3% elsewhere. Parity ran with--adapt-every 0 --suffix-draft 0(with the adaptive tier on, greedy output is not repeatable across restarts).Open question, stated plainly: decode is not shown to be unchanged. The on medians are about 3% lower in both pairs (pooled solo 82.6 -> 80.2 tok/s, c2 93.2 -> 90.8), but the restart-to-restart control moves up to 4.7% and no mechanism is known (the patch touches only the prompt path). With two restarts per arm it can be neither confirmed nor excluded.
The drafter's K/V come from Q8_1 x Q8_0 MMQ instead of its own mmvq, so they are not bit-identical; no acceptance difference was visible at this n. Needs a
--nativepack, otherwise it logs why and keeps the old pass. Checked:draft_kv_plan_test, CUDA build. Not built: HIP, SYCL (only the new parameter). Not tested: AMD, three or more cards, without--batch-mtp, the decline path.Context: this change is part of the setup measured in the community benchmark #1640.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.