mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-06 00:08:52 +00:00
Under WDDM every page-locked, mapped host buffer counts against the GPU's shared (non-local) segment on each CUDA device it is mapped into, and Windows caps that segment at about half the RAM. The complement was sized from the commit capacity alone, so on a 31 GB PC with two cards the auto size (14.81 GiB) filled the segment and the next 26 KB allocation ("prefill: the token id buffer") failed with out of memory before READY. pin_cache_complement now asks DXGI (platform::gpu_shared_memory_budget, already used for the sliced arena pin) for the room the tightest CUDA device has left, keeps 2 GiB for the buffers mapped after the complement (STRATA_WDDM_SHARED_RESERVE_MIB changes it) and cuts the budget to the rest; where DXGI cannot tell, nothing changes. detail::clamp_budget_to_shared_segment is the arithmetic, with a unit test in file_expert_source_test (the reporter's 14.81 -> 10.97 GiB case at 12.97 GiB left). Not taken from the report: its second clamp (10 GiB of RAM kept for the later working set), which is tuned to one 31 GB machine.