WIP: perf(vk): scan pending uniform updates in place #472
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
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/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!472
Loading…
Reference in a new issue
No description provided.
Delete branch "zeldaootr/Longshot:scan-uniform-updates"
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?
Why
Each uncached lookup for pending uniform-buffer writes copies two arrays of addresses and then walks them again. Both descriptor reads and uniform-buffer copies pay for this work.
What changed
Scan the existing deque over the requested iterator range. Stop on the first overlap and otherwise cache the same gap. The epoch check still guards publication of a cached answer. A background thread (
ub_limit == 0, an empty range) builds no iterator into the deque at all, as before: it must not read even its start while the replay thread pushes and prunes.Flags and settings
None.
Measurements
main@cf605c85and the scan @cc0e3ef1(the empty-range guard,80d41562, adds no work on the measured path). A differential benchmark compares answers and cache contents across 100,000 randomized spans and explicit boundaries. On the Deck OLED, in a mixed workload of 80 pending updates, the two-pass calculation took 424 ns per query and the direct-scan prototype took 110 ns (medians of five interleaved samples per arm). The benchmark inputs deliberately exercise the slow path. A separate interleaved game comparison uses one instrumented RC3 renderer (665aef4f4718) and a corrected accounting host. Each run settled at child Kokiri spawn, teleported to the Lost Woods bridge entrance, warmed for 20 s, then stood for 45 s. SteamOS 3.9.5, RADV VANGOGH, Mesa 26.2.0-devel, 1280×720 output, frame generation off, same copied warm caches. Stable-window counters show about 63 scans per present. Median FPS across runs was 20.19 with the original scan and 20.19 with direct scanning: no change in fps, as expected while the Deck is GPU-bound here (about 27 ms of GPU time a frame). The gain is CPU time on the replay thread, which the microbenchmark above measures.The GPU timing breakdown of this scene is in the Deck evidence PR (#470).
Testing
Tested: Focused gap, word-index, memo and threading checks pass;
test_ub_gap.pyalso checks the empty range with no deque behind it. Source-extracted original and candidate agree for overflow, empty queries, subranges, boundary equality and overlapping writes. Full suite on this branch: 472 passed, 5 failed, 82 skipped. Failures:test_bake_portability,test_lift_cache,test_menu_keys,test_module_ids,test_pad_layout. All of these also failed on unmodifiedmain(cf605c85) in this environment.Not tested: Windows and other GPUs.
Needs other testers: Windows, any GPU; request to open.
Screenshots
Nothing on screen changes.
Risk and rollback
A false gap would let a descriptor read stale data. The test exercises exact boundaries and restricted update ranges. Reverting the commit restores array materialization.
Reviewer notes
The game runs used an instrumented RC3 renderer (665aef4f4718) with
RX_VK_TEST_UNIFORM_GAPchoosing the scan; the switch is not in this PR. The Measured box stays unticked until a run on this commit againstmain.Issues
Found by profiling Hyrule Field on Steam Deck.
Checklist
For everyone
type(scope): description).main. One commit behind:maingaineddc390e59(crash records, unrelated); rebased before ready.python -I -B tests/run_all.pyrun and passing (any failure that also fails onmainis named above).third_party/untouched (a new folder with aPROVENANCE.mdinstead).If applicable
AI assistance recorded with
Assisted-by:/Co-Authored-By:trailers.A check under
tests/that reads changed source updated in this PR, not weakened.A file in
docs/tested/for each new measured run.ub_updateswhen their range is empty 80d415626cView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.