perf(vk): integrated GPUs keep every large ASTC texture as BC3, whatever the driver allows them #775
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!775
Loading…
Reference in a new issue
No description provided.
Delete branch "Yeetbot90/Longshot:perf/igpu-astc-bc3"
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, RX 9070 XT (the same rule forced by its switch); game-free checks · Needs: Windows, an integrated GPU on a PC with 24 GB of RAM or more (AMD 680M/780M/880M/890M, Intel Arc graphics in Core Ultra), and a Steam Deck
Why
Integrated GPUs on PCs with plenty of RAM kept the finer ASTC textures (UI, characters) as RGBA8, four times the size of BC3, against a texture budget of 4 GB or less. Cards the driver allows under 8.5 GB keep every large decoded ASTC texture as BC3 (issue 519, then 8 GB cards); an integrated GPU was judged by the same allowance, though that is the system RAM the game and Windows use, and it reads its textures through the same memory as the CPU. On this PC (32 GB of RAM) the Ryzen 9 7900X's graphics are allowed 10,232 MB, so the rule never applied there; integrated GPUs on 16 GB PCs (Unity's UHD Graphics laptop: 7.2 GB allowed) already had every one as BC3. Memory filling up over play is the worklist's top row; see NotRexed/Hookshot#993.
What changed
Every integrated GPU keeps every large decoded ASTC texture as BC3, whatever the driver allows it; cards keep the rule they had.
all(allowed, integrated)ingpu/vk/astc_bc_policy.h(true for an integrated GPU, elseall_by_vram(allowed)as before), asked wherevk_texture.cppdecides which ASTC textures become BC3; the log line says when an integrated GPU is why.tests/test_astc_bc_policy.cpp(an integrated GPU allowed 10 GB, unknown, or under 8.5 GB; cards as before),tests/test_astc_bc_policy.py(the call and the device type it is given).Measurements
Verdict: in Kokiri Forest every large ASTC texture as BC3 holds about 930 MB less decoded ASTC (2,496-2,532 MB against 1,579-1,587 MB) and 390-640 MB less VRAM in use, at the same GPU time and frame rate, in every pair. Measured on a discrete card with the rule forced; on an integrated GPU itself it is untested.
Hardware: Windows 11 (26200), RX 9070 XT (AMD 26.10.1), Ryzen 9 7900X, 32 GB; headless (
HOS_HEADLESS=1)Build: the nightly-182-5274fb72 renderer (main before this PR),
RX_VK_ASTC_BC_ALL=1(the rule this PR gives integrated GPUs) againstRX_VK_ASTC_BC_ALL=0(what such a GPU does on main);RX_VK_FRAMEGEN=0,HOS_FPS_MAX=1000Baseline: main's renderer with
RX_VK_ASTC_BC_ALL=0against=1, not main against this PR: this PR changes the rule only on integrated GPUs, and this PC's integrated GPU loses the device when the GPU decodes Kokiri Forest's terrain (#489), so the rule this PR gives integrated GPUs was forced by its switch on the discrete card; the switch is the same code path the PR turns onScene: Kokiri Forest outside Link's house: the save loaded by scripted input, a 2.5 s walk, then the camera turning; the frame rate from the game's own
vi:lines over the window 62-92 s after the start, the memory from the lastvk: VRAM:andtextures:linesMethod: the arms alternated, seven runs of 96 s; one more BC3 run ran during a build on this PC and is left out; nothing else running in the others
How to reproduce: start the game twice with the same save and settings, once with
RX_VK_ASTC_BC_ALL=1and once with=0, and compare thetextures: decoded ASTClines after the area loads5274fb725274fb72tests/test_astc_bc_policy.py(this PR's version; After: this PR @129a7c07)The runs in order: off, on, off, off, on, on, off (the values above in that order within each arm). Game fps: the median of the game's own
vi:lines over the last 30 s (frame generation off). The scene is CPU-bound on this PC (about 6 cores busy), so the frame rate says nothing of what BC3 saves an integrated GPU in bandwidth.tests/run_all.py: 540 passed, 18 failed, 35 skipped on main @aa95d35fand on this PR @129a7c07: the same 18 (this worktree's setup: packaging, the builder's preflight, release; none reads the changed files).tests/test_astc_bc_policy.py(this PR's version) fails on main (vk_texture.cpp no longer has: astc_bc_policy::all(allowed, integrated)) and passes here.Flags and settings
No new switch.
RX_VK_ASTC_BC_ALL=1/0Testing
Tested: On this PC: the game in Kokiri Forest on the RX 9070 XT with the rule forced on and off (Measurements), the screenshots looked at for damage;
tests/test_astc_bc_policy.pyfails on main's source and passes here;tests/run_all.pyon main and on this PR. The renderer builds with llvm-mingw.Screenshots from the measured runs (1024 x 576 captures of the 2560 x 1440 output; the camera turns all the time, so they are not the same view): left, the finer ASTC textures as RGBA8 (run 1, main's rule on such a GPU); right, every large one as BC3 (run 2, this PR's rule). No damage in the UI, Link's clothes, the fairy or the minimap.
Not tested: The game on an integrated GPU allowed 8.5 GB or more with this PR: this PC's integrated GPU loses the device when the GPU decodes Kokiri Forest's terrain (that is #489, a separate fix). The cost of the extra BC3 encoding (one compute pass a texture at load) on an integrated GPU, and how the finer textures look as BC3 at 720p-1080p. Not built on Linux (one line of portable C++).
Must be tested:
all large ASTC textures kept as BC3withan integrated GPUinlongshot_log.txt, several hundred MB lessdecoded ASTCin itstextures:lines, and no damaged UI, faces or clothes on screen (test request T-YJLE)all large ASTC textures kept as BC3line on this PR (on main only if the Deck is allowed under 8.5 GB), lessdecoded ASTCwhere main lacked it, and no damaged UI, faces or clothes (test request T-U7L2)Risks
What could break: On integrated GPUs allowed 8.5 GB or more, the finer ASTC textures (UI, characters, faces) are BC3 now: 8 bits a texel against the ASTC's own 3.6-8, so gradients and edges can band or block a little, as they already do on 4-8 GB cards and on integrated GPUs with 16 GB of RAM. Each one takes a GPU encode at load, so a load on a weak integrated GPU can take a little longer.
Turning it off:
RX_VK_ASTC_BC_ALL=0, or revert the commit.Compatibility: Nothing changes: no save, options, cache or interface change. The Steam Deck counts as an integrated GPU.
Issues
See NotRexed/Hookshot#993 (memory filling up over play, the worklist's top row); issue 519 set the rule for small cards.
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.mainand passing here.tests/that reads changed source updated in this PR, not weakened.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.