mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1441] [CLOSED] Prompt chunks sized for a layer split's pipeline (--prefill-pipe, opt-in; b/a from --calibrate) #3458
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#3458
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/1441
Author: @ruibeikaa
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:prefill-pipeline-chunk📝 Commits (6)
4d8740dprefill: chunks sized for a layer split's pipeline (STRATA_PREFILL_PIPE=1, opt-in)a7d3a8aprefill: STRATA_PREFILL_PIPE measures b/a on the rig and picks the chunk count by the pipeline's time09deb54prefill: --prefill-pipe takes b/a from setup's --calibrate instead of learning it while serving875f40bprefill: plan a segment's --prefill-pipe chunk once and read every part of it in that chunkddd4a5bprefill: --prefill-pipe 1 follows STRATA_PREFILL_EQUAL's rule (even out only when the last chunk streams every expert)a608198Merge main (v0.1.42) into prefill-pipeline-chunk📊 Changes
11 files changed (+593 additions, -43 deletions)
View changed files
📝
docs/DETAILS.md(+4 -2)📝
docs/MULTI_GPU.md(+70 -0)📝
include/strata/core/conversation_cache.hpp(+10 -0)📝
include/strata/prefill/prefill.hpp(+37 -1)📝
serve/server.py(+13 -2)📝
serve/test_server.py(+32 -1)📝
setup.py(+2 -1)📝
src/prefill/prefill.cpp(+133 -12)📝
src/program/generate.cpp(+140 -14)📝
tools/calibrate.py(+79 -5)📝
tools/test_calibrate.py(+73 -5)📄 Description
Summary
--prefill autotakes the largest chunk the buffers allow (up to 8192). That is right for one card - a chunk costs afixed pass over its layers' experts plus a part per token, so few large chunks are cheapest - and not for a layer
split, which reads a prompt as a pipeline: with few large or uneven chunks the later stages wait. A 10.7K-token prompt
read as a 7680 and a 3011 chunk over four stages kept the first stage busy for 24 of the 36 s.
--prefill-pipe Rpicks the chunk count with the least pipeline time, sum_i (b + a C_i) + (S - 1) max_i (b + a C_i)for chunks C_i over S stages, within the cap
--prefill autosets, and only when it beats today's split by 3%. R isb/a in tokens, a property of the PC that differs by an order of magnitude between rigs (about 700 on four GP100 dies,
about 5000 on two RTX 3090 Ti), so setup's
--calibratemeasures it once, like the PCIe share and the draft floor.--prefill-pipe 1only evens out today's chunk count and needs no b/a. The default is 0 (today's split). A prompt'schunks depend on its length and R only.
Calibration (
tools/calibrate.py, layer splits only)It measures the read speed of a 2K- and an 8K-token prompt (the install's docs, the same text for every value) with
the chunks off, evened out, and b/a 768, 1536, 3072 and 6144. The best is kept only when it reads faster than off in
each of three paired rounds and by more than 3% in the median.
Measurements by prompt length
Four GP100 dies (PH402 SKU 200), prompt tok/s:
--prefill auto--prefill 2048--prefill auto+--prefill-pipe 1024(chunk)Two RTX 3090 Ti (two stages), prompt tok/s:
--prefill autoPH402:
--layer-split 12,24,36, Flash-Next IQ3_XXS, 64K, two interleaved rounds (each within 0.2%); b/a 1024 gives thesame chunks as the 700-890 measured on this rig. RTX 3090 Ti: CUDA 12.9 build for sm_86, Swift 1.5 IQ3_XXS, 1M context,
13,371 of 24,576 experts in VRAM, two starts per arm each reading the four prompts twice, the cold first pass after a
card was freed left out; b/a 5836 and 6432 (timed on the rig).
History
STRATA_PF_FUSED=1); twoRTX 3090 Ti read 19–24% slower.
prompt's chunks, and so its output bits, then depended on how busy the PC was (the same 30K-token prompt was read in
2560 or 2048 chunks in two starts, with different replies). It also knew nothing for the first prompts after a
start, and on a noisy rig it never settled.
What changed
src/prefill/prefill.cpp,include/strata/prefill/prefill.hpp:Prefill::pipeline_chunk,set_pipe/set_pipe_request, and their use inrun_impl. Only the first stage chooses - a later stage is handed one chunk at atime - so nothing outside the prompt path changes. One log line says what it chose:
strata prefill: 10058 tokens in 1280-token chunks over 4 stages (--prefill-pipe 706: b/a).src/program/generate.cpp:--prefill-pipe, and thepipe=request key.serve/server.py:strata_tunepassesprefill_pipe.tools/calibrate.py,setup.py: the calibration step and its message.docs/MULTI_GPU.md,docs/DETAILS.md: the section and the calibrate list.tools/test_calibrate.py(20 tests) andserve/test_server.py(tune keys).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.