WIP: perf(vk): retain and refill capture buffers by size class #1599

Draft
HumanBean wants to merge 1 commit from HumanBean/Longshot:perf/capture-buffer-class-refill into main
Owner

Type: perf · Risk: medium · Tested on: CachyOS Linux, Ryzen 9 7900X, 32 GiB, GeForce RTX 3090, NVIDIA 620.70.06

TL;DR

Reuse capture buffers by size class and refill large classes on a worker. In a simulated 6 GiB policy run, Market p99 improved from 83.50 to 70.39 ms against the retention-only renderer. Field FPS fell from 63.57 to 52.20 in the same pair.

Why and what changed

Prefer suitable retired buffers and account for in-flight worker reservations under the spare budget. A large class may be refilled after a hit or a successful foreground allocation. The normal renderer still controls safe retirement. The scarce-budget path can immediately take any suitable spare.

Measurements

On the normal budget, capture-only versus refill Market FPS was 64.16 versus 64.44 in the first profiled pair and 62.01 versus 60.09 in the reverse pair. Market p99 did not improve in either comparison. In the simulated 6 GiB comparison Market FPS increased from 45.43 to 47.28 while Field FPS fell. Real 6 GiB hardware has not been measured.

Testing

Ran the physical Market-to-Field crossing on Linux with warmed caches at normal and simulated 6 GiB budgets. The renderer reported a 32 MiB spare limit in the latter test. The synthetic fixture checks capture class reuse and refill behavior.

Risks and remaining work

Refill spends driver allocation time and may hold a spare class while another is needed. The second full-profile refill run still made two foreground 64 MiB allocations. An allocation trace using the simulated 6 GiB policy recorded 1,022 new buffers totaling 26.66 GiB allocated cumulatively during the Market circle. The stock replay matched allocation counts and bytes in every measured leg. A separate candidate with finer size classes reduced that modeled total to 13.45 GiB. That separate candidate has no in-game FPS result yet.

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.
  • Resolve the observed Field regression and confirm on an actual constrained card.
**Type:** perf · **Risk:** medium · **Tested on:** CachyOS Linux, Ryzen 9 7900X, 32 GiB, GeForce RTX 3090, NVIDIA 620.70.06 ## TL;DR Reuse capture buffers by size class and refill large classes on a worker. In a simulated 6 GiB policy run, Market p99 improved from 83.50 to 70.39 ms against the retention-only renderer. Field FPS fell from 63.57 to 52.20 in the same pair. ## Why and what changed Prefer suitable retired buffers and account for in-flight worker reservations under the spare budget. A large class may be refilled after a hit or a successful foreground allocation. The normal renderer still controls safe retirement. The scarce-budget path can immediately take any suitable spare. ## Measurements On the normal budget, capture-only versus refill Market FPS was 64.16 versus 64.44 in the first profiled pair and 62.01 versus 60.09 in the reverse pair. Market p99 did not improve in either comparison. In the simulated 6 GiB comparison Market FPS increased from 45.43 to 47.28 while Field FPS fell. Real 6 GiB hardware has not been measured. ## Testing Ran the physical Market-to-Field crossing on Linux with warmed caches at normal and simulated 6 GiB budgets. The renderer reported a 32 MiB spare limit in the latter test. The synthetic fixture checks capture class reuse and refill behavior. ## Risks and remaining work Refill spends driver allocation time and may hold a spare class while another is needed. The second full-profile refill run still made two foreground 64 MiB allocations. An allocation trace using the simulated 6 GiB policy recorded 1,022 new buffers totaling 26.66 GiB allocated cumulatively during the Market circle. The stock replay matched allocation counts and bytes in every measured leg. A separate candidate with finer size classes reduced that modeled total to 13.45 GiB. That separate candidate has no in-game FPS result yet. ## 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. - [ ] Resolve the observed Field regression and confirm on an actual constrained card.
perf(vk): retain and refill capture buffers by size class
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
CI / Conventional Commit title (pull_request) Successful in 13s
PR description / Description follows the template (pull_request_target) Successful in 15s
CI / Workflow lint (actionlint) (pull_request) Successful in 17s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 18s
Third-party parts / As their notes say (pull_request) Successful in 23s
Website / Website on Cloudflare (pull_request_target) Has been skipped
b5bd2e5cf2
Assisted-by: OpenAI Codex
Author
Owner

Tested in game: Linux, Ryzen 9 7900X, RTX 3090, NVIDIA 620.70.06. Exercised the capture refill in Market and Hyrule Field on the normal and simulated 6 GiB budgets. Field FPS worsened in the reduced-budget comparison.

Tested in game: Linux, Ryzen 9 7900X, RTX 3090, NVIDIA 620.70.06. Exercised the capture refill in Market and Hyrule Field on the normal and simulated 6 GiB budgets. Field FPS worsened in the reduced-budget comparison.
Collaborator

Possibly related, for context:

  • PR #1553 perf(runtime): reduce Market frame stalls and Vulkan capture overhead — Merged renderer work introduced capture-range reuse; this PR extends its spare-buffer strategy.
  • issue #395 Game: Crash in nvoglv64.dll after Vulkan 64 MB staging arena allocation failures during heavy texture uploads — Open NVIDIA Vulkan allocation-failure crash during heavy area-transition uploads; potentially relevant to allocation behavior.
Possibly related, for context: - PR #1553 perf(runtime): reduce Market frame stalls and Vulkan capture overhead — Merged renderer work introduced capture-range reuse; this PR extends its spare-buffer strategy. - issue #395 Game: Crash in nvoglv64.dll after Vulkan 64 MB staging arena allocation failures during heavy texture uploads — Open NVIDIA Vulkan allocation-failure crash during heavy area-transition uploads; potentially relevant to allocation behavior.
HumanBean force-pushed perf/capture-buffer-class-refill from b5bd2e5cf2
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
CI / Conventional Commit title (pull_request) Successful in 13s
PR description / Description follows the template (pull_request_target) Successful in 15s
CI / Workflow lint (actionlint) (pull_request) Successful in 17s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 18s
Third-party parts / As their notes say (pull_request) Successful in 23s
Website / Website on Cloudflare (pull_request_target) Has been skipped
to 3ea1a6c8e1
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
CI / Conventional Commit title (pull_request) Successful in 14s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 20s
CI / Workflow lint (actionlint) (pull_request) Successful in 21s
Third-party parts / As their notes say (pull_request) Successful in 23s
PR description / Description follows the template (pull_request_target) Successful in 9s
2026-11-18 15:14:18 +00:00
Compare
Author
Owner

Corrected author and committer attribution to HumanBean. Verified identical file contents before and after the metadata change. The new simulated 6 GiB capture identified 26.66 GiB of cumulative allocations in one Market turn. The updated description distinguishes observed results from the buffer sizing model.

Corrected author and committer attribution to HumanBean. Verified identical file contents before and after the metadata change. The new simulated 6 GiB capture identified 26.66 GiB of cumulative allocations in one Market turn. The updated description distinguishes observed results from the buffer sizing model.
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
CI / Conventional Commit title (pull_request) Successful in 14s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 20s
CI / Workflow lint (actionlint) (pull_request) Successful in 21s
Third-party parts / As their notes say (pull_request) Successful in 23s
PR description / Description follows the template (pull_request_target) Successful in 9s
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/capture-buffer-class-refill:HumanBean-perf/capture-buffer-class-refill'
git switch 'HumanBean-perf/capture-buffer-class-refill'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!1599
No description provided.