mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3821] [Engine] Prefill pipe: STRATA_PREFILL_PIPE_FLOOR, the smallest pipelined prompt chunk (default 512, as before) #4794
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#4794
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/3821
Author: @ruibeikaa
Created: 10/23/2026
Status: 🔄 Open
Base:
main← Head:prefill-pipe-floor📝 Commits (1)
53054ffprefill: STRATA_PREFILL_PIPE_FLOOR sets the smallest pipelined chunk (default 512, as before)📊 Changes
1 file changed (+12 additions, -2 deletions)
View changed files
📝
src/prefill/prefill.cpp(+12 -2)📄 Description
Problem and result
Everything below was measured on four GP100 dies (two PH402 SKU 200 boards, 32 GB HBM2 per die, 128 GB in all) with every expert resident in VRAM: no CPU share, no PCIe share, no adaptive tier. A rig that keeps experts in RAM or streams them over PCIe was not measured. HIP, SYCL and Metal were not built.
--prefill-pipe <b/a>(#1441, in main as125025a7) tries every chunk count from the fewest the buffers allow up to one chunk per 512 tokens, each chunk evened out on the 256-token grid and at least 512 tokens. On a rig with a small b/a - four GP100 dies with every expert in VRAM measure about 70 tokens - the cheapest split of a short prompt has chunks below 512 tokens, which that floor rules out: a 1.15K-token prompt is read in 512-token chunks through four stages.STRATA_PREFILL_PIPE_FLOOR=<tokens>sets that floor (rounded up to the 256-token grid, clamped to 256..4096). Unset, it is 512 and the rule picks the chunks it picks today. On four GP100 dies with b/a 70 and the floor at 256, a fresh 1.15K-token read went 4,310 -> 3,861 ms (-10.4%) and a 1.1K-token append to a 26K-token conversation 4,946 -> 4,461 ms (-9.8%); the other prompt reads kept their chunks and their times, and decode is unchanged.Bitwise identity is not kept where the chunks change, as with any other
--prefill-pipevalue: the prompt pass sums in another order. Of the 15 requests below, the two whose chunks changed have different engine state hashes, and one of their replies - the 16 tokens after the 1.1K-token append - differs from the unchanged engine's.Related discussion
Follow-up to #1441: the same rule with one more knob, no default change. This branch is main plus one commit and needs none of my other PRs. The main
e88ee39drun below was on a branch that also carried #3455, #3760, #3819, #3751 and #3820, all on in the arm before this one.Approach
prefill.cpp:pipe_floor()next topipe_value(), read once. Both places inpipeline_chunkwhere 512 was written - the largest chunk count tried,(n + 511) / 512, and the smallest chunk,max(512, ...)- take it. The cost model, the 3% rule and--prefill-pipe 1are untouched.prefill.cpp(untouched); HIP and Metal compile this one.Validation
Rig: four GP100 dies (compute capability 6.0, application clocks 1050 MHz graphics / 715 MHz memory, 140 W cap), Windows 11, driver 581.80 (TCC), CUDA 12.9, VS 2022. Build
-DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES=60, ggml at the pinned 3cf03257f, unpatched. Model: Swift 1.5 IQ3_S (abliterated GSQ-RCO GGUF, dense matrices in Q8_0).Passed:
main
e88ee39d(engine 0.1.45.3) plus my GP100 stack, one exe for every arm, one engine start per arm, greedy; a ladder in which each arm adds one switch to the arm before. Arm S5 = #3455, #3760, #3819, #3751 and #3820 on; arm S6 = S5 +STRATA_PREFILL_PIPE_FLOOR=256.--serve --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.85 --mtp <drafter> --max-context 1048576 --kv int8 --layer-split 12,24,36 --mtp-window 8192 --pipeline-windows 3 --conversation-cache-mib 32768 --conversation-cache-slots 8 --rope-scaling yarn --rope-scale 4. Environment, the same in every arm:STRATA_PREFILL_PIPE=70(b/a as measured on this rig)STRATA_Q8_SM60=1 STRATA_STAGE_TRIM=1 STRATA_MMQ_RESIDENT_SORT_NE=1 STRATA_DF_BRANCH=1 STRATA_FUSE_DECODE=1 STRATA_FUSE_WAIT=2 STRATA_SIDE_MIXER=2 STRATA_GR_UP75=1 STRATA_B6_MMVQ_ROWS=1 STRATA_ADAPT_LAG=2 STRATA_ADAPT_NOWAIT=1 STRATA_DECODE_TIMING=1. Each start's switches were checked in the engine process's environment.STRATA_STATE_HASH=1and a 250K-token read added (15 requests), and a timing pass without debug switches (14 requests).STRATA_STATE_HASHitem. The 1.15K read: the same reply; every state item except the PLE history differs. The 1.1K append: reply and state differ. The 250K read that came after them in the same engine: the same reply and main-model state; only the drafter's K/V hash (mtp=) differs (not investigated further).Older tree (0.1.41-based, my GP100 branch of that time, not this revision): b/a 70, floor 512 against 256, two engine starts each in mirrored order (512, 256, 256, 512), prompt read ms:
In a separate hash check of the same eight reads (fresh engine starts), the two floor-256 runs gave the same replies, and one of the eight - the 1.19K append, whose chunks changed - differed from an arm at b/a 290 and floor 512.
This branch, rebased onto main
5c8dd322: sm_60 withSTRATA_EXPERIMENTAL_SM60=ON(strata) and sm_86 without it (strata), both built without errors.Failed:
Not run:
5c8dd322: the numbers above are from the revisions named there; the rebased branch was only built.Limits
--prefill-pipe.CI note: the red
metal-linkcheck is not caused by this PR. The job fails while compiling upstream'smetal/src/mtl_rt.mm(lines 69 and 92:MTLGPUFamilyMetal4,MTLCompileOptions.mathMode,MTLMathModeFast/MTLMathModeSafe), which themacos-14runner's SDK does not provide. The workflow runs on any pull request that touchessrc/orinclude/; this PR changes no file undermetal/.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.