perf(vk): fit mid-size captures to tight spare budgets #1605

Merged
HumanBean merged 3 commits from HumanBean/Longshot:perf/tight-budget-capture-sizes into main 2026-11-18 16:48:12 +00:00
Owner

Type perf · Risk medium

Change

Under a spare-buffer budget of 32 MiB or less, the capture allocator rounds requests between 16 and 32 MiB up to the next 4 MiB. With the stock policy, a 17 MiB request can consume the whole spare budget. The existing minimum-size override, ownership and retirement logic still apply.

Measurements

A headless trace under a simulated 6 GiB policy recorded 1,022 fresh capture buffers totaling 26.66 GiB of cumulative allocations over the 15-second Market turn. A replay of the stock policy reproduced the observed allocation counts and bytes in each measured leg. For the same request and retirement sequence, the new classes yielded 911 allocations totaling 13.45 GiB. This models cumulative traffic and keeps the recorded order fixed.

The first lightly instrumented pair used private copies of the same warmed caches, the stock host, identical route markers and the local exclusive timing queue. Each run reported zero outside builds.

Metric Stock 4 MiB classes
Market FPS 53.57 60.46
Market p99 / worst frame, ms 60.93 / 109.08 53.55 / 129.62
Market turn FPS 44.20 54.60
Field FPS 66.20 72.22
Field p99 / worst frame, ms 22.93 / 31.82 19.80 / 31.07
Worst complete Field crossing frame, ms 658.65 406.53

The route ran on an RTX 3090 with 24 GiB physical VRAM, CachyOS Linux and NVIDIA 620.70.06. The renderer allowance was 5,233 MiB. Market had four frames above 100 ms in each run. The reverse pair ran the candidate first. Both runs again reported zero outside builds.

Repeat metric Stock 4 MiB classes
Market FPS 46.45 56.44
Market p99 / worst frame, ms 82.06 / 267.75 63.60 / 677.04
Market turn FPS 42.27 51.93
Market frames over 100 ms 5 6
Field FPS 73.58 78.93
Field p99 / worst frame, ms 22.14 / 32.68 19.00 / 66.02
Worst complete Field crossing frame, ms 390.16 323.14

Average FPS and p99 improved in both orders. The worst Market frame regressed in both pairs. The 677 ms interval occurred during the Market turn. These simulated-budget measurements on one driver leave the cause of that hitch and physical low-VRAM behavior open.

Testing and risks

The game-free fixture failed the size assertion on stock and passed under GCC and Clang with the change. Renderer build and headless route passed. A retained smaller spare may serve fewer subsequent larger requests on another workload or driver. The review identified this case. The full Linux suite returned 720 passed, 41 failed and 19 skipped. All 41 failures reproduced on the source-matched control.

  • Recorded the measured runs in docs/tested.
  • Ran the changed production path in game.
  • Recorded Codex assistance and committed as HumanBean.
  • Completed reverse-order timing and compared full-suite failures with the control.
  • Physical low-VRAM hardware coverage is pending.
**Type** perf · **Risk** medium ## Change Under a spare-buffer budget of 32 MiB or less, the capture allocator rounds requests between 16 and 32 MiB up to the next 4 MiB. With the stock policy, a 17 MiB request can consume the whole spare budget. The existing minimum-size override, ownership and retirement logic still apply. ## Measurements A headless trace under a simulated 6 GiB policy recorded 1,022 fresh capture buffers totaling 26.66 GiB of cumulative allocations over the 15-second Market turn. A replay of the stock policy reproduced the observed allocation counts and bytes in each measured leg. For the same request and retirement sequence, the new classes yielded 911 allocations totaling 13.45 GiB. This models cumulative traffic and keeps the recorded order fixed. The first lightly instrumented pair used private copies of the same warmed caches, the stock host, identical route markers and the local exclusive timing queue. Each run reported zero outside builds. | Metric | Stock | 4 MiB classes | |---|---:|---:| | Market FPS | 53.57 | 60.46 | | Market p99 / worst frame, ms | 60.93 / 109.08 | 53.55 / 129.62 | | Market turn FPS | 44.20 | 54.60 | | Field FPS | 66.20 | 72.22 | | Field p99 / worst frame, ms | 22.93 / 31.82 | 19.80 / 31.07 | | Worst complete Field crossing frame, ms | 658.65 | 406.53 | The route ran on an RTX 3090 with 24 GiB physical VRAM, CachyOS Linux and NVIDIA 620.70.06. The renderer allowance was 5,233 MiB. Market had four frames above 100 ms in each run. The reverse pair ran the candidate first. Both runs again reported zero outside builds. | Repeat metric | Stock | 4 MiB classes | |---|---:|---:| | Market FPS | 46.45 | 56.44 | | Market p99 / worst frame, ms | 82.06 / 267.75 | 63.60 / 677.04 | | Market turn FPS | 42.27 | 51.93 | | Market frames over 100 ms | 5 | 6 | | Field FPS | 73.58 | 78.93 | | Field p99 / worst frame, ms | 22.14 / 32.68 | 19.00 / 66.02 | | Worst complete Field crossing frame, ms | 390.16 | 323.14 | Average FPS and p99 improved in both orders. The worst Market frame regressed in both pairs. The 677 ms interval occurred during the Market turn. These simulated-budget measurements on one driver leave the cause of that hitch and physical low-VRAM behavior open. ## Testing and risks The game-free fixture failed the size assertion on stock and passed under GCC and Clang with the change. Renderer build and headless route passed. A retained smaller spare may serve fewer subsequent larger requests on another workload or driver. The review identified this case. The full Linux suite returned 720 passed, 41 failed and 19 skipped. All 41 failures reproduced on the source-matched control. - [x] Recorded the measured runs in docs/tested. - [x] Ran the changed production path in game. - [x] Recorded Codex assistance and committed as HumanBean. - [x] Completed reverse-order timing and compared full-suite failures with the control. - [ ] Physical low-VRAM hardware coverage is pending.
Assisted-by: OpenAI Codex
perf(vk): fit mid-size captures to tight spare budgets
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 9s
PR description / Description follows the template (pull_request_target) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 12s
Website / Website on Cloudflare (pull_request_target) Has been skipped
42fdc10eac
Assisted-by: OpenAI Codex
Author
Owner

Tested in game: CachyOS Linux, RTX 3090, 620.70.06, Ryzen 9 7900X. Both arms ran the fixed Market and Field route using a simulated 6 GiB VRAM budget. One clean pair complete. Reverse order outstanding.

Tested in game: CachyOS Linux, RTX 3090, 620.70.06, Ryzen 9 7900X. Both arms ran the fixed Market and Field route using a simulated 6 GiB VRAM budget. One clean pair complete. Reverse order outstanding.
Collaborator

Possibly related, for context:

  • PR #1599 WIP: perf(vk): retain and refill capture buffers by size class — Overlapping capture-buffer spare/refill strategy
Possibly related, for context: - PR #1599 WIP: perf(vk): retain and refill capture buffers by size class — Overlapping capture-buffer spare/refill strategy
docs: record reverse-order tight-budget capture timings
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 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Failing after 4s
cf224daf80
Assisted-by: OpenAI Codex
Author
Owner

Added the reverse-order Market and Field results and the full Linux test report. With a simulated 6 GiB budget both pairs gained average FPS and improved p99, but both had a worse maximum Market frame. The repeat peaked at 677 ms in the Market turn. The full suite had 41 failures, all reproduced on the control. Physical low-VRAM coverage is still open.

Added the reverse-order Market and Field results and the full Linux test report. With a simulated 6 GiB budget both pairs gained average FPS and improved p99, but both had a worse maximum Market frame. The repeat peaked at 677 ms in the Market turn. The full suite had 41 failures, all reproduced on the control. Physical low-VRAM coverage is still open.
Author
Owner

A separate instrumented pass counted foreground capture allocations under the simulated 6 GiB policy. During the 15-second Market turn, baseline allocated 26.66 GiB over 671 presents (40.69 MiB per present). The new classes allocated 11.82 GiB over 762 presents (15.88 MiB per present). These are gross cumulative allocations. The worst frame in the instrumented candidate lasted 965.48 ms. Six fresh allocations overlapped 908.48 ms of that frame, asked the driver for 832 MiB, and carried 564.5 MiB of requested payload. All six requests individually exceeded the 32 MiB spare budget. A separate follow-up is testing exact sizing for these buffers. This capture identifies a mechanism for a repeatable Market hitch. The 677 ms frame from the lightweight repeat has no allocation trace.

A separate instrumented pass counted foreground capture allocations under the simulated 6 GiB policy. During the 15-second Market turn, baseline allocated 26.66 GiB over 671 presents (40.69 MiB per present). The new classes allocated 11.82 GiB over 762 presents (15.88 MiB per present). These are gross cumulative allocations. The worst frame in the instrumented candidate lasted 965.48 ms. Six fresh allocations overlapped 908.48 ms of that frame, asked the driver for 832 MiB, and carried 564.5 MiB of requested payload. All six requests individually exceeded the 32 MiB spare budget. A separate follow-up is testing exact sizing for these buffers. This capture identifies a mechanism for a repeatable Market hitch. The 677 ms frame from the lightweight repeat has no allocation trace.
HumanBean changed title from WIP: perf(vk): fit mid-size captures to tight spare budgets to perf(vk): fit mid-size captures to tight spare budgets 2026-11-18 16:48:06 +00:00
HumanBean deleted branch perf/tight-budget-capture-sizes 2026-11-18 16:48:13 +00:00
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!1605
No description provided.