WIP: perf(vk): the 8 GB cards' VRAM budget step mirrors 2 GB of the game's pools, not 1 #724
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
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
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!724
Loading…
Reference in a new issue
No description provided.
Delete branch "Zapiltar/Longshot:perf/mirror-8gb"
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?
Type: perf · Risk: low · Tested on: Windows 11, RTX 3060 Ti 8 GB · Needs: another 8 GB card (AMD or NVIDIA), Linux
Why
On 8 GB cards the game's memory pools run out of room in VRAM a few minutes into play, and the GPU then reads the new ones over
PCIe every frame: the frame rate drops and swings from one visit of an area to the next (Kokiri Forest 36 or 59 fps with the
same build). The Balanced (8GB) preset, which every 8 GB card gets, gives the mirrors 1024 MB: less than the 6 GB step's 1536
and half of what Auto gives an 8 GB card. The 6 GB step was raised for the same reason (perf/low-vram-mirror-budget, the RTX
3060 Laptop rows of docs/tested-configurations.md); the 8 GB step was left at 1024. See #130, #668.
What changed
The 8 GB step of the VRAM budget row (4.8 GB, the Balanced (8GB) preset's) gives the mirrors 2048 MB, what Auto gives an 8 GB card
(a quarter,
mirror_budget.hauto_bytes), in line with the 6 GB step's 1536.kVramMirrorMb[3]ingpu/vk/vk_menu.cpp, 1024 -> 2048, with the measurement beside it.tests/test_vram_budget_row.py's expected mirrors for Balanced and for the row's 4.8 GB step.Measurements
Verdict: +22% average fps (median of runs 38.5 -> 45.7), 1% lows +26%, no pool read over PCIe, VRAM under what the driver
allows (it went over it at 1024).
Hardware: Windows 11 Home 10.0.26300, RTX 3060 Ti 8 GB (driver 32.0.16.2114), i7-12700F, 64 GB
Scene: Kokiri Forest, Hyrule Field, Castle Town Market (child), teleported in turn; 1920x1080 output and render (Upscaler
"Game's own", 100%), frame generation off, Quality preset Auto (this PC) = Balanced (8GB), VRAM budget 4.8 GB
Method: scripted through the control bridge: per area 10 s settle, 30 s standing, 30 s turning the camera; a warm-up pass, then a
recorded pass;
RX_VK_FRAME_LOGframe times; 3 interleaved runs per side (1024, 1536, 2048 in turn); the average of the sixsegments per run, and the median of the runs
How to reproduce: any save; the bench script drives
scripts/longshot_ctl.py(teleport 0/1/3,stick R 1 0)Baseline: main @
1be60eaebuilt on this PC with its own hot list (work/hot_funcs.txt, both columns alike); the After column isthe same build with
RX_VK_MIRROR_MB=2048, which is what this PR's table value gives. Confirmed with this PR's renderer @53a00824in a v3.0.0-rc.4 game folder and no mirror switch (
RX_VK_WB_MAX_KB=1024on, as in that folder): 41.7 and 48.3 fps, 1% lows 20.5and 26.5, 0
bound in guest memorylines, the mirrors past 1024 MB (1218 MB in the Market)1be60eae1be60eae1536 MB gave the same (45.7 fps mean, 0 PCIe lines): 2048 is chosen as Auto's quarter, the rule the 6 GB step follows.
Across ~180 area visits of the day's runs at 1024: visits where every pool had its mirror ran Kokiri 58.6 fps (9 visits) and
Hyrule Field 58.5 (4); visits with a pool over PCIe 44.7 (51) and 41.8 (56); the host waited 3-5 ms a frame on the GPU's
timelines in those against under 1 ms.
Flags and settings
No switch added; one menu row's value changes: the VRAM budget row's 4.8 GB step (and so the Balanced (8GB) preset) mirrors 1024 -> 2048 MB.
Testing
Tested:
python -I -B tests/run_all.pyon Windows: 502 passed, 17 failed, 74 skipped; the same 17 fail on main @e090cc48(test_appimage_player_build, test_cpm_discovery, test_cpp_preflight, test_crash_dialog, test_env_on, test_gpu_hang_watch,
test_lift_cleanup_error, test_linux_preflight, test_make_game_cache, test_make_game_prepare, test_missing_nup, test_oot_state_tap,
test_readback_late, test_tested_configurations (a Windows line-ending sub-test), test_vk_pgo, test_vram_budget_row, test_walk_key).
tests/test_vram_budget_row.pyfails on main already (its fixture: open PR #622); with #622's fix and this PR itpasses. In game: the runs above, on Windows 11, RTX 3060 Ti.
Not tested: other 8 GB cards (RTX 3070, 4060, RX 6600/7600), Linux, a 6 GB card that picks the 4.8 GB step on the row itself.
Must be tested:
no
bound in guest memorylines andVRAM:used under allowed (by hand, or Test Farm: @Beanstalk an 8 GB AMD card, thelog's mirrors and VRAM lines in Hyrule Field)
Risks
What could break: one
VRAM:line of each confirmation run (of 36 and 41) was over what the driver allows (7311 of 6571 MB,6856 of 6560), at an area change, as one line of an rc.4 run at 2048 by the switch was and as the 1024 runs were more often
(6929/6744, 7249/6747). VRAM over what the driver allows on an 8 GB card with more in VRAM than here (a second monitor at 4K, DLSS
or frame generation on), which would page textures over PCIe instead; the texture cache shrinks first, so it should not.
Turning it off:
RX_VK_MIRROR_MB=1024, or the VRAM budget row's 3.6 GB step; reverting the commit.Compatibility: Nothing changes in saves or caches; a player on Balanced gets the larger budget at the next start.
Issues
See #130 and #668: 8 GB cards (RX 6600, RTX 5050) lost the device or hung at the driver's VRAM limit. Here VRAM went down with
2048 (no longer over what the driver allows), but this has to be checked on an 8 GB AMD card before merge (Must be tested).
See #585: the sparse mirrors' cost on a 6 GB AMD card, the same budget from the other side.
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md).tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
Description: Measurements columns name their commits; the menu row listed under Flags; the docs and build boxes added (Linux not built here).
Description: the Docs box in the template's own words.
Closing: #735 (merged in
511e9b03) gives 8 GB cards the same 2 GB of mirrors this PR asked for, and removes the VRAM budget row whose table this PR changed, so there is nothing left to merge here. This PR's measurements are kept in it and cited by #735.Pull request closed