mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 21:05:40 +07:00
[PR #3103] [CLOSED] batch-groups: STRATA_SPLIT_MTP_BATCH beside STRATA_PIPED_CONCURRENT (opt-in STRATA_PIPED_CONCURRENT_SMB=1) #4456
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#4456
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/3103
Author: @Vop3p
Created: 10/18/2026
Status: ❌ Closed
Base:
main← Head:smb-concurrent📝 Commits (1)
2d7c763batch-groups: STRATA_SPLIT_MTP_BATCH beside STRATA_PIPED_CONCURRENT (opt-in STRATA_PIPED_CONCURRENT_SMB=1)📊 Changes
7 files changed (+67 additions, -1 deletions)
View changed files
📝
include/strata/prefill/moe_mmq.hpp(+4 -0)📝
include/strata/prefill/prefill.hpp(+4 -0)📝
include/strata/program/batch_read.hpp(+3 -1)📝
src/prefill/moe_mmq.cu(+6 -0)📝
src/prefill/prefill.cpp(+15 -0)📝
src/program/generate.cpp(+23 -0)📝
tests/program/batch_read_test.cpp(+12 -0)📄 Description
Summary
STRATA_PIPED_CONCURRENT=1is off besideSTRATA_SPLIT_MTP_BATCH=1(STRATA_PIPED_CONCURRENT is off beside STRATA_SPLIT_MTP_BATCH), because the batched draft K/V (Prefill::draft_kv) would allocate on the read's thread. This adds an opt-in,STRATA_PIPED_CONCURRENT_SMB=1, that removes the allocation and lets the two run together. Off (the default), nothing changes.What allocates
Reading
Prefill::draft_kv:m.region): no allocation;nbx 4 B) go throughup_ring, and are smaller than whatreserve_uploadsalready reserves before the read (TxKx 4 B);mmq::Context(llama.cpp's MMQ): the context is created at first use, and llama.cpp takes its stream-k fixup buffer from the context's pool, which grows at the first larger request.So the MMQ pool is the one thing that can allocate. On devices whose MMQ configs do not use stream-k it never does (in the ggml we build with, all 254 RDNA2 configs have
stream_k = false); on NVIDIA (Volta and newer) and CDNA it can.The change
mmq::Context::reserve_fixup(bytes): takesbytesfrom the pool and gives them back, so a later run that needs at most that much allocates nothing.Prefill::reserve_draft_kv(): creates the MMQ context and grows the pool to the largest fixup, one 128 x 128 tile of floats per SM (nsmx 128 x 128 x 4 B).generate.cpp, withSTRATA_SPLIT_MTP_BATCH=1andSTRATA_PIPED_CONCURRENT_SMB=1, it is called on the drafter's stage before each concurrent read, beside the existingmtp.reserve_prefillandsp.reserve_uploads, with nothing in flight. It logs once:STRATA_PIPED_CONCURRENT_SMB=1: the batched draft K/V (STRATA_SPLIT_MTP_BATCH) runs beside the concurrent read; its MMQ pool is grown before each read.ConcurrentReadSetup::split_mtp_batch_reserved:concurrent_read_offno longer namesSTRATA_SPLIT_MTP_BATCHwhen it is set.batch_read_testcovers the new case (checked that it fails when the new assertion is flipped).Measured
2x RX 6900 XT (gfx1030), ROCm 10.0, Linux. Flash-Next GSQ-RCO IQ3_S, 262144 context,
--kv int8 --kv-resident 32768, layer split with part of the experts in RAM,--spec 3 --spec-min-p 0.7,"parallel": 2,--batch-groups 2 --batch-mtp, greedy. This branch's binary, a fresh engine per arm. Both arms haveSTRATA_PIPED_CONCURRENT=1; "with" addsSTRATA_SPLIT_MTP_BATCH=1 STRATA_PIPED_CONCURRENT_SMB=1.Stability: 9 arms, 0 stalls. In the three full runs (two with, one without), each arm read a 64K prompt while a short request arrived (4 give-ways per arm, short TTFT 8.0-8.1 s), two streams, a hand-off, and a needle test across the yield point (6 of 6 correct).
Prompt read, 3 interleaved pairs (each arm's outputs are token-identical run to run, so these are the same requests):
The cost, which is
STRATA_SPLIT_MTP_BATCHitself and not this change: the draft layer's K/V come from Q8_1 x Q8_0 MMQ instead of the drafter's own mmvq, so the drafts move (asdocs/MULTI_GPU.mdsays). On the same requests, drafts accepted fell from 87.5% to 85.3% (and 84.5% to 82.4% in the full runs, 6 of 6 comparisons lower), and decode was about 3% lower at 4K and 32K, unchanged at 128K. On our rig the two roughly cancel, so we leave it off. On rigs where the prompt read is a larger share, or whereSTRATA_SPLIT_MTP_BATCHgains more, it may be worth it.Not tested
The path this guards: no NVIDIA card here, so the stream-k fixup allocation that this change pre-grows has not been exercised. On gfx1030 the MMQ never takes from the pool, so our runs show the two coexisting, not that the reservation is sufficient on a stream-k device. A run on CUDA with
STRATA_PIPED_CONCURRENT=1 STRATA_SPLIT_MTP_BATCH=1 STRATA_PIPED_CONCURRENT_SMB=1and a few long reads beside a decoding slot would settle it.Developed with an AI coding assistant; every number above was measured on 2x RX 6900 XT (gfx1030), ROCm 10.0, Linux.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.