perf(vk): stream guest page-table ranges into bounded transfers #1594
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1594
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:perf/stream-guest-page-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: CachyOS Linux, Ryzen 9 7900X, 32 GiB, GeForce RTX 3090, NVIDIA 620.70.06
TL;DR
Stream guest page-table updates into the GPU command buffer. In a synthetic overlapping update, peak scratch allocation fell from 8 MiB to 64 KiB. The Market and Field runs did not establish an FPS gain.
Why and what changed
The former flush expanded each range into page/value pairs, stable-sorted the pairs, then discarded overwritten pages. The new flush streams ordered ranges directly. Overlaps and out-of-order writes use a sweep of range boundaries that preserves last-write-wins behavior and the Vulkan transfer size limit.
Measurements
Clang -O2, median of nine batches per case with identical output checksums. Four overlapping ranges covering 150,000 pages took 7.746 ms on main and 0.0346 ms here. For 256 unordered single-page updates the median increased from 3.23 to 3.57 µs. On the fixed headless route, Market FPS was 67.49 and 64.81 on stock, 64.95 and 68.45 with the rewrite. Field FPS was 80.42 and 79.98 on stock, 79.88 and 78.91 with the rewrite. Crossing maxima were 374.67 and 372.04 ms on stock, 343.24 and 389.94 ms here.
Testing
Randomized differential checks passed with GCC and Clang. The route teleported to the Market entrance, walked and turned, then crossed into Hyrule Field on foot. Both orders used the same host executable and warmed driver cache. The full game-free suite reported 721 passed, 41 failed and 19 skipped. The 41 failures also failed on the control.
Risks and remaining work
Small unordered batches can take slightly longer. A real Field crossing remains hundreds of milliseconds. Windows and other Vulkan drivers still need coverage.
Checklist
876dc360. Measurements were taken before the cold-install packaging change on that revision.Checks also failing on the control
tests/test_bug_report_defaults.py,tests/test_capture_readback_visibility.py,tests/test_cpu_report.py,tests/test_crt_options.py,tests/test_damage_debug_menu.py,tests/test_dev_packs.py,tests/test_display_startup_failure.py,tests/test_dlss_feature_size.py,tests/test_draw_stream_visibility.py,tests/test_failed_compile_keeps_objects.py,tests/test_fsr_image_retirement.py,tests/test_fsr_uniform_ownership.py,tests/test_guest_imported.py,tests/test_hud_layout_row.py,tests/test_invalidate_quick.py,tests/test_invalidate_vcore.py,tests/test_libc_hooks.py,tests/test_linux_preflight.py,tests/test_linux_pressure.py,tests/test_linux_update.py,tests/test_log_open_failure.py,tests/test_mirror_budget.py,tests/test_missing_nup.py,tests/test_mods_size_table.py,tests/test_nonuniform_image_arrays.py,tests/test_parallel_init_order.py,tests/test_pending_guest_import.py,tests/test_pipeline_play_cache.py,tests/test_present_source_crop.py,tests/test_present_thread.py,tests/test_profiling_mode.py,tests/test_psychov35_fsr3_fg.py,tests/test_readback_timeout_source.py,tests/test_replay_write_order.py,tests/test_run_all_changed.py,tests/test_slow_frames.py,tests/test_staging_burst.py,tests/test_switch_table.py,tests/test_upscaler_rows.py,tests/test_vk_occlusion_queries.py,tests/test_walk_key.pyTested in game: Linux, Ryzen 9 7900X, RTX 3090, NVIDIA 620.70.06. Completed two headless fixed-marker Market and Field runs per arm with the production Vulkan path. The synthetic bulk update improved while the large crossing hitch persisted.
5568b369a1dee7297bbcCorrected author and committer attribution to HumanBean. Verified identical file contents before and after the metadata change.
WIP: perf(vk): stream guest page-table ranges into bounded transfersto perf(vk): stream guest page-table ranges into bounded transfers