perf(pipelines): RX_VK_PCACHE_LOAD=0 skips the 2.5 GB pipeline cache file (~3 GB less RAM; opt-in) #2206

Merged
NotRexed merged 2 commits from perf/pcache-load-switch into main 2026-11-11 08:05:24 +00:00
NotRexed commented 2026-11-11 07:54:38 +00:00 (Migrated from github.com)

mkw_vk_pipelines.bin grows with every pipeline ever built (2.5 GB in this test folder; 961 MB on an AMD player's). At every start it is read whole (pcache_init: a 2.5 GB vector, then vkCreatePipelineCache with it) and the driver keeps it in memory for the whole session. Each save also allocates the whole cache again.

RX_VK_PCACHE_LOAD=0 starts with an empty cache and doesn't save it, so the driver's own shader cache does the work. Off by default: nothing changes unless it is set.

A/B

RTX 4060 Ti, 25-minute route (Kokiri, Hyrule Field, Kakariko), docked 1440p, 2 rounds each, alternating:

run p99 max frame stutters private peak working set at end shaders at start
file loaded 1 28.6 ms 610 ms 316 32.5 GB 17.7 GB 4.2 s
PCACHE_LOAD=0 1 27.8 ms 489 ms 283 30.1 GB 14.9 GB 6.5 s
file loaded 2 28.6 ms 636 ms 311 32.7 GB 17.7 GB 4.2 s
PCACHE_LOAD=0 2 29.1 ms 477 ms 347 29.8 GB 14.7 GB 6.6 s

That's ~2.7 GB less commit and ~3 GB less resident memory. The worst frame was lower both times, stutters were mixed, start-up was 2.4 s longer, and there were no crashes.

Why not the default

NVIDIA's driver cache on this PC was warm. On a fresh install, or a driver whose own cache is small or cleared (AMD; older NVIDIA defaults), skipping the file could mean pipelines compiled in play: stutter. It is for players near the commit limit: tonight an RTX 3060 player's game crashed after 54 minutes on an uncaught exception at 30.7 GB of commit. A default needs data from AMD and a cold driver cache first.

🤖 Generated with Claude Code

`mkw_vk_pipelines.bin` grows with every pipeline ever built (2.5 GB in this test folder; 961 MB on an AMD player's). At every start it is read whole (`pcache_init`: a 2.5 GB vector, then `vkCreatePipelineCache` with it) and the driver keeps it in memory for the whole session. Each save also allocates the whole cache again. `RX_VK_PCACHE_LOAD=0` starts with an empty cache and doesn't save it, so the driver's own shader cache does the work. **Off by default**: nothing changes unless it is set. ### A/B RTX 4060 Ti, 25-minute route (Kokiri, Hyrule Field, Kakariko), docked 1440p, 2 rounds each, alternating: | run | p99 | max frame | stutters | private peak | working set at end | shaders at start | |---|---|---|---|---|---|---| | file loaded 1 | 28.6 ms | 610 ms | 316 | 32.5 GB | 17.7 GB | 4.2 s | | `PCACHE_LOAD=0` 1 | 27.8 ms | 489 ms | 283 | 30.1 GB | **14.9 GB** | 6.5 s | | file loaded 2 | 28.6 ms | 636 ms | 311 | 32.7 GB | 17.7 GB | 4.2 s | | `PCACHE_LOAD=0` 2 | 29.1 ms | 477 ms | 347 | 29.8 GB | **14.7 GB** | 6.6 s | That's ~2.7 GB less commit and ~3 GB less resident memory. The worst frame was lower both times, stutters were mixed, start-up was 2.4 s longer, and there were no crashes. ### Why not the default NVIDIA's driver cache on this PC was warm. On a fresh install, or a driver whose own cache is small or cleared (AMD; older NVIDIA defaults), skipping the file could mean pipelines compiled in play: stutter. It is for players near the commit limit: tonight an RTX 3060 player's game crashed after 54 minutes on an uncaught exception at 30.7 GB of commit. A default needs data from AMD and a cold driver cache first. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Commenting is not possible because the repository is archived.
No description provided.