mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #5187] [Engine] All-cards split engine on 2x RTX 4060 Ti 16 GB (sm_89, Linux): runs with the host-RAM expert cache, needs a per-pool floor in choose_residency() #3086
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#3086
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?
Originally created by @nabe2030 on GitHub (Nov 4, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5187
I got the all-cards split engine (v0.2.10,
ffa80d7) to answer on Linux with two GeForce RTX 4060 Ti 16 GB cards (sm_89, PCIe Gen4 x8 each, no P2P), running Qwen3.8-Flash-Next IQ3_S (46.8 GiB of routed experts, so they do not fit in VRAM). docs/SPLIT_ENGINE.md says no GeForce pair has been tried; as far as I can tell this is the first Linux GeForce / 16 GB report (#5143 is a Windows 4090 pair where the experts fit).Box: GIGABYTE X570 AORUS PRO WIFI, Ryzen 5 5600, 128 GB DDR4, 2x RTX 4060 Ti 16 GB (both CPU-attached Gen4 x8), Ubuntu 22.04.4, driver 615.71.09, CUDA 13.4 (pip toolkit), NVMe Gen3 x4.
What I had to do:
strata-split-2for sm_89 withpackaging/build_split_cuda.sh(ARCH=89, CUDA 13.4, llama.cpp 3cf0325). No sm_89-specific errors, and the peer-access check at the end of the script passed.STRATA_SPLIT_ALLOW_UNTESTED=1covers the architecture, butdecide()also refuses when the experts do not fit in VRAM, andsplit_config()forcesFNX_ARENA=0 FNX_EXPERT_RAM_GIB=off. The engine itself already handles that case (choose_residency(), the "VRAM short" loop), so I made those two places switchable by environment variables; the defaults are unchanged.ulimit -laround 16 GiB, so the load stopped withfnx: mlock of per_layer_token_embd.weight (27465 MiB) failed: Cannot allocate memory; run with RLIMIT_MEMLOCK raised. I raised the limit for that process only (prlimit --memlock=unlimited). A workstation with unlimited memlock will not see this; it may be worth a line in the docs and a check in the launcher.choose_residency(). IQ3_S mixes quantization types per layer, so the experts fall into 7 size pools. The coldest-per-byte order moves a small pool (3 layers, 1,536 experts) to RAM first, andplace_experts()then throwsexpert cache: pool 3 has 235 slots, a window needs 320 (fewer experts in RAM)for everyFNX_EXPERT_RAM_GIBfrom 12 up, while the default 3 GiB runs out of VRAM (expert cache: slots: out of memory). No value of R works on 16 GB cards. I added an optionalFNX_POOL_MIN_RESIDENT=N(default 0 = unchanged) that never takes a pool below N resident experts; I used 384 (2MAXTTOPK = 320 plus a margin). The "VRAM short" loop goes through the same function, so the floor applies there too.Result with
FNX_ARENA=1 FNX_EXPERT_RAM_GIB=20 FNX_POOL_MIN_RESIDENT=384,--spec 6 --lookup 15 --batch 1, context 8192, temperature 0, throughserve/server.py(nosplit_fallbackin the config, so a fallback would have shown):FNX_EXPERT_RAM_GIB=16fails earlier (prefill: cudaMalloc … out of memory); 20 and 30 both work and end at almost the same residency (17,502 vs 17,258), because the VRAM-short loop decides the final countCaveats: a large rsync was reading the same NVMe during these runs, so the numbers are indicative only. I have not yet compared against the normal layer split on the same box, run the launcher path (
strata launch), or run a quality suite. GPU temperature stayed under 60 C.The two patches (launcher switches, pool floor) and the exact commands are on https://github.com/nabe2030/Strata/tree/split-geforce-16gb. If the pool floor looks right to you I can open a PR for it.
@udqe commented on GitHub (Nov 4, 2026):
Two independent verifications and one cross-OS data point for your asks, from a box on the other side of all three axes (Windows, main engine, UD-Q4_K_XL) - I cannot test your build, but the code and the docs story I could check from here.
Pool floor: your patch reads correct. I pulled your branch (split-geforce-16gb @ 52e7639b) and read the two hunks. The floor logic is placed where it has to be: the
continuefor a pool at its floor comes BEFORE the decrement of the pool's resident count, so floored pools stop losing experts without corrupting the accounting, and because the VRAM-short pass goes through the same eviction loop, the floor covers it too - which matches your reported 17,502 vs 17,258 convergence for R=20/30. The pool key (gate+up nbytes, down nbytes) matching whatexpert_cache()keys its pools on is the load-bearing assumption and you stated it in the comment, which is what a reviewer needs. Default 0 = upstream behavior unchanged, same as your launcher switches (the re-listed condition indecide()is verbose but reads identical for the default path). +1 on opening the PR with those defaults; if the docs get a recommended value, your 384 = 2MAXTTOPK + margin is the honest derivation to print.The window-320 constraint is the kind of fact the tracker keeps missing. Our production pair runs the MAIN engine (
pw2layer split, not strata-split-N - different env namespace, FNX_* vs STRATA_*, please nobody port values between threads), and its equivalent invariant surfaces as the per-request slot line and acceptance behavior instead of a placement exception. Mixed-quant files making one small pool the first casualty of coldest-per-byte eviction is a sharp failure mode to have caught before someone ships it as "IQ3_S is broken on 16 GB". Related: on #5172 today another reporter's "dual is slower" turned out to be IQ3_S-vs-UD quant sensitivity - two of two fresh reports this week are mixed-quant residency, which feels like a pattern the residency planner should care about.mlock ask: here is the Windows counterpart for your docs line. On our Windows pair the engine prints its lock outcome at load, verbatim from today's boot:
expert arena: locked 33753 MiB via working-set minimum + VirtualLock; cudaHostRegister limited to 40 GiB by the engine (multi-GPU under WDDM, or remote experts); 26 slices pinned (38 GiB); large pages refused for 77022101504 B (GetLargePageMinimum=2097152, VirtualAlloc error 1314); using 4 KB pages. Two lessons transfer to your launcher check: (1) on Windows the limit is a privilege (Lock Pages in Memory), not a ulimit, and when it is missing the engine DEGRADES with a printed line instead of dying - your Linux path fails hard atRLIMIT_MEMLOCK; a preflight that prints "need about X GiB, rlimit is Y, this process can raise via prlimit" before attempting an 80 GiB pin would give both platforms the same failure UX. (2) Yourprlimit --memlock=unlimitedfor the one process (instead of a system-wide raise) is exactly the shape of the least-privilege fix, worth keeping in the docs verbatim.On the #5143 relationship: your read of it ("Windows 4090 pair where the experts fit") is accurate and it makes the two issues complementary rather than overlapping - his 48 GB pair never enters your host-cache regime, so his blockers are platform gates and yours is residency placement, both inside the same
decide()/split_config()you both touched. A maintainer reviewing one of your switches should look at the other in the same pass; and, from this side of the fence, both of your patches keeping default behavior byte-identical is the property worth protecting in whichever order they merge.Numbers side, for context only (different engines, no comparison implied): your 51-60 t/s short decode with the MTP drafter at 45-55% acceptance on 2x16 GB + host cache is the best published split-engine number on GeForce that I know of, and your rsync caveat is doing honest work - the 770-800 tok/s prompt read on the same NVMe suggests the host path is not yet saturated even at Gen4 x8.
Not a maintainer; no PR gatekeeping intended. I have not run your branch (no Linux, no split build here), everything above is code-reading and log-quotes, and my box runs the main engine with a 128 GB RAM / 2x24 GB shape - if a PR opens, the test matrix worth asking you for is one non-mixed quant file (floor should be a no-op there) plus one R below the old failure threshold.
(ai-assisted; our engine lines quoted from production boot 2026-11-04 14:36, protocol disclosed in #5031/#3976 threads)
@nabe2030 commented on GitHub (Nov 4, 2026):
Fixed per-prompt cost when most experts live in RAM, and a same-box comparison against the layer split
Same box as above (2x RTX 4060 Ti 16 GB, no P2P, IQ3_S, 17.5K of 24.6K routed experts in RAM,
FNX_ARENA=1), context 8192,--batch 1, MTP. The fixed-cost measurements below are at temperature 0; the comparison runs use the server's default sampling.The fixed cost. With
FNX_PF_TIMING=1a prompt is read in two passes (N-6 rows, then the last 6). BelowFNX_PF_STAGE_ROWS(default 2048) a pass reads the RAM-resident experts in place over PCIe: 2.4 s for 41 rows up to 5.7 s for 772 rows. Above it the experts are staged withcudaMemcpy, about 1.6 s per pass (each card moves 16.7 GiB), but then the 6-row tail pass costs 1.4 s instead of 0.3 s.FNX_PF_STAGE_ROWS=8takes the best of both (staged head, in-place tail): 48 tokens 3.0 -> 2.0 s, 200 tokens 3.9 -> 2.1 s, 780 tokens 6.0 -> 2.4 s, 3.4K tokens unchanged at 4.3 s.FNX_PF_STAGE_MIB=768only helps long prompts (3.4K: 4.3 -> 3.7 s). The default of 2048 assumes every expert is resident; when most are not, a threshold derived from the non-resident share (or choosing the path per pass by the number of non-resident experts it needs) would do better.Comparison. 200 ShareGPT requests, one at a time, same 47,455 input tokens for every run, timings from the engine log. L2/L1 are the stock 0.1.56 Linux CUDA 13 engine with the MTP drafter; S/S2 are the split engine with the patches above (S2 adds
FNX_PF_STAGE_ROWS=8). One run each.So on 16 GB cards the split engine decodes fastest (1.2x the layer split, 1.6x one card) but still loses on short-prompt throughput to the layer split, because every prompt has to move the non-resident experts over PCIe where the layer split computes them on the CPU. The remaining ~1.6 s per pass is PCIe-bound here. A CPU path for the non-resident experts in the split engine's prompt pass (as in the layer split) would probably close the gap; happy to test if you point me at the right place.
@nabe2030 commented on GitHub (Nov 4, 2026):
@udqe thanks for reading the branch. On your two test cases:
place_experts()(5997 of 24576 in RAM) and fails later atcudaMalloc of 810 MiB on card 0: out of memory (395 MiB free)(the MTP buffers); R=16 fails atprefill: cudaMalloc of 20 MiB … out of memory. So with the floor the "pool P has K slots" error is gone and the failure moves to where it belongs, plain VRAM shortage; R=20 and up load. That is the behaviour I would expect from the floor.I am opening a PR for the pool floor now (default off,
FNX_POOL_MIN_RESIDENT=N), on top of main.More numbers from the same box (2x RTX 4060 Ti 16 GB, IQ3_S, split engine with the patches,
FNX_PF_STAGE_ROWS=8; "L2" is the stock 0.1.56 layer split on 2 cards; one run each):Longer outputs. Same 200 ShareGPT prompts with
max_tokens1024 (mean output about 740 tokens): split 49.4 tok/s generated-per-wall-second vs L2 49.3; decode median 58.9 vs 51.9; prompt read median 2.54 s vs 1.11 s. The split engine's faster decode pays back its fixed per-prompt cost at about 730 output tokens on this box; beyond that it should come out ahead, below that L2 does.Quality. JamC-QA (Japanese multiple-choice, 2,309 items, thinking off): split 64.96 %, L2 65.09 %, same answer on 96.3 % of items, McNemar p = 0.81. No measurable difference from the different summation order.
Context.
--max-context32K, 64K, 128K and 256K all load with the same residency (17,502 of 24,576 experts in RAM); the K/V pool borrows arena slots as the context fills rather than at load. Fresh prompts: 30.5K tokens in 24 s, 49K in 37 s, 98K in 72 s, 200K in 150 s (about 1,200 to 1,330 tok/s). Short-prompt decode stays at 55 to 65 tok/s at 256K; right after a 200K prompt it is 49 tok/s (the arena has lent about 0.9 GiB per card to K/V by then). A follow-up turn on the 200K conversation reads in 2.4 s. So 256K is usable on 16 GB cards, which is what we need for coding agents.@udqe commented on GitHub (Nov 5, 2026):
The R=12 result is the sentence a reviewer needs on the PR:
the behaviour I would expect from the floor. The floor is a placement rule, not a memory budget - moving the failure frompool P has K slots(a placement exception, no user-facing meaning) tocudaMalloc of 810 MiB ... out of memory(a plain, explainable VRAM shortage) is exactly the semantic it should have; worth quoting that R=12 line verbatim in the PR. Your scope discipline reads well too - floor plus one docs paragraph, the launcher/env switches explicitly kept out until they have their own reviews. Good luck with the non-mixed file; the by-construction no-op argument you wrote reads cleanly, the empirical leg is just insurance.The fixed-cost finding is the sleeper of the two comments.
FNX_PF_STAGE_ROWSdefault 2048 encodes "assume every expert is resident", and your box - 17.5K of 24.6K experts in RAM - is precisely the regime where that assumption inverts: the staged path (1.6 s/pass) beats in-place even at 41 rows, and your per-pass idea (choose by the non-resident experts that pass actually needs) is the right shape of fix, same pattern as your residency ask: a default tuned for one regime, a floor/threshold derived from the actual state. 780 tokens at 6.0 to 2.4 s is a 2.5x on a shape chat loops run constantly, which is a big number to leave inside the knobs - worth its own issue or at least the docs line, once the memlock PR is out of the way.The comparison table is the cleanest split-vs-layer-split same-box measurement published, and its shape matches a law this tracker has been converging on from several directions: decode is path-insensitive-ish and residency-bound (your 57.5 vs 48.7, split wins when each engine gets its own caches), while prompt read is bulk-transfer-bound and loses when the bulk has to cross PCIe (your 2.49-4.98 s vs 1.05 s; our #5031 CUDA twins and the Gen4-x8 pair on #4610 keep producing the same asymmetry, ours on the main engine, Linux and Windows both). The ~730-output-token crossover is the kind of number that should live in SPLIT_ENGINE.md - it turns "which engine?" into "what are you serving?", which is the honest question.
Quality handling, explicitly: McNemar on 2,309 items with p = 0.81 and a 96.3% same-answer rate is the right way to retire a summation-order worry - paired and powered, and it can show "no difference" where a bare accuracy delta cannot. If you keep feeding this thread, two cheap additions: the acceptance% per leg from the engine log (it would show whether the split's decode edge is the path or the drafter's acceptance behaving differently under a different verify order - both engines ran MTP, so the comparison is fair, but the column answers the first objection before it is raised), and, when you do the non-mixed-quant pass anyway, the JamC subset on floor-on vs floor-off at R=20 to pin "floor changes nothing when it cannot fire" empirically as well as by construction.
The 256K-on-16GB block matters more than one line can say:
the K/V pool borrows arena slots as the context fills rather than at loadplus your measured cost curve (decode 55-65 fresh, 49 after a 200K read while ~0.9 GiB per card is lent) is a residency-vs-context trade with numbers attached. Coding-agent users are going to ask exactly this; the answer now exists on a GeForce pair.Standing note as before: Windows box, main engine (
pw2), I have not built or run the split engine - everything here is from your measurements and the public code; if any of it belongs verbatim in your PR description feel free to lift it, it is yours either way.(ai-assisted; our quoted context: #5031/#4610 posted threads, protocol disclosed in the #3976/#5031 footers)
@nabe2030 commented on GitHub (Nov 5, 2026):
Agent workload on the same box: split engine vs layer split, both at 256K
To see whether the split engine is usable as the backend for a coding agent, I ran our agent benchmark (GembaBench: six sysadmin / investigation tasks on two throwaway VMs, driven by OpenCode 2.0.25 through the OpenAI-compatible server, three runs per task, reasoning effort medium with an 8192-token thinking cap) against both engines on the same 2x RTX 4060 Ti 16 GB box, IQ3_S,
--max-context 262144, one slot, MTP drafter, 4 GiB conversation cache.strata-split-2built for sm_89 + the pool floor from #5258,FNX_ARENA=1 FNX_EXPERT_RAM_GIB=20 FNX_POOL_MIN_RESIDENT=384 FNX_PF_STAGE_ROWS=8)--layer-split auto)So with the agent's mix (long outputs, many short follow-up turns on a growing conversation, tool calls), the split engine comes out 1.2x faster end to end and scores the same. Over all 18 runs the context went up to 65 % of 256K without the server dropping a request. One of the 18 split-engine runs sat in a model-initiated
sleepfor 33 minutes, which is the agent's doing, not the engine's; without waits the totals are 4.9 h vs 6.2 h.For reference, the same benchmark on a DGX Spark (Flash-Next NVFP4 under SGLang) takes 12.9 h for the 18 runs at about 26 tok/s, with the same scores, so on this workload the two 16 GB cards are about 2.3x faster than the Spark. Benchmark and per-run data: https://github.com/nabe2030/gembabench
That is probably where I stop for this issue. Summary of what it took to run the split engine on a Linux GeForce pair with 16 GB cards: the sm_89 build, the two launcher switches, the memlock limit, and the per-pool floor (#5258). The
FNX_PF_STAGE_ROWSthreshold is the one thing I would still like to see chosen from the non-resident share rather than fixed at 2048.@nabe2030 commented on GitHub (Nov 5, 2026):
@udqe thank you, this is very useful. What changed since:
main(it had conflicted indocs/SPLIT_ENGINE.mdonly) and is mergeable now;pytest tests/splitpasses on the rebased branch (65 tests). I did not rebuild the CUDA engine from the rebased commit, and the PR says so.pool P has K slotsplacement error is gone and the failure moves to a plaincudaMalloc ... out of memory, which is the behaviour I would expect from a placement rule that is not a memory budget.docs/SPLIT_ENGINE.md(second commit of the PR): about 730 generated tokens per request on this box, with the caveat that it is one machine and one run each.max_tokens1024): S2 accepts 53.1 % / 53.8 % of the drafts it proposes, the layer split 35.2 % / 37.4 %, but the two engines count the proposed drafts differently (the split engine proposes about 1.1 drafts per generated token, the layer split about 1.8, which looks like a fixed K=6 per round). Per generated token they accept about the same number: 0.60 vs 0.64 (short) and 0.62 vs 0.65 (long). So the split engine's decode edge in these runs is not the drafter accepting more; it verifies fewer drafts per token. The table is in the fork'sREADME-SPLIT-GEFORCE-16GB.md. This is derived from the logs, not a separate measurement.Still to do, as separate pieces:
FNX_PF_STAGE_ROWS: I will open a separate issue for choosing the threshold from the non-resident share (with the per-pass timings), so it does not ride on the floor PR.@udqe commented on GitHub (Nov 6, 2026):
Closing note from this side of the thread, now that the arc has stopped where it said it would. Nothing new to measure here - just what the last three comments changed about how I read my own rig.
The acceptance normalization is the durable finding, and I want to be precise about why. Per generated token - 0.60 vs 0.64 short, 0.62 vs 0.65 long - the two engines are within 6%, while the raw accepted-per-proposed numbers differ by nearly 2x (53 vs 35%). The reason is mechanical and you named it: the engines count proposed drafts differently (about 1.1 vs 1.8 per generated token, the layer split fixed at K=6 per round). So "engine A accepts more drafts" was never a statement about the drafter at all - it was a statement about how many times each engine asks the question. Dividing by generated tokens is the only denominator that doesn't smuggle one engine's drafting policy into the other's score. Reading the split engine's decode edge as "verifies fewer drafts per token" rather than "drafts better" also happens to make it consistent with what the crossover measurement says the split engine is: fewer hand-offs per unit of work, which pays when work per request is large.
That is the same trap this thread has hit three times now from three directions - the tier-size wobble in #4610, the draft-counting asymmetry here, and chunk-era drift in #3976 - and the same habit gets you out every time: state which denominator each number divides by, before comparing any two of them.
The ~730-token crossover in
docs/SPLIT_ENGINE.mdis the number a dual-16 GB buyer actually needs, and one sentence of it is worth more than a speed table: below that per-request length, the second card costs more than it returns, which is exactly what our own layer-split rig shows in miniature (a short-prompt TTFT overhead of tens of percent, growing as prompts shrink - the #5376 numbers on the 9070 pair show it too, about +60% on a short prompt). One machine, one run each, stated as such - the right way to carry a crossover claim.GembaBench end to end is the part I keep quoting locally. 18/18 with no stalls at 65% of 256K, same scores, 1.2x faster on the split engine, and the no-waits totals (4.9 vs 6.2 h) separated from the agent's own sleep - the discipline of removing the model's 33-minute nap from both arms is the sort of thing agent-bench numbers usually get wrong. And the 2.3x-over-a-Spark comparison, at the same scores, tells the 16 GB pair crowd something no single-engine table can.
Good luck with the two separate pieces - the threshold-chosen-from-non-resident-share issue (the per-pass argument reads right; 2048 encodes "assume resident", your box is the regime where that assumption inverts) and the non-mixed floor run. This side watches the #5258 merge.
@nabe2030 commented on GitHub (Nov 6, 2026):
0.2.11 split engine on the same 2x RTX 4060 Ti 16 GB box: works, ~3.5% faster, same JamC-QA
Same box as above (2x RTX 4060 Ti 16 GB, no P2P, Linux, IQ3_S,
FNX_ARENA=1 FNX_EXPERT_RAM_GIB=20 FNX_POOL_MIN_RESIDENT=384 FNX_PF_STAGE_ROWS=8,--spec 6 --lookup 15 --batch 1, MTP). I builtstrata-split-2for sm_89 from the PR #5258 branch rebased on main (includes v0.2.11), and changed only the binary. None of the new 0.2.11 defaults were set by hand. Since the release notes say the 2x16 GB check was done on the layer split only, here is a split-engine data point.What the new defaults did on this box (from the start-up log and the source):
FNX_PF_ROWSauto-picked 4096 rows x 2 chunks (1,112 MiB/card): only 2,865 MiB was free after the weights, so 8192x4 did not fit. As a side effect the arena got more slots (3,329 vs 3,138 per card) and ~460 more experts stay on the GPUs.FNX_PF_HCSPLIT=2was enabled without P2P: the log says the hyper-connection read is split between the cards, and the exchange goes through pinned host memory.FNX_SH_FUSE=1takes the fused path for IQ3_S here too (same code path as on AMD).Results (0.2.10 = the S2 numbers posted earlier, measured on 11-04; 0.2.11 measured on 11-06; one run each, server-default sampling, so a few % is within run-to-run noise):
max_tokens1024: generated tokens / wall timeFNX_PF_ROWS=8192(it may not fit next to the 256K K/V pool).The launcher part of my patch still applies on 0.2.11 with a small change (the check is now on free memory,
room_mib). Even so, Auto still rejects this box, because the routed experts do not fit in 16 GB.@nabe2030 commented on GitHub (Nov 7, 2026):
The two follow-ups I announced
Staging threshold: opened as #5440. Same picture on 0.2.11: with ~69% of the routed experts in RAM, the
FNX_PF_STAGE_ROWSdefault reads 200-780-token prompts in 3.7-6.1 s against 2.0-2.4 s with=8.Pool floor on a non-mixed file: I looked for a file to run it on before spending the half day, and it turns out the test cannot show anything. Reading only the GGUF headers of the ISTA-DASLab and Unsloth Qwen3.8-Flash-Next files, the only one with a single expert type in all 48 layers that the split engine accepts and that fits in 128 GB of RAM is ISTA's GSQ-RCO Q2_0. The split engine repacks Q2_0 to Q4_0 at load, so every routed expert ends up in one pool.
FNX_POOL_MIN_RESIDENTonly stops a pool from being evicted below N residents, so with one pool it could act only if the whole GPU held fewer than N experts (384 here), while 2x16 GB holds several thousand of them. With or without the floor the residency plan is the same by construction (and with the default of 0 the skip is never taken). So instead of the JamC subset, I'd point to that. If you would still like the run (start-up residency log with and without the floor, plus greedy outputs on a few hundred prompts), I can do it.@nabe2030 commented on GitHub (Nov 7, 2026):
Update: I closed #5258, since v0.2.12 includes the equivalent per-pool floor from #5158. With that in, the fork should only need the launch-rule patch. Next step here is to rebuild v0.2.12 with that single patch and check that IQ3_S still loads and runs at 256K on the 2x 16 GB GeForce box; I will post the result in this thread.