perf(vk): combine contiguous sparse buffer mappings #1624
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1624
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:perf/sparse-buffer-bind-ranges"
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 medium · Tested on Linux, RTX 3090 · Needs Windows and other sparse-capable drivers
TL;DR
When streaming into an area, the renderer can submit thousands of separate Vulkan memory mappings. Adjacent mappings that refer to consecutive bytes of the same allocation now use one range. A diagnostic Field crossing measured 10–15 ms waiting for unfinished sparse mappings, down from 230–240 ms. Complete crossing frames varied substantially over the repeats.
What changed
The renderer groups only adjacent records within one buffer, with equal flags, matching backing memory and contiguous memory offsets, or adjacent unbinds. The caller keeps ownership of the original per-block data used for rollback and future releases. The Vulkan queue submission and timeline signal are unchanged.
Measurements
All four runs used the same host binary and warmed cache seed on Ryzen 9 7900X, 32 GiB RAM, RTX 3090 with NVIDIA 620.70.06, CachyOS Linux. Each run followed the same Market and Field route at 2560×1440 with real-time simulation and frame generation off. The four runs below used the
430eef4frenderer baseline, physical device budget and the order shown. P99 and crossing times are milliseconds.The third run recorded two outside builds and a 1,045 ms crossing frame. All four completed the route. This series supports fewer submitted ranges and a promising Field throughput result. End-to-end stutter remains mixed.
In one separately instrumented crossing per renderer the longest wait saw 12,073 original records at baseline. The candidate combined 11,484 records into 464 while mapping 717.8 MiB. Its longest guest fence dropped from 390.65 to 154.81 ms. The complete worst frame went from 399.98 to 489.00 ms, with 315 ms of scheduled main-game-thread CPU after the fence on the candidate.
A second instrumented run with the candidate combined 12,165 entries into 480 and measured 3.32–10.29 ms waiting on incomplete sparse signals. Its worst complete crossing frame took 173.43 ms.
Testing
The game-free fixture compiles the production queue path and checks mapping boundaries, different allocations and flags, unbinds, rejection and retry. The two candidate runs above exercised the production fix on the physical GPU budget. The submission rebases the fix onto
ffec0cec. The bind function, its four updated call sites and the three affected test files match the measured implementation. The rebased head’s simulated 6 GiB smoke is pending. The full suite recorded 722 passes, 19 skips and 41 failures. Relative to its tested main baseline there were 0 additional failures.Risks and remaining coverage
Each submission can temporarily allocate a vector sized to the inputs needing inspection. Errors retain the original bookkeeping. Other drivers and physically low-memory GPUs still need testing. Keep WIP while the end-to-end crossing result is being repeated.
Tested in game: Ryzen 9 7900X, 32 GiB RAM, RTX 3090 with NVIDIA 620.70.06, CachyOS Linux. Ran the production range combining change twice on the 2560×1440 headless, real-time simulation, frame generation off, fixed-marker Market walk and turn, physical crossing and Field walk and turn with physical VRAM policy. The benchmark commit was e07e6a7b. The rebased PR has the same bind function and changed calls. Worst crossing frames with the change were 174.94 and 1045.24 ms, versus 346.71 and 352.55 ms on control. Two outside builds were detected in the second candidate run.
Possibly related, for context:
The full rebased suite finished. The new sparse-binding regression passed. The candidate recorded 722 passes, 19 skips and 41 failures. All 41 also failed on the matched main baseline.
WIP: perf(vk): combine contiguous sparse buffer mappingsto perf(vk): combine contiguous sparse buffer mappings