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

Manually merged
github merged 1 commit from github-bot/gh-22 into main 2026-11-27 10:44:55 +00:00 AGit
Owner

@⁠Indy2l on GitHub · 2026-11-27 08:46 UTC · original
Indy2l:perf/helper-priority → main · +62 −1 · 5 files · 1 commits · merged 2026-11-27 09:31 UTC

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

**@⁠Indy2l** on GitHub · 2026-11-27 08:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/22) `Indy2l:perf/helper-priority` → `main` · +62 −1 · 5 files · 1 commits · merged 2026-11-27 09:31 UTC ## 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)
The submitting thread runs above normal, but the threads it waits for
(the wide pool, the landing pools, heap records, the heap pass beside
the lists) ran at normal priority, level with the title's threads and
the list translators. On a six-core CPU they were often not running
while it waited. VICTORY_HELPER_PRIORITY (on unless 0, VICTORY_AB can
flip it) raises them to above normal.

A/B in one run on an i5-12400F with an RTX 3060 (run10, Series S at
540p, off / on): 8.6 / 9.6 fps, refreshes 23.1 / 17.6 ms a frame,
waiting for heap records 6.2 / 2.5 ms, card idle behind the submitting
thread 24.7 / 13.2 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 08:50:12 +00:00
github manually merged commit b98279b65e into main 2026-11-27 10:44:55 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.