mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2761] [CLOSED] serve: STRATA_MTP_ROOM_MIN — a long prompt takes the MTP drafter's 512 experts (decode-only) as ring #4252
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#4252
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/2761
Author: @gopinath87607
Created: 10/16/2026
Status: ❌ Closed
Base:
main← Head:prefill-decode-room📝 Commits (3)
6e48553prefill: what only the decode needs leaves VRAM while a prompt runs, and the prestage ring takes the loan (WIP - porting mw00/project-maya#223)b4642ddserve: STRATA_MTP_ROOM_MIN - a long prompt takes the MTP drafter's 512 experts (decode-only) as ring0958a68docs: the room measured on the Q8_0 4-way - it works, and at 3k/15k it bought nothing📊 Changes
7 files changed (+492 additions, -42 deletions)
View changed files
📝
docs/DETAILS.md(+7 -0)➕
docs/MTP_PROMPT_ROOM.md(+146 -0)📝
include/strata/core/mtp.hpp(+28 -0)📝
include/strata/prefill/prefill.hpp(+11 -0)📝
src/core/mtp.cpp(+89 -0)📝
src/prefill/prefill.cpp(+30 -1)📝
src/program/generate.cpp(+181 -41)📄 Description
The MTP draft layer's 512 routed experts are read by the decode alone:
record_restis their only reader, andevery prompt pass — the capture's K/V (
record_front, both prefill captures) and the prompt path'sPrefill::draft_kv— runs the layer's dense tensors and its K/V state instead. This is that block, lent to the promptpath for as long as a prompt is read.
Port of the MTP half of mw00/project-maya#223
(
STRATA_GLM_ROOM_MIN). The reference's other half is its DFlash drafter, which Strata does not have; what this keepsis the mechanism, in Strata's own shape.
What it does
512 blobs are copied into pinned host memory (taken once and kept — the room opens around every long prompt, and a
second read of the 675 MiB
experts.binper prompt is what that avoids). The device block is freed.Prefill::set_ring_room(room): theroom is
experts_bytes / max_blobring slots — 135 on a Q8_0 pack, 672 MiB. Those slots spill past theborrowed region, in one
cudaMalloctaken after the region's own buffers: a slot at a time, 135 mallocs of4.98 MiB would each round up to a 2 MiB page and want 130 MiB more than the block that was freed. The loan itself
does not move —
bytes_neededcannot count the room without resizing the whole expert cache, and a spilledlayout cannot be relaid out (
relayoutrefuses), so the roomed request keeps its layout, exactly as--prefill-head-aliasdoes.allocated again (cudaMalloc of the same size, then one DMA back), and the lending state is re-anchored
(
pf_parts[].first_nowat the start-up regs out at, solendmarks only the slotsthe layout really covers as lent). If the block comes back at a different address, the round/step graphs are
dropped and captured again — they are per-rad-alias` stops in that case instead
because its verify graphs are all-or-nothinhen it happens.
draunchandrecord_restrefuse with anerror rather than launch a graph that readso decode runs between 1 and 3 anyway: the
room opens and closes inside one request's eaches the close — a room left open by a
request that ended another way is closed at the start of the next one).
Files
include/strata/core/mtp.hpp/src/core/,experts_resident(),experts_out(),experts_back(),drop_expert_graphs(), aninclude/strata/prefill/prefill.hpp/sret_ring_room(slots)and the ring's extraslots in
carve(one block, past the regionsrc/program/generate.cpp— the start-uclose, and two drive-by fixes in the samecode path (below).
docs/MTP_PROMPT_ROOM.md— the mechanismeasure it;docs/DETAILS.mdpoints at itfrom the opt-in switches.
What it leaves alone
lend/init_prompt_pathschanges are all ie;set_ring_room(0)is the default).--prefill-head-aliaskeeps its own behaviowo are combined deliberately rather thanserially: when both apply, the head is unloaded and the path is laid out once, with the head's bytes and the
drafter's together, and both come back before the first window. Without that, the second rebuild would undo the
first (and could take VRAM the head's reload needs).
Two fixes in the code this touches
set_peer/set_stage_helpersurvive a tate inside the path's layout(
Impl), so anysp.reset()+ re-init silel-head-alias's rebuild did this every request on a rig usingSTRATA_PEER_PREFILL_ROWSor a layer split's helpers, and the room's rebuild would have too. Both rebuilds now call onearm_prompt_STRATA_MTP_ROOM_MINis refused, not readr (0 means "every prompt", so a typowould silently turn the room on for every re
Limits
--serveonly,--mtpneeded,--batchree the solo drafter's weights, so freeingthem under the slots would be a use-after-freason at start and exits with 2.
each way, and the roomed request's layout isshort prompt.
Measured
Q8_0 4-way, 2026-10-16: 2× RTX 3060 + 2× RTX 5060, layer split
auto, Qwen3.8-Flash-Next Q8_0, MTPrt,--spec 4;this branch's build, two fresh engines, the vae request per size. The chunk auto-picked
3,328 tokens with a 101-slot ring; the room's e a roomed prompt runs.
prompt … read inline)That line covers the room open and close, so the read itself is it minus the two room lines: ~16.6 s against 16.2 s,
and 36.4 s against 35.8 s. **The ring bought ns not what the prompt was waiting on — and
the room's own 3.4–4.0 s is what the request ptly what the doc says otherwise: CUDA3's
free VRAM while a roomed prompt ran was 66 MiBe freed 675 MiB was the ring; on the first
roomed prompt of an engine the block came back44866000000, not 0x746dbc000000`) and the
round/step graphs were dropped and re-capturedok/s — and every later prompt returned it
to the same address with nothing dropped. No guard refused a draft, no request errored, decode moved only within
noise. The reference measured the same shape ost 89.5 s): the room moves the ring, and
where the ring is not the limit, that is all i
🤖 Generated with [Claude Code](https://claude
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.