Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#1474
Loading…
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?
The idea
TL;DR. On a 16 GB Windows PC the game's private memory is what ends long sessions (the commit-limit crashes below), and part of it is pipeline knowledge kept resident: the pipeline cache file the driver holds, and the shader modules of programs whose pipelines are already built. Linux already has two ways to give some of that back (#416 leaves the cache file unread on small Linux NVIDIA PCs, #223 lets the modules go after the precompile); Windows has neither, by code, not by choice. I propose extending both to Windows, one at a time, each behind its own measurement, and not adopting a lean "no cache at all" mode. This is from reading the code and the related issues and pull requests; I ran nothing for this issue, and no number below is a Windows saving.
Why it matters (leads, not measurements)
0x20474343(all builds; 36 of them on rc.6). rc.7 added the wait at the commit limit (#1291), so since then the same situation ends with "Your PC ran out of memory" instead (#1364, after 21 minutes). #1280 and #333 are the two allocation paths that ended the game there.What the code does on Windows today (forge main
6112edb61, line numbers from there)pcache_load_off()(gpu/vk/vk_draw.cpp:1106) is #416's rule. On Windows it setslinux_nvidia = falseandram_mb = 0(:1111-1113), so the automatic "do not read the file" choice can never be made there. OnlyRX_VK_PCACHE_LOAD=0skips the file.pcache_init()(:1165) always creates aVkPipelineCache, empty when the file is skipped (:1178), and keeps it for the session. The file's mapping is released once the cache is made, so the file's size on disk is not the game's RAM: what costs RAM is the driver's copy inside the cache object.play_cache_begin()(:966) treats the two kinds of skip differently, as #415 and #416 intended: the automatic skip keeps play generations and lets each go at a save without writing it; the explicitRX_VK_PCACHE_LOAD=0starts none, so play's pipelines go into the one base cache, which grows for the whole session. SoRX_VK_PCACHE_LOAD=0on Windows is an A/B of the file, not a model of a lean mode.pipeline_cache_play()(:11489) callsprogram_cache_drop_modules()(gpu/vk/vk_progcache.cpp:985) inside#ifdef __linux__only, driven bylinux_pressure(/proc/meminfo). On WindowsRX_VK_DROP_MODULES=1does nothing.The two changes I would try, in this order
longshot_programs.binexist; what is missing is a Windows condition. Windows has the numbers it needs (GlobalMemoryStatusEx: physical RAM and commit headroom; the texture budget already reads the headroom this way incommit_headroom,gpu/vk/vk_texture.cpp:340), so the condition could mirror Linux's: 20 GB of RAM or less, or commit already near its limit. Its limits, as #223 says: with programs loaded at their create calls few modules exist at the start to let go, so this helps most after a full precompile or a cold-cache recovery (#1188), not modules made later in play; and a new state variant in play must remake its module on a worker, never on the replay thread. Expected cost: none measured; possible first-use waits for new variants.precompile_warmfills the base cache even when the file was not read, so a recovered session's peak is not bounded by this rule. One caution from Linux: on #388 HumanBean's reproduction (RTX 3090, the game held to 13 GB) saw no change in swap from #416 (5.0 and 6.3 GB against main's 5.7 and 5.9), so even the Linux saving needs a second look before it is carried over.A third option, replacing the big cache with a smaller one after a full precompile once no builder is running, would free the cache object's storage but nothing the pipelines themselves hold, does not lower the startup peak, and needs a reader-lifetime protocol for every cache call; I would leave it until the first two are measured.
What I would not do
vk_programs.cpp).How to measure it (one change at a time, interleaved runs, the same folder prepared the normal way)
Anything else
Existing work this builds on, not around: #416 and #415 (the two skip paths), #223 (module release and remake), #975 (programs at their create calls on the compute fallback), #1188 (the driver-cache probe), #903 (the cache saved before the title), #563 (more prepared pipelines: coverage stays), #190 (Intel's fetch lock), #1291 (the commit-limit wait). Open and related: #789 and #902 (driver-cache detection and diagnostics), #737 (one shader cache store across game folders: disk, not RAM), #801 (dynamic vertex input: fewer pipelines), #1339 (memory accounting, which leaves pipelines and modules out), #805, #388, #1443.
Another port, Project ReLink, takes the lean route further: no application cache by default, and a big cache swapped for a smaller one after its full precompile. I read its approach as an idea only; nothing of its code is proposed here, and its private-memory numbers are against its own earlier configuration, not against Longshot today.
What I can add: Linux with NVIDIA here, and a Windows 11 laptop with Intel Arc integrated graphics (shared memory, 64 GB), which can give the integrated case's private commit and working set with the file read and not read, and with modules kept and released, once a build with a Windows trigger exists. A 16 GB Windows NVIDIA tester would be the most useful second data point.
Possibly related, for context:
RX_VK_LOAD=createmeasured on a second such card (RX 5600 XT): same fps or better, loads of 50 ms at worst — Windows pipeline-related private-memory cost, though focused on loading policy.