The title's thread affinities on the fast cores first (Intel hybrid CPUs) #419

Merged
justrealyme merged 1 commit from upstream-pr/419 into main 2026-11-29 08:16:59 +00:00
justrealyme commented 2026-11-27 22:09:28 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by justrealyme on 2026-11-27T22:09:28Z.


Problem

The title pins its threads by processor number with SetThreadGroupAffinity, as it would on the console, where all eight cores are the same. The call went straight to the host. On a CPU with two kinds of core, those numbers land on a mix of fast and slow cores.

On an Intel Core Ultra 7 265K, the fast cores (P-cores) are logical processors 0, 1, 6-9, 18 and 19. A thread dump in the prison cell showed:

Title threads Mask asked On this CPU
~9 busy workers at "highest" 0xFF (0-7) 4 fast + 4 slow cores
~8 threads 0x1F00 (8-12) 2 fast + 3 slow
1 "time critical" thread, ~35% busy 0x2000 (13 alone) one slow core

The layer's own threads already keep to the fast cores (cores.rs). The title's own threads didn't.

Change

SetThreadGroupAffinity from api-ms-win-core-processtopology-* is now handled by modules::kernel, next to the existing SetThreadPriority override. VICTORY_TITLE_AFFINITY has three settings:

  • fast (default): the title's processor i becomes the host's i-th fastest, ordered by efficiency class and then by number (GetSystemCpuSetInformation, group 0). On the 265K the title's 0-7 become the eight fast cores. On a CPU where all cores are alike (a Ryzen without E-cores, for example), the order is the host's own and every mask stays unchanged.
  • free: the call is answered as done (with the previous affinity) and the thread is left to the Windows scheduler.
  • keep: as before.

A unit test covers the 265K layout and the all-cores-alike case. The only other change is the Win32_System_SystemInformation feature for victory-hle.

Validation

Core Ultra 7 265K, RTX 5070 Ti (driver 621.40), 31 GB RAM, Windows 11. Release build, play-nvidia.ps1 defaults (Series X, 1440p, DLSS Quality), same scripted route into the prison cell, presents per second from 140 to 205 s, caches warm. Before / after:

before (keep) after (fast)
mean fps 24.6 24.8
10th percentile / lowest second 23 / 6 24 / 23
card idle while the title hadn't submitted 3.7 ms/frame 0.1 ms/frame
card idle behind the submitting thread 9.7 ms/frame 12.8 ms/frame

What it does: the title-side waits are gone and the dips are smaller. What it doesn't do: raise the average on this CPU, because the submitting thread is the next limit. The fps figures are from one run each, and the same route varies by about ±3 fps between runs, so read the mean as "unchanged". The internal timings are the clearer signal.

  • Measured on f3534e6, rebased onto df2daaf, rebuilt, and confirmed to run. Not re-measured on the new base.
  • cargo test -p victory-hle: all pass (175 + the rest).
  • cargo clippy -p victory-hle --all-targets: nothing in the changed file. With -D warnings it stops on existing victory-gpu findings (dead code in host/indirects.rs, among others), which are there on main as well.
  • Also tried, not included: putting the layer's own helpers on the fast cores too (VICTORY_FAST_CORES=3) made no difference.

Done with AI assistance (Claude Code). No game data is included.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5533737352 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/419). Originally posted by [justrealyme](https://github.com/justrealyme) on 2026-11-27T22:09:28Z. --- ## Problem The title pins its threads by processor number with `SetThreadGroupAffinity`, as it would on the console, where all eight cores are the same. The call went straight to the host. On a CPU with two kinds of core, those numbers land on a mix of fast and slow cores. On an Intel Core Ultra 7 265K, the fast cores (P-cores) are logical processors 0, 1, 6-9, 18 and 19. A thread dump in the prison cell showed: | Title threads | Mask asked | On this CPU | |---|---|---| | ~9 busy workers at "highest" | `0xFF` (0-7) | 4 fast + 4 slow cores | | ~8 threads | `0x1F00` (8-12) | 2 fast + 3 slow | | 1 "time critical" thread, ~35% busy | `0x2000` (13 alone) | one slow core | The layer's own threads already keep to the fast cores (`cores.rs`). The title's own threads didn't. ## Change `SetThreadGroupAffinity` from `api-ms-win-core-processtopology-*` is now handled by `modules::kernel`, next to the existing `SetThreadPriority` override. `VICTORY_TITLE_AFFINITY` has three settings: - `fast` (default): the title's processor `i` becomes the host's `i`-th fastest, ordered by efficiency class and then by number (`GetSystemCpuSetInformation`, group 0). On the 265K the title's 0-7 become the eight fast cores. On a CPU where all cores are alike (a Ryzen without E-cores, for example), the order is the host's own and every mask stays unchanged. - `free`: the call is answered as done (with the previous affinity) and the thread is left to the Windows scheduler. - `keep`: as before. A unit test covers the 265K layout and the all-cores-alike case. The only other change is the `Win32_System_SystemInformation` feature for `victory-hle`. ## Validation Core Ultra 7 265K, RTX 5070 Ti (driver 621.40), 31 GB RAM, Windows 11. Release build, `play-nvidia.ps1` defaults (Series X, 1440p, DLSS Quality), same scripted route into the prison cell, presents per second from 140 to 205 s, caches warm. Before / after: | | before (`keep`) | after (`fast`) | |---|---|---| | mean fps | 24.6 | 24.8 | | 10th percentile / lowest second | 23 / 6 | 24 / 23 | | card idle while the title hadn't submitted | 3.7 ms/frame | 0.1 ms/frame | | card idle behind the submitting thread | 9.7 ms/frame | 12.8 ms/frame | What it does: the title-side waits are gone and the dips are smaller. What it doesn't do: raise the average on this CPU, because the submitting thread is the next limit. The fps figures are from one run each, and the same route varies by about ±3 fps between runs, so read the mean as "unchanged". The internal timings are the clearer signal. - Measured on f3534e6, rebased onto df2daaf, rebuilt, and confirmed to run. Not re-measured on the new base. - `cargo test -p victory-hle`: all pass (175 + the rest). - `cargo clippy -p victory-hle --all-targets`: nothing in the changed file. With `-D warnings` it stops on existing `victory-gpu` findings (dead code in `host/indirects.rs`, among others), which are there on main as well. - Also tried, not included: putting the layer's own helpers on the fast cores too (`VICTORY_FAST_CORES=3`) made no difference. Done with AI assistance (Claude Code). No game data is included. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fromrivertothesea commented 2026-11-28 00:23:48 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by fromrivertothesea on 2026-11-28T00:23:48Z.


Measured on a different hybrid CPU, for comparison: i5-12600KF (6 P-cores + 4 E-cores), RTX 5070 Ti, 32 GB, GTA VI 1.0.2.1, first playable part (the prison cell), Series X profile, DLSS Quality, frame generation not prepared (-NoFrameGenReady). Same build both times (this PR merged in); the only difference is VICTORY_TITLE_AFFINITY. Medians over 90 s of settled gameplay:

VICTORY_TITLE_AFFINITY fps (median) range card busy
keep 20.3 11.9–24.9 65%
fast (default) 18.9 13.7–23.0 57%

So no gain here; the difference is within run-to-run noise. On this PC the frame is limited by the submitting thread's own work (about 43 ms per frame preparing, mostly refreshes of title buffers), and that thread is the layer's, which cores.rs already keeps on fast cores.

One thing to look at: the first run with this PR crashed once while loading, at frame 11463, with draw.rs:128: index out of bounds: the len is 5 but the index is 17 in TableGroup::entry, on a list thread (list::thin::run_plain). A TablePlan can't hold that index as built, so it reads like a stale pipeline pointer or a race. That build also had #378 merged in, the crash happened only once, and the later run with this PR on didn't crash, so I can't say this PR causes it. It may just be the different thread timing exposing something older.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7230879043 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/419#issuecomment-7230879043). Originally posted by [fromrivertothesea](https://github.com/fromrivertothesea) on 2026-11-28T00:23:48Z. --- Measured on a different hybrid CPU, for comparison: **i5-12600KF** (6 P-cores + 4 E-cores), RTX 5070 Ti, 32 GB, GTA VI 1.0.2.1, first playable part (the prison cell), Series X profile, DLSS Quality, frame generation not prepared (`-NoFrameGenReady`). Same build both times (this PR merged in); the only difference is `VICTORY_TITLE_AFFINITY`. Medians over 90 s of settled gameplay: | `VICTORY_TITLE_AFFINITY` | fps (median) | range | card busy | |---|---|---|---| | `keep` | 20.3 | 11.9–24.9 | 65% | | `fast` (default) | 18.9 | 13.7–23.0 | 57% | So no gain here; the difference is within run-to-run noise. On this PC the frame is limited by the submitting thread's own work (about 43 ms per frame preparing, mostly refreshes of title buffers), and that thread is the layer's, which `cores.rs` already keeps on fast cores. One thing to look at: the first run with this PR crashed once while loading, at frame 11463, with `draw.rs:128: index out of bounds: the len is 5 but the index is 17` in `TableGroup::entry`, on a list thread (`list::thin::run_plain`). A `TablePlan` can't hold that index as built, so it reads like a stale pipeline pointer or a race. That build also had #378 merged in, the crash happened only once, and the later run with this PR on didn't crash, so I can't say this PR causes it. It may just be the different thread timing exposing something older. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
x-nihil0 commented 2026-11-28 16:38:10 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by x-nihil0 on 2026-11-28T16:38:10Z.


Core Ultra 9 285: fast is slower than keep here, because it moves the title's 8-13 off the P-cores

Machine: Intel Core Ultra 9 285 (8 P-cores + 16 E-cores, no hyperthreading; the P-cores are logical processors 0, 1, 10-13, 22 and 23), RTX 5080 16 GB, driver 621.40, 64 GB RAM, Windows 11. Release build of main 63b902f + this PR (9ec281f), the release launcher's set (Series X, 1440p, DLSS Quality, frame generation not made ready). Six unattended 300 s runs from one save in the open world, one after the other on one build, the only change VICTORY_TITLE_AFFINITY. fps medians over the same 230 s, by draws per frame:

VICTORY_TITLE_AFFINITY 7-9k draws 9-11k 11k+
keep (first run) 19.9 18.5 16.6
fast (default) 19.3 17.3 13.7
free 20.7 18.3 15.5
keep (last run) 20.5 18.8 15.5

The two keep runs are 0.3-0.6 fps apart in the first two bands (the first one had my analysis tools running beside it, the later ones had nothing). fast is 0.6-1.2 fps below them at 7-9k draws and 1.2-1.5 at 9-11k.

Why, from a log line I added for each mask the title asks for: with fast, 0x1F00 (8-12) becomes 0x7C (2-6) and 0x2000 (13) becomes 0x80 (7). On the 285 those are all E-cores, while with keep the same threads sit on three P-cores plus two E-cores (8-12) and on one P-core (13). On this machine those are the title's busy threads: read live in an earlier session, the five threads at 0x1F00 used 270-320 ms of CPU a second each and the one at 0x2000 453 ms. So fast gives 0-7 the eight P-cores and moves these busy threads to E-cores. On the 265K in the description the same remap takes only 8 and 9 off P-cores (13 is an E-core there with keep too), which may be why it came out even there.

I also tried a mapping of my own that puts 8-13 on P-cores and 0-7 on E-cores: 20.6 / 18.3 / 15.9, no better than keep. So on a 285 I'd keep keep (or free) as the default. I can't say what's best on CPUs with more P-cores.

No game files, captures or saves are attached. Made with AI help; the figures come from the run logs.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7242394570 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/419#issuecomment-7242394570). Originally posted by [x-nihil0](https://github.com/x-nihil0) on 2026-11-28T16:38:10Z. --- **Core Ultra 9 285: `fast` is slower than `keep` here, because it moves the title's 8-13 off the P-cores** Machine: Intel Core Ultra 9 285 (8 P-cores + 16 E-cores, no hyperthreading; the P-cores are logical processors 0, 1, 10-13, 22 and 23), RTX 5080 16 GB, driver 621.40, 64 GB RAM, Windows 11. Release build of `main` `63b902f` + this PR (`9ec281f`), the release launcher's set (Series X, 1440p, DLSS Quality, frame generation not made ready). Six unattended 300 s runs from one save in the open world, one after the other on one build, the only change `VICTORY_TITLE_AFFINITY`. fps medians over the same 230 s, by draws per frame: | `VICTORY_TITLE_AFFINITY` | 7-9k draws | 9-11k | 11k+ | |---|---|---|---| | `keep` (first run) | 19.9 | 18.5 | 16.6 | | `fast` (default) | 19.3 | 17.3 | 13.7 | | `free` | 20.7 | 18.3 | 15.5 | | `keep` (last run) | 20.5 | 18.8 | 15.5 | The two `keep` runs are 0.3-0.6 fps apart in the first two bands (the first one had my analysis tools running beside it, the later ones had nothing). `fast` is 0.6-1.2 fps below them at 7-9k draws and 1.2-1.5 at 9-11k. Why, from a log line I added for each mask the title asks for: with `fast`, `0x1F00` (8-12) becomes `0x7C` (2-6) and `0x2000` (13) becomes `0x80` (7). On the 285 those are all E-cores, while with `keep` the same threads sit on three P-cores plus two E-cores (8-12) and on one P-core (13). On this machine those are the title's busy threads: read live in an earlier session, the five threads at `0x1F00` used 270-320 ms of CPU a second each and the one at `0x2000` 453 ms. So `fast` gives 0-7 the eight P-cores and moves these busy threads to E-cores. On the 265K in the description the same remap takes only 8 and 9 off P-cores (13 is an E-core there with `keep` too), which may be why it came out even there. I also tried a mapping of my own that puts 8-13 on P-cores and 0-7 on E-cores: 20.6 / 18.3 / 15.9, no better than `keep`. So on a 285 I'd keep `keep` (or `free`) as the default. I can't say what's best on CPUs with more P-cores. No game files, captures or saves are attached. Made with AI help; the figures come from the run logs.
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!419
No description provided.