mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #158] [CLOSED] WSL2: survive the driver's ~1 GiB pinned host budget with 3 GPUs #2482
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#2482
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/158
Author: @MrRoza
Created: 9/29/2026
Status: ❌ Closed
Base:
main← Head:wsl2-pinned-budget📝 Commits (1)
03c7d87WSL2: survive the driver's ~1 GiB pinned host budget with 3 GPUs📊 Changes
2 files changed (+34 additions, -13 deletions)
View changed files
📝
src/core/native_head.cpp(+25 -9)📝
src/program/generate.cpp(+9 -4)📄 Description
Problem
Under WSL2 (e.g. Docker Desktop on Windows), the NVIDIA driver can pin or map only about 1 GiB of host memory in total. When it runs out, the WSL kernel logs:
With the secondary expert caches (
--expert-cache-device1 5000 --expert-cache-device2 5000) on 3 GPUs, startup failed twice because of this:strata generate: CUDA2 experts: cudaSetDevice(2) failed: out of memory (CUDA error 2)CUDA1's context is created early (before CUDA0's weights, per the "proven startup order" comment), but CUDA2/3 are created after CUDA0's weights and MTP load. By then CUDA0's mapped host buffers (such as the 260 MiB native embedding) have used up the budget, and creating a new context needs some of it too.
strata generate: native embedding: cannot pin 260 MiBThree contexts now fit, but the mapped embedding table no longer does.
What we checked
cudaSetDevice(2)every time.dmesginside the WSL VM shows hundreds ofestablish_gpadl failed: -122lines at startup. That's a limit on pinned/mapped memory, not free RAM: the VM had >80 GB free, and dropping caches doesn't help.cudaHostAllocfails even at--prefill 2048). This PR doesn't change the layer split.The fix
STRATA_EARLY_REMOTE_CONTEXTS=1(opt-in; default behaviour is unchanged): creates every secondary context in the early block where CUDA1's already is, before CUDA0 allocates its weights, MTP and mapped buffers. The later loop skips contexts that already exist. Context creation then comes out of the budget first, while it's still available.cudaHostAllocfor the native embedding fails, the table is copied into the current device's VRAM (cudaMalloc+cudaMemcpy) and a line is logged, instead of failing the start. It's only ever gathered from, so a device copy works the same way; it costs its size in VRAM (260 MiB) and reads faster than over PCIe. The destructor frees whichever copy was used. Behaviour doesn't change when pinning succeeds.Result
With both changes, the 3-GPU helper setup starts and serves in Docker/WSL2:
Under WSL2, the second helper doesn't make it faster than one helper (39K-token cold prompt: 625 vs 636 t/s prefill, 41–50 vs 46–53 t/s decode). Presumably the pinned-memory limit also slows the helpers' result path. On native Windows the same 3-GPU setup does 944 t/s prefill and 47–60 t/s decode. So this PR is about starting reliably under WSL2, not speed.
Tested on engine 0.1.24 (commit
3ce2523). The branch is rebased onto currentmain(8fc40dd), where both changes apply cleanly, but that rebased build hasn't been run.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.