WIP: perf(vk): uniform updates found by the 1 KB of guest memory they touch, not by walking the in-flight list #796
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 @ 8015c9a
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!796
Loading…
Reference in a new issue
No description provided.
Delete branch "dyst/Longshot:perf/vk-ub-update-index"
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 (the game-free checks; the game A/B is next) · Needs: a game run on NVIDIA, AMD and Intel
Why
To bind a uniform buffer the replay checks whether the stream has updated any of it (
UpdateUniformBuffer), and it did that by walking every update still in flight, for every uniform buffer and handle word of every rebuilt draw; a cached gap went with every update. Found in an audit of the renderer's per-draw path; no issue on the tracker.What changed
The in-flight updates are indexed by the 1 KB of guest memory they touch, so a lookup reads only the buckets a range touches; each byte still gets the same last writer, and the parallel replay's per-segment limits are honoured by stream number. Updates' bytes live in 256 KB chunks instead of one heap vector each.
ub_buckets,ub_odd,ub_find,ub_overlaps,ub_apply,ub_push,ub_truncate,ub_storeand the callersub_try_gap,ub_overlay,ub_read,ub_prune,flush_ub_updates(gpu/vk/vk_replay.cpp)tests/test_ub_index.py(the real code against a walk over random pushes, prunes, limits and ranges, four threads on a frozen list);test_ub_gap,test_ub_memo,test_ub_word_indexfollow the new shapeMeasurements
Verdict: not measured yet: A/B runs in the game (this PR against main on one base, interleaved) are next and will replace this section.
Flags and settings
None.
Testing
Tested: Windows 11, llvm-mingw (the builder's v2.0.14 tools): the new and changed checks; every check that reads the
changed code;
-fsyntax-onlyof the changed renderer files with the build's flags and headers; python -I -B tests/run_all.py on this branch and on main @aa95d35f, same PC and environment: the same results apart from the newtest_ub_index; the failures main has here are named in the first comment.Not tested: the game yet. This PR is WIP until its A/B is in (next: this PR against main on one dev_packs base of
main @
aa95d35f, on an RTX 3080 with a Ryzen 9 3900X, Windows 11; AMD and Intel need other testers).Must be tested:
RX_VK_PARALLEL=4: Kokiri Forest and Castle Town a few minutes, expecting the same picture and a lower replay time (Test Farm: @Beanstalk any, those scenes, with and without RX_VK_PARALLEL=4)Risks
What could break: A uniform overlay with the wrong bytes: an object drawn with another frame's constants (wrong position, flicker). The new lookup is checked against the old walk over random streams.
Turning it off: revert the commit
Compatibility: Nothing changes: no caches, settings or vk ABI involved.
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.tests/that reads changed source updated in this PR, not weakened.mainand passing here.🤖 Generated with Claude Code
The checks on this PC (Windows 11, RTX 3080, Ryzen 9 3900X, llvm-mingw from the builder's v2.0.14 tools):
python -I -B tests/run_all.pyon main @aa95d35ffails these 19 here, and so does this branch:test_appimage_player_build.py,test_bake_portability.py,test_cpm_discovery.py,test_cpp_preflight.py,test_crash_dialog.py,test_env_on.py,test_fpx_sticky.py,test_lift_cleanup_error.py,test_linux_preflight.py,test_make_game_cache.py,test_make_game_prepare.py,test_missing_nup.py,test_oot_state_tap.py,test_options_budget_once.py,test_readback_late.py,test_spawn_emit.py,test_tested_configurations.py,test_vk_pgo.py,test_walk_key.py. Any other failure in a full run on this branch was rerun on its own and passed (the full runs shared the PC with dev_packs builds: timing checks).Next: an interleaved A/B in the game against main on one dev_packs base of
aa95d35f; the numbers will replace the Measurements section.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.