WIP: fix(vk): cut a texture cache far over the VRAM rules to 7/8 of their budget #519
No reviewers
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!519
Loading…
Reference in a new issue
No description provided.
Delete branch "Amateurwizrd/Longshot:fix/vram-excess-cut"
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: fix · Risk: low · Tested on: Windows 11, RTX 5070 Ti 16 GB (game-free) · Needs: a 10 GB card, Linux
Why
When an area keeps the texture cache far over the 90% rule's or the driver's limit, the rules let go of only the excess
and 64 MB more, so the cache sits at the line and every pass is another eviction, with what went uploaded again: a
stutter that does not stop while the player stays there. Searched the tracker: no issue covers it.
How to reproduce
Seen on: the game-free check below, Windows 11, RTX 5070 Ti, driver 621.01; in the game it was reported in Hookshot-old (030b4e9a) for Lake Hylia on a 10 GB card, 383 MB over at each pass, and not reproduced here (a 16 GB card never got that far over the line)
Settings and switches: defaults
Steps: run
tests/test_vram_compact.py(this PR's cases) against main'sgpu/vk/vram_compact.h; in the game, a 10 GB card at Lake Hylia for a few minutesExpected: a 383 MB excess over a 3639 MB rule budget cuts the cache to 7/8 of that budget, and the eviction lines stop repeating
Actual: the excess and 64 MB more go, the cache stays at the line, and each pass evicts again
What changed
A cache only a little over the line is still trimmed by the excess, as now; one far over it (more than a sixteenth of
the rule's budget) is cut to 7/8 of that budget at once, so the passes stop evicting again and again.
vram_compact::rule_targetingpu/vk/vram_compact.hkeeps the trim for an excess of up to a sixteenth of therule's budget (
kExcessSmall), so a cache a few MB over the line still does not lose an eighth of its textures; alarger excess is cut to 7/8 of that budget, as before the trim. The budget's own size still asks for its 7/8, and
RX_VK_EVICT_EXCESS=0(the cut on any excess) is unchanged.tests/test_vram_compact.cppchecks the large excess, a grid of budgets and excesses around the edge, and azero budget.
docs/development.md'sRX_VK_EVICT_EXCESSrow says what the default does now.The rule was first seen in Hookshot-old's 030b4e9a; the code and the edge cases are written for Longshot.
Measurements
Verdict: it passes: the new check fails on main @
13e8b6dain both runs and passes on this PR @ cc6a0eaf in both.Hardware: Windows 11 Pro 26200, RTX 5070 Ti 16 GB, driver 621.01, Ryzen 7 7800X3D, 32 GB
Scene: none (game-free check)
Method: the new test cases, run 2 times on each side, interleaved (main, this PR, main, this PR); main gets this PR's
tests/test_vram_compact.cppwithkExcessSmallwritten as its value, 16, since main has no such constantHow to reproduce:
python -I -B tests/run_all.py vram_compacton this branch, and on main with the test file copied in andb / kExcessSmallreplaced byb / 1613e8b6datests/test_vram_compact.py(run 1 / run 2)Flags and settings
No new switch; the documented default of the existing
RX_VK_EVICT_EXCESSchanges.RX_VK_EVICT_EXCESS=0Testing
Tested: on Windows 11 with the pinned llvm-mingw, the 3 checks that read this diff, one at a time, on this PR @ cc6a0eaf (main @
13e8b6da): 3 pass; none fails here that passes on main. The renderer was not built at this head.Not tested: the game on a card whose cache goes far over the line (a 16 GB card never got there in the scenes
tried).
Must be tested:
longshot_log.txtto stop repeating each pass once the cache is cut on this PR, where main evicts again each pass (Test Farm: @Beanstalk windows, a 10 GB card)gpu/vk/vram_compact.hRisks
What could break: a cache far over the line loses an eighth of its textures at once again, as before the trim:
one larger burst of uploads instead of an eviction every pass.
Turning it off:
RX_VK_EVICT_EXCESS=0cuts on any excess; reverting the commit restores the trim for every excess.Compatibility: Nothing changes.
Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why. Not ticked yet: Testing says game-free checks only, and the game was not run on a card whose cache goes far over the line.
in Risks. Not ticked yet: Risks names a larger one-time burst of uploads, and the 8 and 10 GB cards are not measured in the game.
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.mainand passing here.bf3637f22e4a39da2cdeRebased onto
main@bbe6fdf2. No tests were run here; the test boxes stay yours. One conflict in docs/development.md: main rewrote the commit-reserve rows next to theRX_VK_EVICT_EXCESSrow, so main's rows are kept and only theRX_VK_EVICT_EXCESStext is this PR's.4a39da2cdecc6a0eafe4Rebased onto main @
13e8b6da(cc6a0eaf); one conflict indocs/development.md, where main had reverted theRX_VK_EVICT_BY_PRESENTSrow: only this PR'sRX_VK_EVICT_EXCESSrow is kept. Re-measured on this main and the description moved to the current template: the new cases fail on main twice and pass here twice; the 3 checks that read this diff pass.@Beanstalk linux, build the renderer at this head: it should build with no error in the files this PR changes; no change in play expected from the build alone.
@Amateurwizrd only members of
BigBeanscan start the farm.One of them can approve this request by reacting 👍 to it or to this comment.This request was forcc6a0ea, and the PR has changed since (8f94099), so a 👍 no longer approves it. Comment@Beanstalkagain to ask for the new commit.@Beanstalk windows, a 10 GB card: Lake Hylia for a few minutes on main and on this PR, expecting the eviction lines in longshot_log.txt to stop repeating each pass on this PR where main evicts again each pass.
@Amateurwizrd only members of
BigBeanscan start the farm.One of them can approve this request by reacting 👍 to it or to this comment.This request was forcc6a0ea, and the PR has changed since (8f94099), so a 👍 no longer approves it. Comment@Beanstalkagain to ask for the new commit.Merged main @
f88e6e3a(8f94099d): it no longer merged clean. One conflict, in docs/development.md: main's new target pool row (RX_VK_TARGET_POOL_MB, RX_VK_DEAD_EVERY, ...) kept, and this PR's RX_VK_EVICT_EXCESS row in place of main's. #637's VRAM changes (dynamic floor, three-step target pool) do not touchvram_compact::rule_targetor its callers, so the cut works as described. Game-free checks for the changed files: no failure that main does not also have on this PC.Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).
**Not testable by hand:**line saying why and what stands in for it. Then tick it.8f94099de2d301477f89View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.