feat(gpu): default-on background driver shader cache working-set trim #306
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/306"
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?
Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T07:42:53Z.
Summary
Adds default-on background working-set trimming (
VirtualUnlockin 64 MiB chunks from a lowest-priority background thread) for mapped GPU driver shader cache files (NVIDIA DXCache *.nvph,Windows D3DSCache *.dxcache, and vendorDXCache/ShaderCacheblobs >= 16 MiB) once pipeline creation goes quiet.Adapted from GPL-3.0 upstream idea (
HypeLobbiesHD/ViceLite07ceab34) with MiniVI improvements:VICTORY_DRIVER_TRIM=0kill-switch only (no opt-in toggle).VirtualUnlockwith periodic1 msyields and active pipeline abort checks (ACTIVE_CALLS > 0/ re-arm) so Windows' process working-set lock never stalls frame preparation.30 s+>= 5 squiet floor) with zero idle polling when no driver cache is mapped yet, while still catching caches mapped lazily later in a session.K32QueryWorkingSetExworking-set query overhead in plain--releasebuilds (in_memory()resident probe runs only under--features diagnostics).ACTIVE_CALLSacrosspipeline::library::pipeline()calls (RAIIPipelineActivity) and exposespipeline::quiet_ms()forhost::sweep().Closes the #1 Rank 1 System RAM lever in
#276.Verification
cargo +1.98.1-x86_64-pc-windows-gnu xtask policy->321 files okcargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib --locked -- drivercache->5 passed; 0 failedcargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --locked -- -D warnings-> cleancargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics --locked -- -D warnings-> cleanobjdump -p D:\victory-build\minivi\release\MiniVI.exe | Select-String "DLL Name"-> standard Windows DLLs onlySame-Path (
victory.exe) Plain--releasePaired 90s A/B Benchmarks (RTX 4060 Ti 8 GB / i7-13700F / 32 GB RAM,-PlayParity, NO--features diagnostics)1. Active 2 GiB Driver Cache Unlock Observed (
paired-*-drivertrim2-1440p-90s):When NVIDIA held the
2,048 MBDXCache\*.nvphmapping open, backgroundVirtualUnlockfired 3 times (2048 MB unlocked of 2048 MB mapped, 1 region, 32 chunks,1098 msinitial walk,40 ms&38 mscached subsequent trims):main(79e8487)feat/driver-shader-cache-trim)13.5 fps(74.0 ms)14.7 fps(68.1 ms)+1.2 fps(+8.9%)29.1 ms/14.5 ms28.0 ms/11.7 ms-1.1 ms/-2.8 msavg/med/max)18,868/20,717/21,652 MB16,480/19,459/19,849 MB-2,388/-1,258/-1,803 MBmed/min/end)1,046/435/845 MB3,035/2,769/2,769 MB+1,989/+2,334/+1,924 MB0002. Final Branch Code Cleanliness (
paired-*-drivertrim5-*, 1440p + 4K DLSS Quality):With warm host pipeline library (where the driver already released/skipped mapping a >= 16 MiB cache in the 90s window), the idle path logs once (
0 mapped cache regions found) with zero polling overhead or instability:preparingcopybackworking_set_mbmedfree_ram_mbmedmain(79e8487)14.9 fps(67.0 ms)26.8 ms11.1 ms18,866 MB2,644 MB0drivertrim5)15.0 fps(66.7 ms)27.6 ms11.5 ms18,786 MB2,708 MB0main(79e8487)6.7 fps(148.5 ms)23.75 ms15.25 ms19,753 MB2,144 MB0drivertrim5)6.4 fps(155.7 ms)19.75 ms13.95 ms20,047 MB1,945 MB0Visual Verification (
--features diagnostics, 1440p 90s,diag-pr-drivertrim-1440p-90s)world_windows=21,max_draws=12548,crashes=0,used_max=6268 MB / budget_min=6696 MB,over=0 MB,final_waiting=2770,mapped_rate=2.52 ms/s)lit=20/24,luma=99.91,near_black=0.06%,edge_energy=7.82,magenta=0.0%(frame-2582.png,frame-2598.png,frame-2614.pnginspected visually — sharp water, foliage, structures, zero magenta/confetti artifacts).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-02T07:49:21Z.
Autonomous architectural audit PASSED on
5053127f(CI46834921431GREEN):VICTORY_DRIVER_TRIM=0safety kill-switch only), 64 MiB chunkedVirtualUnlockwith1 msyields and activePipelineActivityabort checks, event-driven empty-walk cooldown (30 s+>= 5 squiet floor), zeroK32QueryWorkingSetExoverhead in plain--releasebuilds, and safeRunningGuard/ spawn-failure cleanup.--releaseA/B (0crashes /0DRED):1440p90s):13.5 -> 14.7 fps(+1.2 fps/+8.9%), preparing29.1 -> 28.0 ms, copyback14.5 -> 11.7 ms, working set-2,388 MBavg /-1,803 MBmax, host free RAM+1,989 MBmed /+2,334 MBmin (435 -> 2,769 MB).1440p&4K90s): zero polling overhead,1440p14.9 -> 15.0 fps,4Kpreparing23.75 -> 19.75 msand copyback15.25 -> 13.95 ms.1440p90s): All 6 gates PASS (luma=99.91,near_black=0.06%,edge_energy=7.82,magenta=0.0%,final_waiting=2,770).Squash-merging into
main.