Our threads prefer the big-cache cores on dual-CCD X3D Ryzens (VICTORY_CACHE_CORES) #147

Manually merged
github merged 1 commit from github-bot/gh-147 into main 2026-11-26 08:21:46 +00:00 AGit
Owner

@⁠Jrjy3 on GitHub · 2026-11-26 07:30 UTC · original
Jrjy3:fps/cache-cores → main · +170 −5 · 2 files · 1 commits · merged 2026-11-26 08:17 UTC

On a Ryzen with two core complexes of which only one has the stacked cache (7900X3D, 7950X3D, 9900X3D, 9950X3D), every core reports the same efficiency class. So cores::fast_of finds no fast cores, and none of our threads (submit, relay, late wait, landing helpers) asks for any: they run on either complex, and Windows moves them between the two. AMD's V-Cache service only steers games it recognises, and victory.exe isn't one.

What it does

  • Where all cores have one class but the last-level caches differ in size, the sets on the largest L3 count as the fast ones (if there are at least 8 of them). The existing VICTORY_FAST_CORES stages then apply as they do on Intel hybrids. It is still a soft preference (SetThreadSelectedCpuSets), and the title's own threads are not asked for.
  • Cache sizes come from GetLogicalProcessorInformationEx(RelationCache), mapped to CPU set ids.
  • VICTORY_CACHE_CORES=0 turns it off. In diagnostics builds, VICTORY_AB=…,VICTORY_CACHE_CORES switches it while the title runs (frame_ends settles again on each change, as for VICTORY_LANE_CORE).
  • Threads register whenever cache cores could apply (fast_sets(.., false)), so a later switch reaches threads that started during an off phase.

Where it does nothing

Processor Result
Two kinds of cores (Intel hybrid) unchanged: the class decides, whatever the caches say (test)
One L3 (7800X3D, 9800X3D, Intel) unchanged (test)
Two equal L3s (9950X, 7950X) unchanged (test)
Cache sizes unknown, or the larger L3 serves under 8 sets unchanged (test)
Two unequal L3s (dual-CCD X3D) the big-cache complex is preferred

Measured

Ryzen 9 9950X3D (96 MB L3 on processors 0-15, 32 MB on 16-31) + Radeon AI PRO R9700, Windows 11 26300. Diagnostics build of this branch, scripts\play.ps1 settings plus VICTORY_AB=20,VICTORY_CACHE_CORES, 10 minutes into the first boat mission. Pairs are phases next to each other whose draws are within 15 %:

10 matched pairs change with it on
median frame -1.3 % (noise), faster in 7 of 10
p90 frame -12.2 %, better in 8 of 10

In the steady part (phases 18-29, about 3,900-4,000 draws), every phase with it on had a lower p90 (69.0-78.7 ms) than every phase without it (80.9-86.2 ms), at the same medians (66-70 ms). So it does not raise the average frame rate, but it makes the long frames shorter.

For comparison, pinning the whole process to the cache complex (an affinity mask, title threads included) cut our preparing from 22.6 to 19.4 ms, but the frame got slower (67.5 to 71.8 ms, separate runs). That is why only our threads are asked for, and softly.

One machine only. A run on another dual-CCD X3D part would be the most useful check: VICTORY_AB=20,VICTORY_CACHE_CORES in a diagnostics build, standing still somewhere, then compare the A/B phase lines.

Checks

  • cargo test -p victory-gpu --lib cores, with and without diagnostics: 3 passed (2 new tests with synthetic topologies for the table above).
  • cargo clippy -p victory-gpu --lib --tests -- -D warnings: no finding in the changed code. The ones it reports are already on main (for example queue.rs:1277, texture.rs:2067, and victory-formats texture.rs:1346, which stops the workspace run).
  • cargo xtask policy: 251 files ok.

This change was made with AI assistance (Claude Code).

🤖 Generated with Claude Code

**@⁠Jrjy3** on GitHub · 2026-11-26 07:30 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/147) `Jrjy3:fps/cache-cores` → `main` · +170 −5 · 2 files · 1 commits · merged 2026-11-26 08:17 UTC On a Ryzen with two core complexes of which only one has the stacked cache (7900X3D, 7950X3D, 9900X3D, 9950X3D), every core reports the same efficiency class. So `cores::fast_of` finds no fast cores, and none of our threads (submit, relay, late wait, landing helpers) asks for any: they run on either complex, and Windows moves them between the two. AMD's V-Cache service only steers games it recognises, and `victory.exe` isn't one. ## What it does - Where all cores have one class but the last-level caches differ in size, the sets on the **largest L3** count as the fast ones (if there are at least 8 of them). The existing `VICTORY_FAST_CORES` stages then apply as they do on Intel hybrids. It is still a soft preference (`SetThreadSelectedCpuSets`), and the title's own threads are not asked for. - Cache sizes come from `GetLogicalProcessorInformationEx(RelationCache)`, mapped to CPU set ids. - `VICTORY_CACHE_CORES=0` turns it off. In diagnostics builds, `VICTORY_AB=…,VICTORY_CACHE_CORES` switches it while the title runs (`frame_ends` settles again on each change, as for `VICTORY_LANE_CORE`). - Threads register whenever cache cores could apply (`fast_sets(.., false)`), so a later switch reaches threads that started during an off phase. ## Where it does nothing | Processor | Result | |---|---| | Two kinds of cores (Intel hybrid) | unchanged: the class decides, whatever the caches say (test) | | One L3 (7800X3D, 9800X3D, Intel) | unchanged (test) | | Two equal L3s (9950X, 7950X) | unchanged (test) | | Cache sizes unknown, or the larger L3 serves under 8 sets | unchanged (test) | | Two unequal L3s (dual-CCD X3D) | the big-cache complex is preferred | ## Measured Ryzen 9 9950X3D (96 MB L3 on processors 0-15, 32 MB on 16-31) + Radeon AI PRO R9700, Windows 11 26300. Diagnostics build of this branch, `scripts\play.ps1` settings plus `VICTORY_AB=20,VICTORY_CACHE_CORES`, 10 minutes into the first boat mission. Pairs are phases next to each other whose draws are within 15 %: | 10 matched pairs | change with it on | |---|---| | median frame | -1.3 % (noise), faster in 7 of 10 | | p90 frame | **-12.2 %**, better in 8 of 10 | In the steady part (phases 18-29, about 3,900-4,000 draws), every phase with it on had a lower p90 (69.0-78.7 ms) than every phase without it (80.9-86.2 ms), at the same medians (66-70 ms). So it does not raise the average frame rate, but it makes the long frames shorter. For comparison, pinning the **whole process** to the cache complex (an affinity mask, title threads included) cut our preparing from 22.6 to 19.4 ms, but the frame got slower (67.5 to 71.8 ms, separate runs). That is why only our threads are asked for, and softly. One machine only. **A run on another dual-CCD X3D part would be the most useful check:** `VICTORY_AB=20,VICTORY_CACHE_CORES` in a diagnostics build, standing still somewhere, then compare the `A/B phase` lines. ## Checks - `cargo test -p victory-gpu --lib cores`, with and without `diagnostics`: 3 passed (2 new tests with synthetic topologies for the table above). - `cargo clippy -p victory-gpu --lib --tests -- -D warnings`: no finding in the changed code. The ones it reports are already on `main` (for example `queue.rs:1277`, `texture.rs:2067`, and `victory-formats` `texture.rs:1346`, which stops the workspace run). - `cargo xtask policy`: 251 files ok. This change was made with AI assistance (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On a Ryzen with two core complexes of which one has the stacked cache
(7900X3D, 7950X3D, 9900X3D, 9950X3D) every core reports the same efficiency
class, so `fast_of` found no fast cores and no thread of ours asked for
any. Where the classes are alike and the last-level caches differ in size,
the sets on the largest one now count as the fast ones (at least eight of
them); processors with two kinds of cores still go by their class, and
those whose caches are all alike are left as they were. In diagnostics
builds `VICTORY_AB` can switch it while the title runs.

Measured on a 9950X3D + Radeon AI PRO R9700, diagnostics build,
VICTORY_AB=20,VICTORY_CACHE_CORES, 10 pairs of phases of matched draws
(within 15 %): median frame -1.3 % (noise), p90 -12.2 %, better in 8 of
10. In the steady part (about 3,900 draws) every phase with it had a lower
p90 (69-79 ms) than every phase without (81-86 ms).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 07:30:58 +00:00
Author
Owner

@⁠avatarmanz on GitHub · 2026-11-26 07:56 UTC · original

Merged into main in the next push (tests pass); thanks.

**@⁠avatarmanz** on GitHub · 2026-11-26 07:56 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/147#issuecomment-7186006712) Merged into main in the next push (tests pass); thanks.
github manually merged commit 4c3f311aa2 into main 2026-11-26 08:21:46 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.