Defer completed command-list recycling by default #4109

Closed
github-bot wants to merge 4 commits from github-bot/gh-4109 into main AGit
Owner

@⁠vilaris on GitHub · 2026-11-30 16:09 UTC · original
vilaris:perf/defer-completed-list-recycling → main · +299 −48 · 6 files · 4 commits · closed without merging

## Why

Completed command lists were still reset and returned to the idle pool on the late-submit thread. A drain can do several milliseconds of allocator and command-list work after the current submission has been published, delaying the next one.

Change

  • Default VICTORY_DEFER_LIST_RECYCLE to enabled. The existing late helper drains up to eight completed flights at a time and schedules another pass if more are ready.
  • Preserve flight ownership, GPU fence and relay completion requirements, the existing retirement lag, and the idle-pool limits. Pool misses still use the normal allocation path. The limit on idle storage does not cap total live slots.
  • Keep the synchronous drain available with VICTORY_DEFER_LIST_RECYCLE=0 and as a fallback for serial late submissions if the helper cannot start.
  • Keep detailed timing off by default. VICTORY_POST_SUBMIT_TIMING=1 opts into aggregated timings for post-submit work, pool acquisition and settling reasons.

Before and after

Same instrumented release binary on an RTX 4070, using the same gameplay routine and alternating only the recycle flag. The runs were close in duration and gameplay inputs were manual. These measurements come from the experimental checkout before the change was adapted to current main.

Metric Before, flag 0 (session 11600) After, flag 1 (session 26396)
Median of per-window post-submit p95 9 us 11 us
Maximum post-submit per submission 115.694 ms 1.295 ms
Maximum submit recycle scan 57 us 0 us
Maximum submit recycle drain 10.667 ms 0 ms
Flight-limit waits in post-submit 51 0
Slot creation calls 546 470
Maximum pool-lock wait 173 us 17 us
GPU idle during submit, last 15 windows 23.01 ms/frame 22.73 ms/frame
Frames over 100 ms, last 15 windows 16/238 (6.7%) 3/293 (1.0%)
Highest window frame p99, last 15 windows 238.7 ms 139.7 ms

Selected timing records, transcribed from the local logs:

Before  2026-11-30 15:45:17 UTC  session 11600  frame 4525
  post_submit_total=115694 us  flight_limit_wait=115683 us
  tracked_lists=256 -> 210  free_slots=79 -> 79
  direct_fence_published=16511  completed=16508 -> 16511

After   2026-11-30 15:46 UTC onward  session 26396  session maxima
  post_submit_total=1295 us  recycle_scan=0 us  recycle_drain=0 us
  flight_limit_wait_calls=0  pool_lock_wait=17 us

The long baseline wait was triggered by the in-flight list limit while the pool still had free slots. The measurements confirm that recycling left the submit path. They do not establish why the second run avoided the in-flight limit. The active run also had a 2.89 s outlier outside the final 15 windows.

Validation

  • cargo check --locked -p victory-gpu
  • cargo xtask policy --staged
  • git diff --check
**@⁠vilaris** on GitHub · 2026-11-30 16:09 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4109) `vilaris:perf/defer-completed-list-recycling` → `main` · +299 −48 · 6 files · 4 commits · closed without merging ## Why Completed command lists were still reset and returned to the idle pool on the late-submit thread. A drain can do several milliseconds of allocator and command-list work after the current submission has been published, delaying the next one. ## Change - Default `VICTORY_DEFER_LIST_RECYCLE` to enabled. The existing late helper drains up to eight completed flights at a time and schedules another pass if more are ready. - Preserve flight ownership, GPU fence and relay completion requirements, the existing retirement lag, and the idle-pool limits. Pool misses still use the normal allocation path. The limit on idle storage does not cap total live slots. - Keep the synchronous drain available with `VICTORY_DEFER_LIST_RECYCLE=0` and as a fallback for serial late submissions if the helper cannot start. - Keep detailed timing off by default. `VICTORY_POST_SUBMIT_TIMING=1` opts into aggregated timings for post-submit work, pool acquisition and settling reasons. ## Before and after Same instrumented release binary on an RTX 4070, using the same gameplay routine and alternating only the recycle flag. The runs were close in duration and gameplay inputs were manual. These measurements come from the experimental checkout before the change was adapted to current main. | Metric | Before, flag 0 (session 11600) | After, flag 1 (session 26396) | | --- | ---: | ---: | | Median of per-window post-submit p95 | 9 us | 11 us | | Maximum post-submit per submission | 115.694 ms | 1.295 ms | | Maximum submit recycle scan | 57 us | 0 us | | Maximum submit recycle drain | 10.667 ms | 0 ms | | Flight-limit waits in post-submit | 51 | 0 | | Slot creation calls | 546 | 470 | | Maximum pool-lock wait | 173 us | 17 us | | GPU idle during submit, last 15 windows | 23.01 ms/frame | 22.73 ms/frame | | Frames over 100 ms, last 15 windows | 16/238 (6.7%) | 3/293 (1.0%) | | Highest window frame p99, last 15 windows | 238.7 ms | 139.7 ms | Selected timing records, transcribed from the local logs: ~~~ Before 2026-11-30 15:45:17 UTC session 11600 frame 4525 post_submit_total=115694 us flight_limit_wait=115683 us tracked_lists=256 -> 210 free_slots=79 -> 79 direct_fence_published=16511 completed=16508 -> 16511 After 2026-11-30 15:46 UTC onward session 26396 session maxima post_submit_total=1295 us recycle_scan=0 us recycle_drain=0 us flight_limit_wait_calls=0 pool_lock_wait=17 us ~~~ The long baseline wait was triggered by the in-flight list limit while the pool still had free slots. The measurements confirm that recycling left the submit path. They do not establish why the second run avoided the in-flight limit. The active run also had a 2.89 s outlier outside the final 15 windows. ## Validation - `cargo check --locked -p victory-gpu` - `cargo xtask policy --staged` - `git diff --check`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 16:10:56 +00:00
Author
Owner

@⁠Zeyphers on GitHub · 2026-11-30 20:20 UTC · original

Merged onto main 84bd61e2 and benched on an RTX 2080 Super 8 GB and Ryzen 7 5800X (Series S, DLSS Quality, standing scene, 180 s): 9.4 fps median vs 9.2–9.7 baseline, so no measurable change on this CPU-bound rig. Two baseline runs differed by about 0.5 fps, so that's the noise. Only one run per PR, in a standing scene, not a walk.

**@⁠Zeyphers** on GitHub · 2026-11-30 20:20 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4109#issuecomment-7290751149) Merged onto main `84bd61e2` and benched on an RTX 2080 Super 8 GB and Ryzen 7 5800X (Series S, DLSS Quality, standing scene, 180 s): 9.4 fps median vs 9.2–9.7 baseline, so no measurable change on this CPU-bound rig. Two baseline runs differed by about 0.5 fps, so that's the noise. Only one run per PR, in a standing scene, not a walk.
Author
Owner

@⁠nicolasabosch on GitHub · 2026-11-30 22:38 UTC · original

Tested on an RTX 4070 Laptop 8 GB: no measurable fps difference in this scene (2 runs).

Tested on main e1251c31 with this PR (53633864) merged on top and nothing else changed. Release build, same profile as main.

Setup

  • PC: RTX 4070 Laptop 8 GB, i9-14900HX, 32 GB RAM, Windows 11.
  • Command: victory play --series-s --dlss performance --framegen 2, with no fps cap and the window minimized.
  • Route: scripted Enter presses into the world from a save, then the character idles there for 300 s.
  • fps is the mean of the last 40 host: reports, about 200 s. These are real frames, not generated ones.
  • The submit-thread figures come from the "preparing per frame, the submitting thread" line, also over the last 40 reports.
  • The second run starts from a fixed copy of the save. In the first run the save had moved on, so the scene was a little different.
run fps ms/frame submit thread ms refreshes ms
main, 8 runs 15.94 – 18.76 53.4 – 62.8 35.0 – 41.4 13.3 – 15.4
main, fixed save only (5 runs) 15.94 – 18.18 (median 16.33) 55.1 – 62.8 35.0 – 40.5 13.3 – 15.2
this PR, run 1 17.03 58.7 39.4 14.3
this PR, run 2 (fixed save) 16.67 60.1 37.9 14.2

On this laptop, identical main runs differ by up to about 2–2.5 fps, so only an effect of roughly 2–3 fps or more would be visible in this scene. Frames over 100 ms were 2 of 2749 in the fixed-save run, against 1–4 per run of about 2650 on main, so they were rare either way in this scene. A third start ended about 50 s in, during loading. Its stderr shows a first-chance 0xc000001d, an illegal instruction, inside the title's own code. No other start of the 32 here did that, main's included. I can't say it has anything to do with this PR, which changes list recycling, but I'm reporting it anyway. The first run also translated every shader again, because the PR edits a file under crates/victory-shader/src.

Not tested: driving, camera turns, interiors, an image comparison, other GPUs.

**@⁠nicolasabosch** on GitHub · 2026-11-30 22:38 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4109#issuecomment-7294115450) **Tested on an RTX 4070 Laptop 8 GB: no measurable fps difference in this scene (2 runs).** Tested on main `e1251c31` with this PR (`53633864`) merged on top and nothing else changed. Release build, same profile as main. **Setup** - PC: RTX 4070 Laptop 8 GB, i9-14900HX, 32 GB RAM, Windows 11. - Command: `victory play --series-s --dlss performance --framegen 2`, with no fps cap and the window minimized. - Route: scripted Enter presses into the world from a save, then the character idles there for 300 s. - fps is the mean of the last 40 `host:` reports, about 200 s. These are real frames, not generated ones. - The submit-thread figures come from the "preparing per frame, the submitting thread" line, also over the last 40 reports. - The second run starts from a fixed copy of the save. In the first run the save had moved on, so the scene was a little different. | run | fps | ms/frame | submit thread ms | refreshes ms | |---|---|---|---|---| | main, 8 runs | 15.94 – 18.76 | 53.4 – 62.8 | 35.0 – 41.4 | 13.3 – 15.4 | | main, fixed save only (5 runs) | 15.94 – 18.18 (median 16.33) | 55.1 – 62.8 | 35.0 – 40.5 | 13.3 – 15.2 | | this PR, run 1 | 17.03 | 58.7 | 39.4 | 14.3 | | this PR, run 2 (fixed save) | 16.67 | 60.1 | 37.9 | 14.2 | On this laptop, identical main runs differ by up to about 2–2.5 fps, so only an effect of roughly 2–3 fps or more would be visible in this scene. Frames over 100 ms were 2 of 2749 in the fixed-save run, against 1–4 per run of about 2650 on main, so they were rare either way in this scene. A third start ended about 50 s in, during loading. Its stderr shows a first-chance 0xc000001d, an illegal instruction, inside the title's own code. No other start of the 32 here did that, main's included. I can't say it has anything to do with this PR, which changes list recycling, but I'm reporting it anyway. The first run also translated every shader again, because the PR edits a file under `crates/victory-shader/src`. **Not tested:** driving, camera turns, interiors, an image comparison, other GPUs.
github-bot closed this pull request 2026-12-01 18:50:42 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:46 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4109#issuecomment-7321523778) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/trustno1-coder--VIctory-NVIDIA!4109
No description provided.