mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #5258] [CLOSED] [Engine] split engine: optional per-pool floor for expert residency (FNX_POOL_MIN_RESIDENT) #5367
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#5367
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/5258
Author: @nabe2030
Created: 11/4/2026
Status: ❌ Closed
Base:
main← Head:pool-floor📝 Commits (2)
3196594split: add FNX_POOL_MIN_RESIDENT, an optional per-pool floor in choose_residency() (default off = unchanged)f8db072docs: SPLIT_ENGINE.md: when the split engine or the layer split is faster, by answer length📊 Changes
2 files changed (+27 additions, -0 deletions)
View changed files
📝
docs/SPLIT_ENGINE.md(+6 -0)📝
src/split/src/model.cpp(+21 -0)📄 Description
Problem and result
On a mixed-quantization file (here Qwen3.8-Flash-Next IQ3_S) the all-cards split engine cannot start when part of the routed experts live in host memory (
FNX_EXPERT_RAM_GIB, or the engine's own "VRAM short" loop).choose_residency()moves the coldest experts per byte to RAM first. The experts of different layers have different sizes and fall into 7 size pools; the expert cache needs2*MAXT*TOPK(320) slots in every pool. The cold-first order empties the smallest pool (pool 3, 3 layers, 1,536 experts) andplace_experts()throwsexpert cache: pool 3 has 235 slots, a window needs 320 (fewer experts in RAM). On two 16 GB cards this happened for everyFNX_EXPERT_RAM_GIBfrom 12 up (reproduced), and the 3 GiB default runs out of VRAM instead.With
FNX_POOL_MIN_RESIDENT=Na pool never drops below N resident experts: its next-coldest expert stays in VRAM. Default 0 = unchanged. WithN=384,FNX_ARENA=1 FNX_EXPERT_RAM_GIB=20on 2x RTX 4060 Ti 16 GB the engine loads (17,502 of 24,576 experts in RAM) and runs.Related discussion
Niko1221/Strata#5187. A commenter there supported sending the floor as its own PR, default off. This PR contains only the floor (one code change plus a documentation paragraph). The launcher/env-switch changes discussed in the issue are not part of it.
Approach
Model::choose_residency(). Pools are keyed by the layer's gate+up and down expert byte sizes, which is what the expert cache keys its pools on (up to 16-byte padding). The tensors it reads for the key are the ones the function already reads a few lines earlier.docs/SPLIT_ENGINE.md: one paragraph describing the variable, and a second short section with the measured crossover between the split engine and the layer split by answer length (about 730 generated tokens per request on the two-card 16 GB box; the number is specific to that box and one run each). It is in a separate commit.FNX_EXPERT_RAM_GIB12 and 16 on this box); the floor does not make smaller cards fit.Validation
Passed:
--spec 6 --lookup 15 --batch 1 --max-context 8192): an engine built fromv0.2.10plus thismodel.cppchange loads withFNX_ARENA=1 FNX_EXPERT_RAM_GIB=20 FNX_POOL_MIN_RESIDENT=384in about 100 s, then ran 200 ShareGPT requests (concurrency 1) and the 2,309 JamC-QA items without a failed request; short-prompt decode was 50 to 60 tok/s. HigherFNX_EXPERT_RAM_GIBvalues (up to 30) also load.FNX_POOL_MIN_RESIDENTunset),FNX_EXPERT_RAM_GIB12 and 24:pool 3 has 235 / 113 slots, a window needs 320.python -m pytest tests/spliton this branch rebased ontomain(9f7d977): 65 passed (the same 65 onmain, which has grown since the first version of this PR).Failed:
FNX_EXPERT_RAM_GIB: 12 fails later atcudaMalloc of 810 MiB on card 0: out of memory(MTP buffers,5997 of 24576in RAM), 16 fails atprefill: cudaMalloc of 20 MiB ... out of memory. This is plain VRAM shortage, no longer the pool error. With the floor the "pool P has K slots" placement error is gone and the failure moves to where it belongs; that is the behaviour I would expect from the floor: it is a placement rule, not a memory budget, so cards that are too small still fail, but with an ordinary out-of-memory message instead of a placement exception.Not run:
v0.2.10with the samemodel.cppchange (identical code). I did not rebuild this exact branch commit after rebasing onto the currentmain; the rebase conflicted only indocs/SPLIT_ENGINE.mdandmodel.cppmerged without changes.src/splitC++ with no backend-specific code, but it was not compiled for them).strata launch: the launcher refuses this case on stockmain(experts do not fit in VRAM), so the engine was started directly from a server run config.Limits
N=384worked on this box; it is320 + margin, not a tuned value.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
[PR #5258] [Engine] split engine: optional per-pool floor for expert residency (FNX_POOL_MIN_RESIDENT)to [PR #5258] [CLOSED] [Engine] split engine: optional per-pool floor for expert residency (FNX_POOL_MIN_RESIDENT)