perf(host): offload landed command-list recycling to victory-late-wait by default #4396

Open
Andreww2009 wants to merge 1 commit from upstream-pr/4396 into main
Andreww2009 commented 2026-11-30 19:48:17 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Andreww2009 on 2026-11-30T19:48:17Z.


Why

In Host::send_late (crates/victory-gpu/src/host.rs), when VICTORY_SUBMIT_SPLIT=0 (the default) and VICTORY_RELAY=2 (the default), the submitting thread still synchronously called land() and bury(...) after every submission. On a 24-thread Core Ultra 9 275HX + RTX 5080 Laptop (v2026.11.30.02 / .03, 1440p Series X, DLSS Quality), resetting ~200 landed command allocators/lists inline took 2.3–3.8 ms/frame in AFTER_SEND on the critical submitting thread, even though victory-late-wait (late_helper) is already spawned and poked (*poke = true; LINE_MOVED.notify_all()) by every landing in relay_worker and settle.

Change

  • Add LATE_HELPER_UP (set with Ordering::Release once late_helper has acquired its fence event and is entering its wait loop) and VICTORY_ASYNC_LAND (enabled by default via toggled!, disable with VICTORY_ASYNC_LAND=0 for A/B testing).
  • Extract a pure helper_handles_landing(apart, relay_on, helper_up, async_on) predicate used by Host::send_late so synchronous land()/bury() is skipped when relay() is active, late_helper is live, and VICTORY_ASYNC_LAND is enabled (preserving the exact inline fallback if VICTORY_RELAY=0, VICTORY_ASYNC_LAND=0, or if late_helper failed to start).
  • Add unit test host::late_tests::helper_handles_landing_requires_relay_and_live_helper_unless_split.

Relation to #4109

#4109 addresses the same bottleneck (VICTORY_DEFER_LIST_RECYCLE) with a larger multi-file change (+299/-48 across 6 files including new host/post_submit.rs instrumentation and unrelated lint cleanups). This PR offers a minimal, surgical 1-file (+39/-4) alternative strictly scoped to crates/victory-gpu/src/host.rs with zero new modules, zero unrelated diffs, and an explicit helper-liveness atomic (LATE_HELPER_UP) before skipping inline recycling.

Verification

  • Hardware: Lenovo Legion 9 18IAX10 — Intel Core Ultra 9 275HX, NVIDIA RTX 5080 Laptop 16 GB GDDR7 (driver 621.14), Windows 11 x64 (Rust 1.98.1, pinned).
  • Unit tests: cargo test -p victory-gpu --locked late_tests (5 passed, 0 failed), zero warnings in crates/victory-gpu/src/host.rs, git diff --check clean, cargo xtask policy clean.
  • Live scripted 1440p DLSS Quality (FG OFF) benchmark (v2026.11.30.03 Release, 19 × 5 s windows, ~3,100 frames, same save & route):
    • Official v2026.11.30.03 (e1251c31): submit_total_med 22.1 ms/frame, 32.44 avg / 31.9 med FPS, 20.5 low-5% FPS, 224.2 ms max spike, 211 frames >50 ms.
    • With this change (and our C3 branch): submit_total_med 20.1 ms/frame (-2.0 ms), 34.00 avg / 32.9 med FPS, 23.8 low-5% FPS, 137.6 ms max spike, 170 frames >50 ms, 0 crashes.
    • Note: in Host::send_late, after starts before relay_wait/settle, so AFTER_SEND still reflects any WHY_MOST/WHY_WRITES wait while land()/bury() itself runs off-thread.

Original contribution under GPL-3.0-or-later.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5572574880 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4396). Originally posted by [Andreww2009](https://github.com/Andreww2009) on 2026-11-30T19:48:17Z. --- ## Why In `Host::send_late` (`crates/victory-gpu/src/host.rs`), when `VICTORY_SUBMIT_SPLIT=0` (the default) and `VICTORY_RELAY=2` (the default), the submitting thread still synchronously called `land()` and `bury(...)` after every submission. On a 24-thread Core Ultra 9 275HX + RTX 5080 Laptop (`v2026.11.30.02` / `.03`, 1440p Series X, DLSS Quality), resetting ~200 landed command allocators/lists inline took **2.3–3.8 ms/frame** in `AFTER_SEND` on the critical submitting thread, even though `victory-late-wait` (`late_helper`) is already spawned and poked (`*poke = true; LINE_MOVED.notify_all()`) by every landing in `relay_worker` and `settle`. ## Change - Add `LATE_HELPER_UP` (set with `Ordering::Release` once `late_helper` has acquired its fence event and is entering its wait loop) and `VICTORY_ASYNC_LAND` (enabled by default via `toggled!`, disable with `VICTORY_ASYNC_LAND=0` for A/B testing). - Extract a pure `helper_handles_landing(apart, relay_on, helper_up, async_on)` predicate used by `Host::send_late` so synchronous `land()`/`bury()` is skipped when `relay()` is active, `late_helper` is live, and `VICTORY_ASYNC_LAND` is enabled (preserving the exact inline fallback if `VICTORY_RELAY=0`, `VICTORY_ASYNC_LAND=0`, or if `late_helper` failed to start). - Add unit test `host::late_tests::helper_handles_landing_requires_relay_and_live_helper_unless_split`. ## Relation to #4109 #4109 addresses the same bottleneck (`VICTORY_DEFER_LIST_RECYCLE`) with a larger multi-file change (`+299/-48` across 6 files including new `host/post_submit.rs` instrumentation and unrelated lint cleanups). This PR offers a minimal, surgical **1-file (`+39/-4`)** alternative strictly scoped to `crates/victory-gpu/src/host.rs` with zero new modules, zero unrelated diffs, and an explicit helper-liveness atomic (`LATE_HELPER_UP`) before skipping inline recycling. ## Verification - Hardware: Lenovo Legion 9 18IAX10 — Intel Core Ultra 9 275HX, NVIDIA RTX 5080 Laptop 16 GB GDDR7 (driver 621.14), Windows 11 x64 (`Rust 1.98.1`, pinned). - Unit tests: `cargo test -p victory-gpu --locked late_tests` (`5 passed, 0 failed`), zero warnings in `crates/victory-gpu/src/host.rs`, `git diff --check` clean, `cargo xtask policy` clean. - Live scripted 1440p DLSS Quality (FG OFF) benchmark (`v2026.11.30.03` Release, 19 × 5 s windows, ~3,100 frames, same save & route): - Official `v2026.11.30.03` (`e1251c31`): `submit_total_med` `22.1 ms/frame`, `32.44` avg / `31.9` med FPS, `20.5` low-5% FPS, `224.2 ms` max spike, `211` frames >50 ms. - With this change (and our C3 branch): `submit_total_med` `20.1 ms/frame` (`-2.0 ms`), `34.00` avg / `32.9` med FPS, `23.8` low-5% FPS, `137.6 ms` max spike, `170` frames >50 ms, 0 crashes. - Note: in `Host::send_late`, `after` starts before `relay_wait`/`settle`, so `AFTER_SEND` still reflects any `WHY_MOST`/`WHY_WRITES` wait while `land()`/`bury()` itself runs off-thread. *Original contribution under GPL-3.0-or-later.*
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/4396:upstream-pr/4396'
git switch 'upstream-pr/4396'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/4396'
git switch 'upstream-pr/4396'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/4396'
git switch 'upstream-pr/4396'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/4396'
git switch 'main'
git merge --squash 'upstream-pr/4396'
git switch 'main'
git merge --ff-only 'upstream-pr/4396'
git switch 'main'
git merge 'upstream-pr/4396'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!4396
No description provided.