mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3201] [Engine] NUMA-split CPU expert pool: +10 to +14 % decode on a dual-socket Xeon, measured, opt-in #1296
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#1296
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 @baptisterajaut on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3201
Area
[Engine] (speed, kernels, models, the server and API)
What do you want to do?
Hi, in #2242 you wrote that a dual-socket owner reporting a measured decode gain would be worth revisiting. Here is one, with a different approach from #2242, so I would like your read on scope before opening a PR.
Box: HP Z6 G4, 2x Xeon Gold 6226 (12 cores each), 64 GB DDR4-2933 (32 GB per NUMA node, 4 of 6 channels per socket), one RTX 3090 on PCIe 3.0. Qwen3.8-Flash-Next-Uncensored IQ4_XS at 262K context with MTP, v0.2.0-beta. Same tuning in every arm:
--adapt-async 1,STRATA_POOL_SPIN_US=200,STRATA_ROUTE_TAIL_SKIP=0.Server decode, interleaved starts, expert profile frozen:
Prompt speed and VRAM hit rate (74 %) are unchanged.
What the split does, behind
STRATA_NUMA_SPLIT=1:Each socket then reads only local weights and never waits on the other socket's counters. #2242 binds the complement to the GPU's node; this keeps both nodes' memory and both sockets' cores in use. With the variable unset, the default path is unchanged.
These numbers agree with #674 and #707: more workers across sockets are slower on their own. The gap with the split would point at the cross-socket synchronisation rather than the core count.
Would a PR along these lines be in scope? The branch is ready with tests (pool_plan_test, pool_tasks_test including 192 bitwise comparisons in split mode, file_expert_source_test) and the full protocol. Limits up front: Linux only, 2 nodes, native expert layers only, measured on this one CUDA box.
What do you do today instead?
The 0.2.0 default: 11 pool workers on the host socket, the other socket's 12 cores idle (before 0.2.0,
numactl --cpunodebind=0for the same effect).@xrip commented on GitHub (Oct 19, 2026):
A data point from a second dual-socket box, with the opposite result: here the 0.2.0 one-socket default costs 12.6 % decode, and the old cross-socket count (19 workers, no split) is the fast one. I have not tried your split branch.
Hardware and software
--layer-split auto. Linux, CUDA 13.3 toolkit, source build (GCC 14,-DCMAKE_CUDA_ARCHITECTURES=75,STRATA_ISA_FLOOR=avx).performanceand C-states deeper than C1 were off; no other load.ed59f920), IQ3_XXS, converted to the native pack.f57c0adc) plus my fork's cache patches (the conversation disk tier from PR #1937, off here, and prompt-cache checkpoint placement); none of them touch the CPU pool or the decode kernels. Baseline: the same fork on v0.1.45 (477ac13c), built the same day.Model and configuration
Qwen3.8-Flash-Next GSQ-RCO IQ3_XXS native pack,
--kv int8 --spec 4 --spec-min-p 0.5 --mtp <rt> --max-context 393216 --expert-cache auto --prefill auto --adapt-swaps 0 --pcie-frac 0.17 --prompt-cache 8. Env:STRATA_BF16_TC=1 STRATA_SM75_PERF=1 STRATA_EXP_MODE=8 STRATA_ROUTE_TAIL_SKIP=0, andSTRATA_PREFILL_CPU_SHARE=0for the decode runs. The arms differ only in--pool-workers, plus the binary for the 0.1.45 arm.Method
A fresh server for each run. A 171,870-token code prompt, then 6 questions on it with 512 greedy tokens each (the prefix is reused, so this is decode). Decode tok/s = generated tokens / decode ms, summed over the 6 requests from the server log. The VRAM hit rate is 97.9-98.0 % in every arm, so the CPU computes about 2 % of the routed experts.
--pool-workers 19STRATA_PREFILL_CPU_SHARE=auto, 2 interleaved runs each): 9 vs 19 workers, 42K 21.95 / 22.11 s vs 21.86 / 22.08 s, 172K 74.23 / 74.08 s vs 74.10 / 74.12 s. So no difference in prefill here either.Limits: one box and one pack. The 9-worker arm is a single run (the gap is about 35x the spread of the six 19-worker runs). Swaps were off. I did not try counts between 10 and 18,
numactlbinding, orSTRATA_NUMA_SPLIT.So the host-socket default is a regression on this box, while on yours plain 22 workers lost. A split that keeps both sockets busy would fit both results; the plain one-socket default fits only yours. I pinned
--pool-workers 19in my config.Reproduction status: measured locally; every number here is from my runs on this box.
@baptisterajaut commented on GitHub (Oct 19, 2026):
Thanks, that's a useful second box. The plain arms disagree: here 22 workers without the split lost 4.5 % to the one-socket default, on yours 19 workers win 14.6 %. One difference would be the CPU's share of the work: about 2 % of the routed experts for you, about 25 % here (74 % VRAM hit rate). With AVX-only kernels and little CPU work, the per-layer tail of the slowest CPU expert would weigh more than the memory reads, and more cores shorten it.
If you have time to try the split, the branch is at https://github.com/baptisterajaut/Strata/tree/feat/numa-split (rebased on v0.2.0-beta).
STRATA_NUMA_SPLIT=1with no--pool-workersgives 18 workers + the host on your 2x10 cores, spread over both sockets; the start-up log prints the slices and one placement line per node. The arms that would tell the most: the default,--pool-workers 19, and the split. 32 GB per node may be tight for the halves if your complement is large; the log warns "NUMA placement at risk" in that case.@Tworks25 commented on GitHub (Oct 19, 2026):
+1 for the split direction, from a box that sits between the two you already have — different in a way neither covers: sm_86, a high VRAM hit rate, an AVX-only CPU, and enough RAM that the expert set never touches the disk.
Hardware and software
STRATA_ISA_FLOOR=avx— the only path on this CPU, since the ready-made engine refuses it.Why this box is a useful third arm
Your 74 % hit rate and xrip's 98 % are the two ends you have compared. 48 GB on sm_86 should land at or above xrip's hit rate — the CPU would then compute very little of the routed experts, well below the ~25 % that made one socket the right answer here. If your reading is right that the CPU's share is what decides it, this box should behave like xrip's: the one-socket default costs decode, and a cross-socket worker count recovers it, with AVX-only kernels making the per-layer tail longer than on an AVX2 host.
The RAM is the part that makes this a third case rather than a copy of xrip's. IQ3_S is about 50 GB of expert blobs, and with 220 GB they stay in the page cache permanently — after the first read there is no SSD component in the CPU's expert path at all, on either socket. xrip measured at 64 GB, where part of the set is still coming off disk; this box measures the same AVX-only penalty with that term removed. It also means the new RAM/SSD-aware prompt-chunk planning in 0.2.0 should be a no-op here (the docs say so for a set that fits the page cache), so any difference I see is kernels and topology, not I/O.
Three questions
STRATA_NUMA_SPLIT=1to add anything over plain cross-socket--pool-workers? Or is the win only in the regime where the CPU computes a real share of the experts?What I will report
Fresh server per arm, expert profile frozen, everything else identical: (a) the 0.2.0 default, (b) an explicit cross-socket
--pool-workers, (c) the split branch atSTRATA_NUMA_SPLIT=1with no--pool-workers. Decode and prefill at ~32K and ~130K, with the start-line worker counts and the NUMA placement lines quoted, and the page-cache state of the expert files noted so the "no disk term" claim is checkable. If a sweep point is a single run I will label it as one.@baptisterajaut commented on GitHub (Oct 19, 2026):
Woopsie on my side: the box ran with the IOMMU translating every DMA (
DMA-FQin/sys/kernel/iommu_groups/*/type, the Debian 6.1 default). Pinned H2D was 7.7 to 9.2 GB/s on PCIe 3.0 x16; withiommu=pton the kernel command line it is 12.3 GB/s.I re-ran the whole A/B with it, same protocol, 10 server starts, server decode medians:
The default gains from the faster bus and the split does not move, so the gain is +9.7 % here, against +14 % and +11.5 % in the two earlier sessions. Title updated to "+10 to +14 %". The ranking is unchanged: the split at 22 workers is still the only arm above the default. Prompt speed at 60K went from 926-1037 to 1282-1341 tok/s in every arm, passkey found in all 20 runs.
On a distro kernel the same check takes a second:
cat /sys/kernel/iommu_groups/*/type | sort | uniq -c.@baptisterajaut commented on GitHub (Oct 19, 2026):
Thanks, a 220 GB box is a case neither of us can run.
I don't know yet, xrip's or your numbers will tell. The split only shortens the CPU part of each decode window. Here, with
STRATA_DECODE_TIMING=1, the log linestrata decode timing: ... per-layer host X [... CPU Y]puts the CPU at 13 to 16 ms of a 30 to 33 ms window, about 4 CPU experts per layer per window. At a 98 % hit rate that term should be much smaller, so the room left for the split over a plain cross-socket count would be small too. If you can, add that line to your report, it shows the ceiling directly.The page cache is not the read path under the split. At load the engine releases the model files' cached pages, then copies each expert's two row halves into page-locked memory on their own node (
FileExpertSource: NUMA placement: the model files' cached pages were released ...). So the reads are node-local anonymous memory whatever the RAM size. What 220 GB changes is the room: here 32 GB per node is tight, theNUMA placement at riskwarning fires on every split start and a node lands as low as 95.2 % of its slices. Yours should land at 100 %. On this box the per-node slices without the placement gave nothing (51.0 against 53.1 for the default in the same session), so local reads are part of the gain, but not all of it: the split at 12 workers gave nothing either.Nothing to set. The 3090 here hangs off socket 0 too, and the host thread stays there. Just don't wrap the server in
numactl --membindor--cpunodebind: it would pull both halves onto one node and defeat the placement. The start-up linestrata cpu pool: NUMA split on: slice 0 = node 0 (N threads), slice 1 = node 1 (M threads)and the placement line confirm it took. If the placement line is missing, the complement went through a path the split does not cover.The IOMMU check in my comment above may matter more on your box than the split: it moved prompt speed by about 30 % here.
@xrip commented on GitHub (Oct 20, 2026):
A follow-up on the IOMMU check, from the same box as my first comment (2x Xeon E5-2670 v2, 2x CMP 50HX 20 GB on PCIe gen2 x16 plus a third CMP 50HX on an x1 slot, Ubuntu 24.04.4, kernel 7.2.9, NVIDIA driver 610.43.03 with a CMP unlock patch). Here
iommu=ptchanges nothing and cost me a GPU, so I reverted it.The default here was the same as on your box: all 93 groups
DMA-FQ("Default domain type: Translated"), no IOMMU option on the kernel command line.Pinned copy speed, a small CUDA test (
cudaMemcpyAsyncfromcudaHostAllocmemory, 256 MiB x 20 per direction), two runs per side, GB/s:DMA-FQ)iommu=pt(identity)4 MiB copies gave the same picture. PCIe gen2 x16 is already at its practical top here, so the translation costs nothing measurable. On your gen3 x16 box it held the copies to 7.7-9.2 of 12.3 GB/s. I did not measure prompt speed with
iommu=pt, since the copy speed did not move.A side effect, probably specific to this box: with
iommu=ptthe x1 card failed its GSP firmware boot ("Max GSP-RM boot attempts exceeded"). That boot path comes from the patched (CMP unlock) driver, so this is not a stock-driver result. In translated boots every card's boot data got a DMA address below 4 GB; with identity they got real RAM addresses, up to ~36 GB here. After the revert all three cards are back.So the one-second check is worth doing on gen3/gen4 boxes, but not on gen2. I have not run the split branch yet.
Reproduction status: measured locally.
@baptisterajaut commented on GitHub (Oct 20, 2026):
Thanks, that bounds it: on gen2 x16 the bus tops out before the translation costs anything, so the check is for gen3/gen4 boxes. Your GSP failure is worth keeping next to it: with iommu=pt the cards get physical RAM addresses instead of the low ones the translation handed out, so a driver path that only works below 4 GB would break, and the patched boot path looks like one. Anyone trying iommu=pt should keep a boot entry without it.
@Niko1221 commented on GitHub (Oct 20, 2026):
Thank you, and thank you to xrip and Tworks25 for the second and third data points. The NUMA-split pool is being built for 0.2.2: it switches on only on a machine with two or more NUMA nodes, a one-node machine runs exactly as today, and STRATA_NUMA_POOL=0 turns it off. We have no two-socket box, so it will ship as built from your report and not tested on such a machine; your numbers on it will decide whether it stays on.
This is in Strata 0.2.1: https://github.com/Niko1221/Strata/releases/tag/v0.2.1
@baptisterajaut commented on GitHub (Oct 20, 2026):
No need to build it yourself: it's already done on my branch, I was waiting for your go on scope before opening a PR. It's rebased on 0.2.1 with the behaviour you describe (on with 2 NUMA nodes,
STRATA_NUMA_POOL=0to turn it off, one-node machines unchanged), and it fixes a placement footgun found this morning. I'm finishing a last check on the off path and will open the PR within the hour.@baptisterajaut commented on GitHub (Oct 20, 2026):
The PR is up: #3413.
The footgun: at load the engine released only the GGUF files' cached pages, while the pack's files and the MTP head read at start stayed in the page cache. With 32 GB per node that left a node under 95 % of its slices and the placement printed FAILED. With those files dropped too, three starts placed 100 % on both nodes.
The default count also spans both sockets only when the split will actually follow (2 nodes, pinned threads, no
STRATA_EXCHANGE_ROTATE=1). A 2-socket box where the split is refused keeps the one-socket default, since 22 workers without the split were the slowest arm here (43.25 against 54.05 tok/s).The one-node check ran on this box with the process bound to one node (
numactl --cpunodebind=0), which the pool's topology detection follows; a run on a real single-socket machine is still missing.@baptisterajaut commented on GitHub (Oct 21, 2026):
A real use case for NUMA awareness, from this box: for a reason I'm still chasing, the UPI link between the two Xeons has started falling back to half width (x8) under load. At x8 the one-socket pool (
STRATA_NUMA_POOL=0, 11 workers) dropped from 54.0 and 52.1 tok/s to between 38.8 and 45.0, roughly a 20% loss, while the split stayed at 56.6 and 57.4 (54.5 and 57.9 at full width). One start per arm on 0.2.1 with #3413, so a rough measurement, but the direction is clear: the split keeps each socket's reads on its own memory and barely touches the link, so a degraded interconnect costs it nothing visible.Full report, even if unrelated to Strata, because I have nowhere else to put it. Symptom: UPI / CPU interconnect falling back to x8 on an HP Z6 G4 (dual Cascade Lake)
This issue is very weakly documented online, so I'm putting it here in the hope that someone facing the same problem finds it.
HP Z6 G4, 2x Xeon Gold 6226 (Cascade Lake), the second CPU on HP's CPU/memory riser module, BIOS P60 v03.00, Debian 12, kernel 6.1. Symptom: bursts of corrected machine checks in
journalctl -kon banks 5 and 12, which are UPI on Skylake/Cascade Lake-SP according to mcelog'sskylake_xeon.c. MSCOD 0x30 is "COR LL Rx detected CRC error - successful LLR without Phy Reinit", and the one that matters, 0x22, is "COR Phy lane failure, recovery in x8 width". Nothing uncorrected, no crash, EDAC at 0 on every memory controller, and rasdaemon recorded none of it, so the kernel log is the only place to look. MSCOD is bits 31:16 of the status word, the0030and0022in the middle:Reproduction in under three minutes: each socket reads the other's memory flat out (
numactl --cpunodebind=0 --membind=1and the reverse, 12 threads each on an 8 GiB buffer), with bandwidth read from the IMC uncore counters (uncore_imc_N, cas_count_read). A healthy link gives 38.9 and 36.7 GB/s across, in line with a published measurement on another dual Cascade Lake with two UPI links (36 GB/s, links around 90 %). Then a burst of 0x30, one 0x22, and 26.9 and 15.5 GB/s from there on, stable for ten more minutes at x8 with no new error. Strata without the split should send far less than that across the link, which would explain why the box ran a full day of benchmarks before the first drop.The width can be read without stressing anything. The kernel exposes the UPI link layer as
uncore_upi_0..2, event codes in perf's cascadelakexuncore-interconnect.json. On this board only ports 0 and 1 are wired, socket 0 port 0 to socket 1 port 1 and socket 0 port 1 to socket 1 port 0. At idle a full-width link spends most of its time in L0p, the half-width low-power state (0x27 Tx, 0x25 Rx); a direction that has lost lanes never enters it. At x8, S1P1 to S0P0 sat at 0 % against 93 to 97 % for the three other directions, and after a good reboot all four are back in L0p. Sampled every 0.5 s during a drop, PHY_INIT_CYCLES (0x20) jumped on S0P0 and S1P1 only and S0P0's received data flits fell from 2,083 to 868 million per second: one link, one direction.Ruled out. iommu=pt, which the first drops seemed to correlate with: booted without it at full width, the link gave the same 38.6 and 36.1 GB/s and dropped the same way after 3 min 27 s, as expected for CPU-only traffic the IOMMU never sees. A temperature threshold: preheated with node-local reads (negligible UPI traffic) until CPU1 reached 78 °C, the link then held 2 min 22 s of cross traffic at 83 to 86 °C, against 2 min 53 s from a cold start where it dropped at 79 °C.
Two traps. A reboot does not always restore the width: with the BIOS Quick Boot enabled, three boots in a row after a drop came back at x8 from the first second, one of them after unplugging and draining the power, and a link trained at x8 logs no machine check at all. With Quick Boot disabled, five boots out of five came back at full width. Quick Boot reboots had restored full width earlier the same day, so this is a correlation I can't explain, but disabling it costs nothing. The second trap follows: a machine-check count of zero proves nothing about the width.
What helped: pulling the riser module, flooding both sides of its connector with contact cleaner and reseating it moved the drop under stress from 35 to 60 s to between 2 min 20 s and 3 min 30 s over four runs, where pressing it in place without removing it had done nothing. Not fixed though; the CPUs are being replaced (6230R) with an isopropyl rinse of the connector in the same pass, which will rule the contact and the CPU in or out together. Related: Intel erratum CLX34 (elevated bit error rate on UPI and PCIe, no fix), and HP Z620 owners clearing QPI error 932 by cleaning the riser contacts. I found nothing specific to the Z6 G4 or Z8 G4.
@xrip commented on GitHub (Oct 22, 2026):
0.2.2's NUMA pool on a second two-socket box: on by itself, no change in speed here (the experts come from the arena path), and two pool tests that expect a one-node machine.
Box: 2x Xeon E5-2670 v2 (Ivy Bridge-EP, 10 cores / 20 threads each, AVX only, 2 NUMA nodes x 32 GB), 2x CMP 50HX (sm_75, 20 GB) on a layer split, PCIe 2.0 x16, IQ3_XXS pack,
--pool-workers 19given in the config. The engine is our fork (0.2.2 + our conversation-cache patches, none in the pool or the kernels).What the split did at start:
A/B, A = 0.2.1 (engine 0.1.46), N = 0.2.2 (split on by itself), N0 = 0.2.2 +
STRATA_NUMA_POOL=0. Fresh server per run,--adapt-swaps 0,--pcie-frac 0.17, two rounds (arm order reversed in the second). Reads with the CPU prompt share on, decode with it off:First logits (CPU share 0, after a short prompt and after 172K tokens) are bit-identical in all three. Every difference is inside the noise: A's own two decode rounds differ by 1.6 %. So on this box the split costs nothing and gains nothing. Keeping it on by default is fine here.
Why no gain here: the experts come from the arena path, which the split does not place.
/proc/<pid>/numa_mapsof the running engine shows the 39.97 GiB arena (2 MB pages) as 28.84 GiB on node 0 and 11.13 GiB on node 1 (most likely node 0 filled first, then node 1). With each slice taking half of every expert's rows, node 1's threads read remote memory for about 72 % of the experts and node 0's for the rest: about half of the CPU expert reads still cross the link, and node 0's memory serves about 72 % of them. That is the part the native path's placement removes. If a placement for the arena path is planned, we can measure it on this box.Two tests fail on this box (built with
-DSTRATA_BUILD_TESTS=ON), because they compare against the real machine and expect it to have one node:pool_tasks_test:a one-node fake machine changed the pool's workers or cores. The check builds a pool on a fake one-node sysfs and then on the real machine; here the real one has the split on, so the cores differ (1,10,... against 1,2,...).pool_cores_test:FAIL: default: the workers sit on the topology's cores, in its order. With the split on, the default places the workers on the two sockets in turn. WithSTRATA_NUMA_POOL=0it passes.The engine is not at fault in either case. All other pool tests pass (
numa_pool_test,pool_plan_test), as do the conversation tests.@baptisterajaut commented on GitHub (Oct 22, 2026):
Closing: shipped in 0.2.2, on by default with two or more NUMA nodes,
STRATA_NUMA_POOL=0to turn it off. Numbers from this box in #3413. xrip's two pool test failures on a two-node machine are fixed by #3706.