mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #253] [Linux][multi-GPU] 8 GiB cudaHostRegister cap causes ~3x Q2_0 prefill slowdown #133
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#133
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 @bettercallcaleb on GitHub (Sep 30, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/253
Summary
On Linux, Strata's multi-GPU path appears to apply the same 8 GiB CUDA host-registration cap that the source comments describe as a Windows/WDDM workaround.
On my Q2_0 setup this pushes most of the expert arena onto the unpinned staging path and causes a severe prefill regression.
A local patch that keeps the 8 GiB cap on Windows but uses unrestricted
cudaHostRegisterPortableon Linux improved 32K-context prefill from ~665 tok/s to ~2,110 tok/s and reduced per-chunkwait copytime from ~2 seconds to tens of milliseconds.Environment
bbaaabb4643bb7873d4cef9d48b5dcf96e6cbff43060 -> 4090--layer-split autoselectedK=2PCIe measurements:
Stock behavior
Startup:
Benchmark:
With
STRATA_PREFILL_TIMING=1, representative 2048-token chunks on the 4090 stage:Full ~28K prompt:
Controls
memlock
Raised RLIMIT_MEMLOCK to unlimited.
Performance was effectively unchanged:
So
mlock()itself does not solve the issue.PCIe
Pinned-memory CUDA copy benchmark:
The secondary GPU PCIe link is behaving normally.
Prefill chunk size
4090-only with explicit
--prefill 2048:So the 2048-token chunk size does not explain the dual-GPU ~665 tok/s result.
Suspected cause
Current code applies the 8 GiB registration cap whenever
multi_gpuis true:The surrounding source comment describes this as a Windows/WDDM workaround.
On Linux, this appears to leave most expert pages outside CUDA page-locked registration, causing the prefill path to spend most of its time in
wait copy.Local patch
I changed only the cap selection:
Same machine, same model, same GPU order, and same K=2 split:
Full ~28K prompt:
Representative patched chunks:
So the Linux-only full-registration change improves this workload by about 3.2x and removes the multi-second expert-copy waits.
Possible fix
If the 8 GiB cap is specifically needed for Windows/WDDM, would it make sense to keep it under
_WIN32while leaving Linux unrestricted and relying on the existing registration fallback if full registration fails?I can provide additional raw timings or test a proposed change.
@cha0yang commented on GitHub (Sep 30, 2026):
Independent confirmation on a 2x16 GB Blackwell box — plus one caveat that 36 GB of VRAM hides.
Environment
[120]arch--kv k8v4,--mtp,--spec 4--layer-split auto-> CUDA0 layers 0-27, CUDA1 layers 28-47--pcie-frac 0.00(calibrated)The patch
Same line as yours, in
src/program/generate.cpp:The host side also needs
memlockraised, since the arena is ~40 GB. Before / after:(
/etc/security/limits.conf:zhuerpiao - memlock unlimited. It is silently required for theunpatched build too, but only shows up as
mlock failedin the log.)Results
Same weights, same context, same box; only the
pin_limitdiffers.Decode is unchanged (~70 tok/s), expert-cache hit rate is unchanged (87.8%), and the outputs
read the same to me. Your 32K number (2,110) and mine (2,141) agree to within 1.5% on
completely different hardware — that looks like the cap was the whole story, not a quirk of
your 3060/4090 split.
(The 8K "after" number also carries a manual
--prefill, becauseautono longer starts at allonce the arena is fully pinned. With
--prefill 512, the smallest chunk that starts, it is already1,110 tok/s — so the pinning alone is worth at least +28% on 8K, and the rest is the chunk size.)
Caveat: pinning the full arena costs VRAM
cudaHostRegisterPortablemaps the arena into the GPU's address space, and the driverreserves VRAM for those mappings. On 2x16 GB that is enough to break startup: the expert
cache shrinks,
--prefill autostill picks a 2048-token chunk, its buffers no longer fit,and the engine exits before it is ready.
With 36 GB across two cards this is invisible, so it may be worth a note: on 16 GB cards the
patch trades VRAM for pinning, and
auto's estimate does not seem to account for the VRAMthe mappings take. Workaround is to pin the chunk size instead of using
auto— sweep onthis box, 8K prompt:
--prefillSo the win is real and large, but on smaller cards it is a win with a manual
--prefill,not the free lunch it looks like on a 24 GB card. Thanks — the write-up with the numbers made
this easy to reproduce.
(Separately filed #268 for an O(n^2) BPE loop in
tools/strata_tokenizer.py, also CJK-only.)@Niko1221 commented on GitHub (Sep 30, 2026):
Confirmed - the 8 GiB cap is a Windows (WDDM) workaround that also applies on Linux. 0.1.31 applies it only under WDDM (Windows and WSL2), adds
STRATA_ARENA_PIN_GIB(N GiB, or 0 for the whole arena), and steps the prompt chunk down instead of exiting when the whole arena is pinned. We're measuring it on a 2-GPU AMD box too.@Niko1221 commented on GitHub (Oct 1, 2026):
Fixed in 0.1.31: the 8 GiB cap applies only under WDDM (Windows, WSL2); Linux pins the whole arena again, and
STRATA_ARENA_PIN_GIB=Nsets a cap on any OS. The split's prompt chunk steps down instead of exiting when the stages' caches shrink. Thanks for the measurements!