perf(vk): stream guest page-table ranges into bounded transfers #1594

Merged
HumanBean merged 1 commit from HumanBean/Longshot:perf/stream-guest-page-ranges into main 2026-11-18 16:48:59 +00:00
Owner

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

  • The changed path was exercised locally in the game.
  • The branch is based on main at 876dc360. Measurements were taken before the cold-install packaging change on that revision.
  • Project source, tests and measurement summaries only. Third-party sources are untouched.
  • Codex assistance recorded in the commit.
  • Broader hardware and repeat Field entry timing remain open.
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.py

**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 - [x] The changed path was exercised locally in the game. - [x] The branch is based on main at `876dc360`. Measurements were taken before the cold-install packaging change on that revision. - [x] Project source, tests and measurement summaries only. Third-party sources are untouched. - [x] Codex assistance recorded in the commit. - [ ] Broader hardware and repeat Field entry timing remain open. <details><summary>Checks also failing on the control</summary> `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.py` </details>
Author
Owner

Tested 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.

Tested 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.
HumanBean force-pushed perf/stream-guest-page-ranges from 5568b369a1
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 12s
PR description / Description follows the template (pull_request_target) Successful in 15s
CI / Workflow lint (actionlint) (pull_request) Successful in 18s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 15s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Third-party parts / As their notes say (pull_request) Successful in 25s
to dee7297bbc
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 22s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 22s
Third-party parts / As their notes say (pull_request) Successful in 28s
PR description / Description follows the template (pull_request_target) Failing after 5s
2026-11-18 15:14:20 +00:00
Compare
Author
Owner

Corrected author and committer attribution to HumanBean. Verified identical file contents before and after the metadata change.

Corrected author and committer attribution to HumanBean. Verified identical file contents before and after the metadata change.
HumanBean changed title from WIP: perf(vk): stream guest page-table ranges into bounded transfers to perf(vk): stream guest page-table ranges into bounded transfers 2026-11-18 16:48:52 +00:00
HumanBean deleted branch perf/stream-guest-page-ranges 2026-11-18 16:49:00 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!1594
No description provided.