Build for x86-64-v3, and keep our threads on one core complex (VICTORY_CCD_CORES) #603

Open
0xkn0wh3r3 wants to merge 1 commit from upstream-pr/603 into main
0xkn0wh3r3 commented 2026-11-28 01:46:12 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 0xkn0wh3r3 on 2026-11-28T01:46:12Z.


Summary

  • x86-64-v3 build. .cargo/config.toml now builds the workspace for x86-64-v3 (AVX2, BMI1/2, FMA, F16C, LZCNT, MOVBE). Before this, the compiler kept to SSE2. The title already requires AVX2, since it is built for the console's Zen 2. RUSTFLAGS, when set, still overrides this. Trade-off: a CPU without AVX2 now stops with an illegal instruction before the launcher's own AVX2 check can explain why. This is noted in run.rs and the README requirements.
  • VICTORY_CCD_CORES=1 (opt-in, off by default while it is tested). The rule applies where all cores report one efficiency class and there are two or more last-level caches: Ryzen 7900X, 7950X, 9900X, 9950X and their X3D parts. On such chips, the threads that already ask for the fast cores (cores::keep_*_on_fast_cores) stay on one core complex. That is the complex with the most processor sets, then the largest cache (the stacked one on an X3D), then the lowest set id. Measured on a 7900X, a handoff between complexes takes about 180 ns, against about 20 ns inside one. Hybrid Intel cores still go by efficiency class, as before.
  • A/B in one run. Threads that ask keep a handle open, and cores::settle() re-places them when VICTORY_AB flips the switch (wired in queue::frame_ends). A diag build can compare both sides in the same scene with VICTORY_AB=20,VICTORY_CCD_CORES. With the switch off, behaviour is unchanged: on a multi-complex Ryzen the threads are told "any processor", which is what they had.

Testing

  • New unit tests cover:
    • a 7900X, an X3D with the stacked cache on the second complex, and complexes of unequal size;
    • a single complex, unknown caches, and complexes under 8 sets (these choose nothing);
    • a hybrid Intel layout, where efficiency class still decides.
  • A hardware test reads this machine's caches: on a 7900X it finds 24 sets and 2 L3 caches, and picks 12 sets.
  • cargo test --workspace --locked passes, except indirect::tests::host_list_budget_starts_empty_at_each_submission and warp_batch_charges_every_execution. Both already fail on main (see #578).
  • cargo clippy with -D warnings reports nothing in the changed files. main itself does not pass clippy at the moment: victory-formats, victory-loader and victory-gpu have existing lints.
  • Not measured in-game. To compare, run a diag build with VICTORY_AB=20,VICTORY_CCD_CORES. For v3, compare against a build made with RUSTFLAGS="" in the same scene.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5535498479 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/603). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-28T01:46:12Z. --- ## Summary - **x86-64-v3 build.** `.cargo/config.toml` now builds the workspace for `x86-64-v3` (AVX2, BMI1/2, FMA, F16C, LZCNT, MOVBE). Before this, the compiler kept to SSE2. The title already requires AVX2, since it is built for the console's Zen 2. `RUSTFLAGS`, when set, still overrides this. Trade-off: a CPU without AVX2 now stops with an illegal instruction before the launcher's own AVX2 check can explain why. This is noted in `run.rs` and the README requirements. - **`VICTORY_CCD_CORES=1`** (opt-in, off by default while it is tested). The rule applies where all cores report one efficiency class and there are two or more last-level caches: Ryzen 7900X, 7950X, 9900X, 9950X and their X3D parts. On such chips, the threads that already ask for the fast cores (`cores::keep_*_on_fast_cores`) stay on one core complex. That is the complex with the most processor sets, then the largest cache (the stacked one on an X3D), then the lowest set id. Measured on a 7900X, a handoff between complexes takes about 180 ns, against about 20 ns inside one. Hybrid Intel cores still go by efficiency class, as before. - **A/B in one run.** Threads that ask keep a handle open, and `cores::settle()` re-places them when `VICTORY_AB` flips the switch (wired in `queue::frame_ends`). A `diag` build can compare both sides in the same scene with `VICTORY_AB=20,VICTORY_CCD_CORES`. With the switch off, behaviour is unchanged: on a multi-complex Ryzen the threads are told "any processor", which is what they had. ## Testing - New unit tests cover: - a 7900X, an X3D with the stacked cache on the second complex, and complexes of unequal size; - a single complex, unknown caches, and complexes under 8 sets (these choose nothing); - a hybrid Intel layout, where efficiency class still decides. - A hardware test reads this machine's caches: on a 7900X it finds 24 sets and 2 L3 caches, and picks 12 sets. - `cargo test --workspace --locked` passes, except `indirect::tests::host_list_budget_starts_empty_at_each_submission` and `warp_batch_charges_every_execution`. Both already fail on `main` (see #578). - `cargo clippy` with `-D warnings` reports nothing in the changed files. `main` itself does not pass clippy at the moment: `victory-formats`, `victory-loader` and `victory-gpu` have existing lints. - **Not measured in-game.** To compare, run a `diag` build with `VICTORY_AB=20,VICTORY_CCD_CORES`. For v3, compare against a build made with `RUSTFLAGS=""` in the same scene.
JohnTitor2003 commented 2026-11-28 16:46:15 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by JohnTitor2003 on 2026-11-28T16:46:15Z.


A first test report on a 7950X, by the in-run A/B this PR wires up. Short version: the switch places the threads as described, and I can't measure a gain from it here; if anything the mean frame is about 1 ms longer with it on.

Setup: this PR's commit (d464621) cherry-picked onto v2026.11.28.03 (f4608f0), no other changes, diag profile, so both sides are the x86-64-v3 build. Ryzen 9 7950X (16 cores, 32 threads, two complexes), RTX 5080 16 GB, 32 GB DDR5-6000, Windows 11. Series S, DLSS Performance (540), frame generation off, no frame cap, launcher defaults otherwise. VICTORY_AB=20,VICTORY_CCD_CORES, open-world free roam on foot and by car, 27 phases of 20 s in the world (14 off, 13 on), 5,000 to 10,500 draws a frame.

The switch does what it says. The unit test here prints "32 sets, 2 last-level caches, one complex: 16 sets". In the run, our threads' processors (VICTORY_CCD_CORES) alternates fast=16 of=32 threads=16 and fast=0 of=32 threads=16 at each phase.

The frame:

off on
phase mean frame time 40.0 ms at 6,523 draws 41.9 ms at 6,790 draws
submitting thread in its submissions 37.9 ms 36.8 ms
of that, refreshes 14.6 ms 14.9 ms
  • Adjacent off/on phases within 10% in draws: 7 pairs, on faster in 2, mean difference +1.8 ms (range -0.5 to +4.4).
  • A straight fit over the 27 phases (frame time against draws and the switch): mean frame time +1.2 ms with the switch on (standard error 0.4); median frame time +0.2 (0.9); 90th percentile -0.1 (1.4).

So on this PC keeping the 16 asking threads on one complex does not shorten the frame. A guess at why, not measured: with VICTORY_FAST_CORES=2 the list translators and the title's own threads still use both complexes, so the frame's hand-offs to and from them cross either way, and 16 of our threads now share 16 logical processors with whatever of the title's lands there.

No crash. One error line in the log, from Streamline at load-in ("presentCommon() was not observed"), with frame generation off. Caveats: one run of about nine minutes, free roam and not a fixed route.

Tested and written with an AI assistant (Claude Code); the run was on my machine. No game files attached.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7242498426 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/603#issuecomment-7242498426). Originally posted by [JohnTitor2003](https://github.com/JohnTitor2003) on 2026-11-28T16:46:15Z. --- A first test report on a 7950X, by the in-run A/B this PR wires up. Short version: the switch places the threads as described, and I can't measure a gain from it here; if anything the mean frame is about 1 ms longer with it on. **Setup:** this PR's commit (d464621) cherry-picked onto v2026.11.28.03 (f4608f0), no other changes, diag profile, so both sides are the x86-64-v3 build. Ryzen 9 7950X (16 cores, 32 threads, two complexes), RTX 5080 16 GB, 32 GB DDR5-6000, Windows 11. Series S, DLSS Performance (540), frame generation off, no frame cap, launcher defaults otherwise. `VICTORY_AB=20,VICTORY_CCD_CORES`, open-world free roam on foot and by car, 27 phases of 20 s in the world (14 off, 13 on), 5,000 to 10,500 draws a frame. **The switch does what it says.** The unit test here prints "32 sets, 2 last-level caches, one complex: 16 sets". In the run, `our threads' processors (VICTORY_CCD_CORES)` alternates `fast=16 of=32 threads=16` and `fast=0 of=32 threads=16` at each phase. **The frame:** | | off | on | |---|---|---| | phase mean frame time | 40.0 ms at 6,523 draws | 41.9 ms at 6,790 draws | | submitting thread in its submissions | 37.9 ms | 36.8 ms | | of that, refreshes | 14.6 ms | 14.9 ms | - Adjacent off/on phases within 10% in draws: 7 pairs, on faster in 2, mean difference +1.8 ms (range -0.5 to +4.4). - A straight fit over the 27 phases (frame time against draws and the switch): mean frame time +1.2 ms with the switch on (standard error 0.4); median frame time +0.2 (0.9); 90th percentile -0.1 (1.4). So on this PC keeping the 16 asking threads on one complex does not shorten the frame. A guess at why, not measured: with `VICTORY_FAST_CORES=2` the list translators and the title's own threads still use both complexes, so the frame's hand-offs to and from them cross either way, and 16 of our threads now share 16 logical processors with whatever of the title's lands there. No crash. One error line in the log, from Streamline at load-in ("presentCommon() was not observed"), with frame generation off. Caveats: one run of about nine minutes, free roam and not a fixed route. Tested and written with an AI assistant (Claude Code); the run was on my machine. No game files attached.
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/603:upstream-pr/603'
git switch 'upstream-pr/603'

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/603'
git switch 'upstream-pr/603'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/603'
git switch 'upstream-pr/603'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/603'
git switch 'main'
git merge --squash 'upstream-pr/603'
git switch 'main'
git merge --ff-only 'upstream-pr/603'
git switch 'main'
git merge 'upstream-pr/603'
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!603
No description provided.