fix(vk): 256 MB of pool mirrors, none past 90% VRAM, on AMD's Windows driver on GCN; sparse_keep's Auto off #3331
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3331
Loading…
Reference in a new issue
No description provided.
Delete branch "tobim6/Longshot:mirror-small"
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?
Summary
Follow-up to #3256, which did not fix what it was for. AMD's Windows driver on GCN 1-4 (RX 400/500) stops the whole PC
with a bugcheck in
amdkmdag.sys(0x50PAGE_FAULT_IN_NONPAGED_AREA, or 0x7E withC0000005). Every kernel dump hasthe same stack, symbolized against Microsoft's
dxgmms2.syssymbols:Windows pages an allocation in, has to demote a page table from 64 KB to 4 KB entries, and AMD's driver faults building
that update. Anything that makes Windows page in or remap is a chance at it: mirrors made and freed, sparse blocks bound
and unbound, and evictions when the process is past what the driver allows.
#3256 removed one of those (sparse block give-backs). With it, the same RX 580 bugchecked twice more with the same stack,
and an RX 580 2048SP on AMD's current driver lost frames to it. What kept both cards up:
RX_VK_MIRROR_TIGHT=1withRX_VK_MIRROR_MB=256, which on the 2048SP cost no frame rate. Few mirrors are few made, freed, bound and evicted.This makes those two the default there:
device_policy.hmirror_small(f.amd_win() && f.arch() == GpuArch::AmdGcn, the devices #3256 used) makesmirror_budget()'s Auto 256 MB and turns onRX_VK_MIRROR_TIGHT's rule(no mirror, and no trim's parts, while VRAM is over 90% of the allowance).
sparse_keep's Auto goes back to offeverywhere; its setting still turns it on. A hidden setting,
system/memory-settings:mirror_small(RX_VK_MIRROR_SMALL,Auto/Off/On), overrides the new rule;
mirror_budget_mbstill sets the budget outright.Read first:
gpu/vk/device_policy.h(mirror_small, the rule line,sparse_keep's note),gpu/vk/vk_memory.cpp(
mirror_budget(), the twotight_rulelines).Testing
Tested: Windows 11 (build 26200), RX 580 8 GB, Adrenalin 23.10.01.14 (driver 0x800106): RX_VK_MIRROR_TIGHT=1 with RX_VK_MIRROR_MB=256 (what this makes the default there), on a build with #3256: no bugcheck in a session like the ones that bugchecked; with #3256 alone, two more bugchecks with the stack above. An RX 580 2048SP 8 GB on AMD's current driver (Discord): the same two switches without #3256, no bugcheck and no frame-rate loss; #3256 cost it frames.
Kernel dumps: three with the stack above on the RX 580 (0x800106), one of them with #3256's
sparse_keepon and thesession's log showing
given back 0. Game-free checks:schema-gen --check;tests/test_device_policy.py(the new fieldon all 26 PCs, its switch cases, rule edges: on for GCN 0x67DF/0x6FDF on AMD's Windows driver, off for Vega 0x687F, RDNA,
Linux and RADV;
sparse_keepoff by its rule),test_mirror_budget.py(256 MB undermirror_small, after the setting; thetight rule at both sites),
test_switch_table.py,test_menu_ini_keys.py,test_i18n_complete.py,test_sparse_mirror.py,test_mirror_trim.py,test_mirror_gpu_only.pypass. The full suite: CI'stestsjob on this PR.Still to test:
mirror_smalloff in the log (@Beanstalk)Measurements
Frame rate on an RX 580 2048SP (AMD's current driver), from the Discord report: the two switches cost nothing measurable, and #3256 cost frames; no capture of my own.
Risks
mirror_smallis off and mirrors are as onmain.loss;
mirror_budget_mbormirror_smallOff restoresmain's budget.sparse_keepoff everywhere ismainbefore #3256.mirror_small, insettings.toml's options;LS_SETTINGS_LAYOUTchanges (schema-gen).Revert is enough to undo.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (CI'stestsjob: ticked once it passes)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. (test_device_policy.py'smirror_smallrule edges,test_mirror_budget.py)gpu/vk/switches.def. (aSETTINGrow; Auto)tests/that reads changed source is updated, not weakened. (test_device_policy.py,test_menu_ini_keys.py,test_mirror_budget.py)Assisted-by:/Co-Authored-By:trailers.🤖 Generated with Claude Code
Tested in game: Windows 11 (build 26200), RX 580 8 GB, Adrenalin 23.10.01.14 (driver 0x800106): RX_VK_MIRROR_TIGHT=1 with RX_VK_MIRROR_MB=256 (what this makes the default there), on a build with #3256: no bugcheck in a session like the ones that bugchecked; with #3256 alone, two more bugchecks with the stack above. An RX 580 2048SP 8 GB on AMD's current driver (Discord): the same two switches without #3256, no bugcheck and no frame-rate loss; #3256 cost it frames.
Possibly related, for context:
WIP: fix(vk): 256 MB of pool mirrors, none past 90% VRAM, on AMD's Windows driver on GCN; sparse_keep's Auto offto fix(vk): 256 MB of pool mirrors, none past 90% VRAM, on AMD's Windows driver on GCN; sparse_keep's Auto offView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.