perf(cores): run the submitting thread's helpers at its priority #22

Merged
Indy2l merged 1 commit from upstream-pr/22 into main 2026-11-27 09:31:55 +00:00
Indy2l commented 2026-11-27 08:46:40 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Indy2l on 2026-11-27T08:46:40Z.


Problem

The submitting thread runs above normal priority (queue::behind), but the threads it waits for ran at normal priority: the shadow::wide pool (refreshes, snapshots), the pools of land (landing, title bytes under flights' writes, heap records and views), victory-heap-sync and victory-aside. They competed on equal terms with the title's threads and the eight list translators.

On a six-core CPU (i5-12400F, 12 threads) everything is busy, so while the submitting thread waited for its helpers, they often weren't running. A CPU sampling profile (WPR) of a world session showed the translators alone using about 2.4 cores. The submitting thread was the wall at about 105 ms of a 119 ms frame, and the card was idle about 37 ms a frame behind it.

Change

VICTORY_HELPER_PRIORITY (on unless 0) runs those helper threads at above-normal priority, the same as the submitting thread. Each helper re-checks the switch before each piece of work and calls SetThreadPriority only when it changes. That means VICTORY_AB can flip it while the title runs, which is how it was measured. The change is all in cores::Priority, plus one or two lines in each thread loop.

Validation

One run with VICTORY_AB=20,VICTORY_HELPER_PRIORITY (plus a second switch that was dropped), i5-12400F, RTX 3060 12 GB, 16 GB RAM, Series S at 540p with play-S-540p.ps1. Medians of 5-second windows in the world, about 40 s per setting:

off on
fps 8.6 9.6
frame 116.8 ms 104.1 ms
refreshes per frame 23.1 ms 17.6 ms
waiting for heap records 6.2 ms 2.5 ms
card idle behind the submitting thread 24.7 ms 13.2 ms

The internal timings move the way the profile predicted. The fps gain comes from a short run, so take it as about +10%, not a precise figure.

  • Measured on 6a31e43 (before the foxhound base), then rebased cleanly onto 18a8dc2. Not re-run in game on the new base.
  • cargo test -p victory-gpu --lib, plain and with diagnostics: all pass except indirect::tests::host_list_budget_starts_empty_at_each_submission and warp_batch_charges_every_execution, which fail on 18a8dc2 without this change too.
  • Clippy shows no findings in the changed lines. The crate already has findings elsewhere.
  • Also tried: dropping the list translators to below normal (VICTORY_THIN_LOW). Each list call got about 5% slower, with no clear gain on its own, so it's not included.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5523776383 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/22). Originally posted by [Indy2l](https://github.com/Indy2l) on 2026-11-27T08:46:40Z. --- ## Problem The submitting thread runs above normal priority (`queue::behind`), but the threads it waits for ran at normal priority: the `shadow::wide` pool (refreshes, snapshots), the pools of `land` (landing, title bytes under flights' writes, heap records and views), `victory-heap-sync` and `victory-aside`. They competed on equal terms with the title's threads and the eight list translators. On a six-core CPU (i5-12400F, 12 threads) everything is busy, so while the submitting thread waited for its helpers, they often weren't running. A CPU sampling profile (WPR) of a world session showed the translators alone using about 2.4 cores. The submitting thread was the wall at about 105 ms of a 119 ms frame, and the card was idle about 37 ms a frame behind it. ## Change `VICTORY_HELPER_PRIORITY` (on unless `0`) runs those helper threads at above-normal priority, the same as the submitting thread. Each helper re-checks the switch before each piece of work and calls `SetThreadPriority` only when it changes. That means `VICTORY_AB` can flip it while the title runs, which is how it was measured. The change is all in `cores::Priority`, plus one or two lines in each thread loop. ## Validation One run with `VICTORY_AB=20,VICTORY_HELPER_PRIORITY` (plus a second switch that was dropped), i5-12400F, RTX 3060 12 GB, 16 GB RAM, Series S at 540p with `play-S-540p.ps1`. Medians of 5-second windows in the world, about 40 s per setting: | | off | on | |---|---|---| | fps | 8.6 | 9.6 | | frame | 116.8 ms | 104.1 ms | | refreshes per frame | 23.1 ms | 17.6 ms | | waiting for heap records | 6.2 ms | 2.5 ms | | card idle behind the submitting thread | 24.7 ms | 13.2 ms | The internal timings move the way the profile predicted. The fps gain comes from a short run, so take it as about +10%, not a precise figure. - Measured on 6a31e43 (before the foxhound base), then rebased cleanly onto 18a8dc2. Not re-run in game on the new base. - `cargo test -p victory-gpu --lib`, plain and with `diagnostics`: all pass except `indirect::tests::host_list_budget_starts_empty_at_each_submission` and `warp_batch_charges_every_execution`, which fail on 18a8dc2 without this change too. - Clippy shows no findings in the changed lines. The crate already has findings elsewhere. - Also tried: dropping the list translators to below normal (`VICTORY_THIN_LOW`). Each list call got about 5% slower, with no clear gain on its own, so it's not included. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!22
No description provided.