perf(vk): 6 GB cards mirror a quarter of the card (1536 MB), on Auto and on the Low preset #2834
Open
github-sync
wants to merge 3 commits from
github/pr/2834 into main
pull from: github/pr/2834
merge into: MagicBeanDev:main
MagicBeanDev:main
MagicBeanDev:github/pr/2893
MagicBeanDev:github/pr/2890
MagicBeanDev:github/pr/2887
MagicBeanDev:github/pr/2878
MagicBeanDev:github/pr/2875
MagicBeanDev:github/pr/2874
MagicBeanDev:github/pr/2873
MagicBeanDev:github/pr/2871
MagicBeanDev:github/pr/2756
MagicBeanDev:github/pr/2897
MagicBeanDev:github/pr/2896
MagicBeanDev:github/pr/2718
MagicBeanDev:github/pr/2842
MagicBeanDev:github/pr/2691
MagicBeanDev:github/pr/2895
MagicBeanDev:github/pr/2743
MagicBeanDev:github/pr/2765
MagicBeanDev:github/pr/2708
MagicBeanDev:github/pr/2732
MagicBeanDev:github/pr/2755
MagicBeanDev:github/pr/2817
MagicBeanDev:github/pr/2876
MagicBeanDev:release-please--branches--main
MagicBeanDev:release-please--branches--main--release-notes
MagicBeanDev:github/pr/2778
MagicBeanDev:github/pr/2888
MagicBeanDev:github/pr/2866
MagicBeanDev:github/pr/2877
MagicBeanDev:github/pr/2800
MagicBeanDev:github/pr/2829
MagicBeanDev:github/pr/2850
MagicBeanDev:github/pr/2889
MagicBeanDev:github/pr/2882
MagicBeanDev:github/pr/2860
MagicBeanDev:github/pr/2849
MagicBeanDev:github/pr/2886
MagicBeanDev:github/pr/2794
MagicBeanDev:github/pr/2840
MagicBeanDev:github/pr/2830
MagicBeanDev:github/pr/2719
MagicBeanDev:github/pr/2742
MagicBeanDev:github/pr/2741
MagicBeanDev:github/pr/2820
MagicBeanDev:github/pr/2771
MagicBeanDev:github/pr/2859
MagicBeanDev:github/pr/2858
MagicBeanDev:github/pr/2823
MagicBeanDev:github/pr/2757
MagicBeanDev:github/pr/2769
MagicBeanDev:github/pr/2844
MagicBeanDev:github/pr/2843
MagicBeanDev:github/pr/2673
MagicBeanDev:github/pr/2855
MagicBeanDev:github/pr/2739
MagicBeanDev:github/pr/2807
MagicBeanDev:github/pr/2851
MagicBeanDev:github/pr/2789
MagicBeanDev:github/pr/2814
MagicBeanDev:github/pr/2818
MagicBeanDev:github/pr/2774
MagicBeanDev:github/pr/2772
MagicBeanDev:github/pr/2750
MagicBeanDev:github/pr/2786
MagicBeanDev:github/pr/2785
MagicBeanDev:github/pr/2782
MagicBeanDev:github/pr/2779
MagicBeanDev:github/pr/2775
MagicBeanDev:github/pr/2706
MagicBeanDev:github/pr/2766
MagicBeanDev:github/pr/2747
MagicBeanDev:github/pr/2759
MagicBeanDev:github/pr/2745
MagicBeanDev:github/pr/2740
MagicBeanDev:github/pr/2733
MagicBeanDev:github/pr/2725
MagicBeanDev:github/pr/2727
MagicBeanDev:github/pr/2728
MagicBeanDev:github/pr/2729
MagicBeanDev:github/pr/2721
MagicBeanDev:github/pr/2722
MagicBeanDev:github/pr/2715
MagicBeanDev:github/pr/2714
MagicBeanDev:github/pr/2707
MagicBeanDev:github/pr/2703
MagicBeanDev:github/pr/2705
MagicBeanDev:github/pr/2697
MagicBeanDev:github/pr/2679
MagicBeanDev:github/pr/2676
MagicBeanDev:github/pr/2669
MagicBeanDev:docs/what-hookshot-connects-to
MagicBeanDev:fix/hdr-encode-test
MagicBeanDev:fix/main-tests
MagicBeanDev:fix/play-cache-files
MagicBeanDev:perf/game-barrier-order
MagicBeanDev:feat/heap-lazy
MagicBeanDev:feat/texture-detail
MagicBeanDev:perf/astc-opaque-bc1
MagicBeanDev:fix/fs-dir-lock
MagicBeanDev:fix/framegen-native-kept
MagicBeanDev:fix/update-no-downgrade
MagicBeanDev:port/k10-gcn-f16-mirrors
MagicBeanDev:fix/framegen-mult-cap
MagicBeanDev:chore/release-as-2.1.1
MagicBeanDev:perf/pcache-load-switch
MagicBeanDev:fix/prepare-progress-log
MagicBeanDev:fix/update-closes-stale-game
MagicBeanDev:fix/hdr-scaled-sampled
MagicBeanDev:perf/first-start-preset
MagicBeanDev:perf/zero-upload
MagicBeanDev:fix/vcore-escape-2s
MagicBeanDev:test/fake-gh-atomic
MagicBeanDev:perf/batch-idle-flush
MagicBeanDev:test/finish-stub-a
MagicBeanDev:chore/record-2.1.0
MagicBeanDev:fix/main-red-tests
MagicBeanDev:fix/test-display-startup-driver-cache
MagicBeanDev:feat/mesh-shader-mode
MagicBeanDev:fix/menu-probes-at-startup
MagicBeanDev:fix/fps-counter-classic
MagicBeanDev:fix/test-log-batch-flake
MagicBeanDev:fix/narrow-screen-hud
MagicBeanDev:ci/prereleases
MagicBeanDev:release/v2.0.15
MagicBeanDev:hotfix/v2.0.15
MagicBeanDev:fix/present-ahead-replay
MagicBeanDev:release/v2.0.13
MagicBeanDev:fix/bracket-paths-2013
MagicBeanDev:fix/hdr-overlays-2013
MagicBeanDev:fix/fps-counter-scale-2013
MagicBeanDev:fix/stick-seen-at-rest
MagicBeanDev:hotfix/menu-fits-screen
MagicBeanDev:fix/f1-always-opens-menu
MagicBeanDev:fix/ini-keep-lines
MagicBeanDev:claude/cranky-pike-7cf247
MagicBeanDev:perf/texture-answer-flat
MagicBeanDev:fix/stamp-test-modules
MagicBeanDev:fix/appimage-fonts
MagicBeanDev:fix/display-awake
MagicBeanDev:release/v2.0.12
MagicBeanDev:fix/discord-windows
MagicBeanDev:rc/v2.0.12-tests
MagicBeanDev:fix/dlss-keep-feature
MagicBeanDev:rc/v2.0.12
MagicBeanDev:button-icons
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
autorelease: pending
autorelease: tagged
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
github_actions
Pull requests that update GitHub Actions code
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
testing wanted
wontfix
This will not be worked on
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2834
Loading…
Reference in a new issue
No description provided.
Delete branch "github/pr/2834"
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?
6 GB cards (the RTX 3060 Laptop, 2060, 1660 and the like) start on the Low preset, whose 512 MB of mirrors leaves most of the game's memory pools out of VRAM: the GPU reads them over PCIe, 30-32 GB of bound ranges every 600 submits in Hyrule Field on an RTX 3060 Laptop. This gives those cards a quarter of the card, 1536 MB, on Low and on Auto alike: in Castle Town Market 20 → 22.4 fps, GPU 32 → 25 ms a frame, half the frames over 50 ms.
What changed
gpu/vk/vk_menu.cpp). It is the Low (6GB) preset's, whichmenu_first_start_for_gpugives every dedicated card of 4.5-6.5 GB.gpu/vk/mirror_budget.h,auto_bytes, used bymirror_budgetinvk_memory.cpp): cards over 4.5 GB and up to 6.5 GB get a quarter (1536 MB on 6 GB; it was an eighth, 768). Cards of 4.5 GB or less keep an eighth (512 MB on 4 GB), larger ones a quarter up to 3 GB as before. The eighth on 6 GB cards was there because the image blocks made at the start sat empty beside the mirrors; since #2711 they are made in the textures' pool.preset_bytes, when a Quality preset set the budgets): Low on a 4 GB card, whichpreset_caps_memorylets through, or Minimum with the row moved to 3.6 GB, stays at 512. A budget chosen on the VRAM budget row itself stays the player's on any card (#1859).tests/test_mirror_budget.pyruns the rules and checks thatmirror_budgetuses them;tests/test_vram_budget_row.pyhas Low's 1536.docs/development.mdsays whatRX_VK_MIRROR_MBdefaults to.Tested
Windows 11, RTX 3060 Laptop 6 GB (5.0-5.1 GB allowed), NVIDIA 621.14, Ryzen 7 6800HS, 16 GB. The first start's Low (6GB) budget, DLSS (1152x648 → 1536x864), Reflex on, Game speed Per frame (
HOS_REALTIME_STEP=0). No window (HOS_HEADLESS), input through the control bridge: the debug teleport, then standing with the camera turning for 60 s. A =51da0464+ #2711, B = that + this; both renderers built with llvm-mingw (RX_VK_ONLY,RX_RELEASE=1, NVIDIA DLSS). main's own renderer (API 20, a new translator stamp) does not run against this PC's game and program cache, so the base is the installed build's plus #2711. Two runs each, in turn:The cost is the textures' budget: about 1 GB in the market and under 0.9 GB in Hyrule Field, where twice as many textures were made again in 60 s (headless: not looked at on screen). Earlier, on a scripted walk (main before #2711, the preallocation off by switch): 1536 MB took ~0 GB over PCIe every 600 submits against 30-32 GB, GPU 27 → 19.5 ms; 1024 MB gave 26.5 and 31.3 fps with the budget full and which pools stayed out varying.
python -I -B tests/run_all.pyon Windows: 472 passed, 10 failed, 41 skipped. The same 10 fail on main on this PC (symlink privilege,dotnet restore, nogcc, andtest_readme_menu_rows: the Skip opening row has no README line).docs/tested-configurations.md.Not tested: another 6 GB card (a desktop one with a display attached has less allowed), AMD (GCN keeps its mirrors off) and Intel, Linux, 4 GB cards (the cap keeps them at 512).
Overlap
tests/test_vram_budget_row.py's preset table and thekVramMirrorMbline: whichever lands second updates them. With both, Balanced on an 8 GB card mirrors 1536 MB (Auto gives it 2048).🤖 Generated with Claude Code
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
The table no longer rises with the step: 3.6 GB mirrors 1536, 4.8 GB 1024. That's fine for the row's own steps, but
preset_caps_memorylets Low's budgets through on any card up to 6.75 GB. So a 4 GB card on Low, or on Minimum with the row moved to 3.6 GB (that keepsopts.budgetat 1, so the cap passes), now asks for 1.5 GB of mirrors on top of a 3.6 GB texture budget, where it was 512. Those players have already gone past the row's hint, so it's an edge case. Still, a cap on the mirrors by the card's size (for example, no more thanvram/4when a preset sets them) would keep a 4 GB card where it was.This hunk and
image_prealloc_blocksare what #2711 changes (it gives the images' pool 0 when compacted too, and makes the blocks in the textures' pool instead). Please drop it here and rebase (2) on #2711, see the review body.Thanks, this is a careful write-up: one named card, alternated pairs, the PCIe traffic counted, and the 1024 MB arm too. The finding that the images' pool holds 896 MB empty on a 6 GB card matches what #2711 and #2759 found on 8 GB and larger cards. The two parts need different handling, so I'll take them separately.
(1) The preallocation. On #2759 I set where this lands: #2711 moves the blocks made at the start into the textures' pool instead of dropping them. That keeps what #2438 made them for, the ~170 ms block allocations on AMD's Windows driver, which nobody has measured since.
image_prealloc_blockshere gives the images' pool the same count as #2711 does (0 when compacted, 15% withRX_VK_COMPACT=0). The difference is that #2711 puts those blocks where the textures land. So please drop part (1) and build (2) on #2711. With #2711 the 7 blocks hold Hyrule Field's textures (your (1)-alone arm shows a 1.8-1.9 GB texture budget, well past 896 MB), so the room (2) needs should still be there. That's the run I'd like to see: #2711 + (2) against #2711 alone on the 3060 Laptop, same walk.(2) Low's mirrors, 512 → 1536. The numbers on your laptop are convincing (GPU 27 → 19 ms, the PCIe reads gone). But this is a default for every card that starts on Low:
menu_first_start_for_gpuputs any dedicated card of 4.5-6.5 GB there (GTX 1060 6 GB, the 1660s, 2060, 3050 6 GB, 3060/4050 laptops, RX 5600 XT, Arc A380), plus everyone who saved Low already. GCN keeps the mirrors off (mirror_on), so it doesn't touch those. A few things before I'd take it:RX_VK_MIRROR_TIGHTis opt-in). So the textures' budget is what gives. Hyrule Field for 75 s may not get there. Could you add one run in a heavier spot (Castle Town Market or Kakariko), and give the textures' budget and the driver's count from the log for both arms, the 1536 one included? The table has the budget for (1) alone but not for (1)+(2).mirror_budgetgives cards of 6.5 GB or lessvram/8(768 MB) on purpose: its comment says a 6 GB laptop went past what the card has with a quarter. So the new comment's "a quarter of the card as on larger ones" doesn't match: a 6 GB player on Auto gets 768, on Low 1536. Either Low is right and Auto should follow (with the same data), or the comment should say why the two differ.Smaller points are inline. Overlaps: this conflicts with #2711 and #2759 in
images_pool(), with #2676 on thekVramMirrorMbline and the preset table intest_vram_budget_row.py, and with #2826 invram_compact.handtest_vram_compact.*. I'd land #2711 first, then this as (2) only. #2676 maps Balanced to the 3.6 GB step, so with both, 8 GB cards on Balanced mirror 1536 (Auto gives them 2048); that's fine with me.CI: only the title check has run; the other workflows are waiting for approval to run on this PR. Your local
run_allresults are noted. It merges cleanly with main for now.f0a61fd101to14b92e2ba0perf(vk): 6 GB cards mirror the game's memory in the VRAM the images' pool held emptyto perf(vk): 6 GB cards mirror a quarter of the card (1536 MB), on Auto and on the Low presetThanks for the review. Updated:
4cf785a0) with #2711 in. The PR is the mirrors alone now.gpu/vk/mirror_budget.h,auto_bytes): cards over 4.5 GB and up to 6.5 GB get a quarter (1536 MB on 6 GB; it was an eighth, 768). 4.5 GB or less keep an eighth (512 on 4 GB), larger cards as before. The eighth on 6 GB cards was for the image blocks made at the start, which #2711 now makes in the textures' pool; the comment says so.preset_bytes, whenopts.budget > 0): Low on a 4 GB card, or Minimum with the row moved to 3.6 GB, stays at 512. A budget chosen on the row itself stays the player's, as #1859 has it.tests/test_mirror_budget.pyruns the rules and checks thatmirror_budgetuses them.run_allon Windows (on3723fd0b, the VRAM checks again on4cf785a0): 472 passed, 10 failed, 41 skipped; the same 10 fail on main on this PC (test_readme_menu_rowsthere too: the Skip opening row has no README line).#2711 alone (A) against #2711 + this (B), RTX 3060 Laptop, Low, DLSS, standing with the camera turning for 60 s, two runs each in turn. Built on
51da0464+ #2711: main's renderer is API 20 with a new translator stamp, which this PC's game and program cache don't take.You were right that the textures' budget is what gives: about 1 GB in the market and under 0.9 GB in Hyrule Field, where twice as many textures were made again (11 against 4-6 in 60 s; headless, so I haven't looked at them on screen). The market, the heavier spot, is the clearer win: +11% fps, GPU -24%, half the long frames, no more textures made again. With #2711 alone the driver's count went past the allowance in Hyrule Field (5.36-5.47 of 5.04 GB); with this it stayed under there and reached it in the market.
Not done: another 6 GB card, or AMD. I can't run those here; a tester with a 2060, a 1660 or an RX 5600 XT on the same two spots would settle it. If the texture side needs holding back, the two things I'd measure next are
RX_VK_MIRROR_TIGHTon for these cards, or 1024 MB (26.5 and 31.3 fps on my first walk, with the budget full and which pools stayed out varying).