mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3725] [Engine] Windows: the auto RAM complement ignores the WDDM shared-segment cap, the engine dies at start on a 2-GPU layer split (patch inside) #1557
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#1557
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 @altiber on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3725
Problem: on Windows the auto size of the pinned RAM complement is taken from the commit capacity only; it can exceed the WDDM shared (non-local) segment of the GPUs, and the engine dies at start on the next tiny allocation.
Environment: Windows 11, Strata v0.2.2 (
011c9e60), engine 0.1.47 built from source (CUDA 13.0, archs 86;120), Q2_0 native pack, layer split over RTX 5070 Ti 16 GB + RTX 3070 8 GB (gpu: [0,1], card order 1,0), Ryzen 7 9700X, 31 GB RAM,--resident-experts,--max-context 131072 --kv int8, MTP +--spec 4.Reproduce:
--resident-budget-gib(auto complement), layer split over the two cards as above.Expected: the engine starts; the auto size stays within what the GPUs can map.
Actual:
EngineDiedbefore READY -prefill: the token id buffer (out of memory): the failing allocation iscudaMalloc(chunk * 4)inPrefill::init(~26 KB), so it is not the VRAM.Evidence:
Windows counter
GPU Adapter Memory\Shared Usage: 11.98 GB on both NVIDIA adapters with a 10.5 GiB complement.Reproduction status: reproduced on this machine - two starts in a row failed (14.81 and 14.91 GiB pinned); starts that pinned 10.3-10.6 GiB worked. With the patch below several starts worked (10.57-12.68 GiB pinned, all READY). The WDDM explanation is our analysis, confirmed by the counter above, not by a statement of the driver.
Cause. Under WDDM every page-locked mapped host buffer counts against the GPU's shared (non-local) segment, on every CUDA device it is mapped into, and Windows caps that segment at about half the RAM (here ~15.5 GB). The Windows counter
GPU Adapter Memory\Shared Usageshows 11.98 GB on both NVIDIA adapters with a 10.5 GiB complement, i.e. ~1.5 GB of other mapped buffers on top. 14.8 GiB + ~1.5 GB > ~15.5 GB, so the next allocation fails. The commit capacity (RAM + page file) does not show this limit at all.Fix (tested here). Ask DXGI how much of the non-local segment this process has left on each NVIDIA adapter (
IDXGIAdapter3::QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL),Budget - CurrentUsage), take the smallest, keep 2 GiB for the buffers mapped after the complement (STRATA_WDDM_SHARED_RESERVE_MIBoverrides), and clamp the budget to it. Result on the same PC, full auto, no manual budget:READY in 25 s, serving a coding agent since. The 2 GiB reserve is a fixed guess from the measured ~1.5 GB; a better value could come from the lend ring / hand-off sizes the engine knows later. The adapter filter is VendorId 0x10DE; matching the CUDA devices by LUID would be more exact.
@altiber commented on GitHub (Oct 23, 2026):
Follow-up: the WDDM cap alone is not enough on a 31 GB PC - a second clamp is needed, and with both the auto sizing works without any manual budget.
What happened with the WDDM cap only (no KV streaming, auto budget): the shared segment allowed 14.68 GiB, the complement got 12.68 GiB, the engine started fine - but then the process held ~20 GiB, the standby list (page cache) fell to 0.13 GiB, the file tier was read from the SSD at ~150 MB/s (
Memory\Pages Input/sec) and decode on a coding-agent workload fell from ~83 to 61-70 tok/s at the same context lengths. Pinning more experts is not better when it leaves Windows no page cache: the engine itself grows by ~7 GiB after the complement is placed (buffers, mapped dense weights, the file tier's pages in the working set).Second clamp (keep 10 GiB of the RAM read before pinning for that later working set and the page cache,
STRATA_RAM_LATER_RESERVE_GIBoverrides):A/B, fresh start each, same bench (4 fresh prompts of 15.8-21.6K tokens from real Pascal code, 300 generated tokens; the first request after start excluded as warm-up):
--resident-budget-gib 10.5The 10 GiB is measured on this one machine (31 GB RAM, 5070 Ti + 3070 split, Q2_0); a reserve derived from what the engine allocates after the complement would be better than a constant.
@thestigma commented on GitHub (Oct 31, 2026):
Related fix now in PR #4860: an opt-in
STRATA_RESIDENT_PIN_MODE=registerpins the complement through the arena's own slicedcudaHostRegister(per-slice device aliases, DXGI-budgeted). Measured anatomy on a desktop 3090 Ti + 3090 / 64 GiB RAM box: the DXGI NON_LOCAL budget is one global 46.16 GiB pool (cumulative 1-GiB pins reach 45.0 GiB, 46.0 fails, identical for alloc and register), but a SINGLE pinned allocation caps at ~23 GiB regardless of free RAM — so the refusal here and in #2535 is the per-allocation ceiling, not pool exhaustion. Slicing keeps every registration under the ceiling; the engine's own pin guard (Budget minus Usage minus headroom) then bounds the total. Answers are byte-identical with the env on vs off (token-for-token parity, temp 0).