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

Open
github-bot wants to merge 1 commit from github-bot/gh-603 into main AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-28 01:46 UTC · original
0xkn0wh3r3:cpu-v3-ccd-cores → main · +248 −11 · 5 files · 1 commits · open

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.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-28 01:46 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/603) `0xkn0wh3r3:cpu-v3-ccd-cores` → `main` · +248 −11 · 5 files · 1 commits · open ## 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.
The title needs AVX2 (it is built for the console's Zen 2), so our own
code may use what every such processor has. .cargo/config.toml now
targets x86-64-v3 (AVX2, BMI1/2, FMA, F16C, LZCNT, MOVBE) instead of
SSE2; RUSTFLAGS, when set, still takes its place. A processor without
AVX2 now stops with an illegal instruction before the launcher's own
check can say so.

VICTORY_CCD_CORES=1 (off by default while it is tested): where all cores
are of one class and there are two or more last-level caches (Ryzen
7900X, 7950X, 9900X, 9950X and their X3D parts), the threads that ask
for the fast cores keep to one complex: the one of the most sets, then
of the largest cache (the stacked one of an X3D). A handoff between
complexes takes about 180 ns on a 7900X, against about 20 ns inside one.
Hybrid Intel cores still go by their class, as before.

The threads that asked keep a handle open so that a diag build can flip
the switch while the title runs: VICTORY_AB=20,VICTORY_CCD_CORES.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 01:46:43 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/603/head:github-bot/gh-603'
git switch 'github-bot/gh-603'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-603'
git switch 'github-bot/gh-603'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-603'
git switch 'github-bot/gh-603'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-603'
git switch 'main'
git merge --squash 'github-bot/gh-603'
git switch 'main'
git merge --ff-only 'github-bot/gh-603'
git switch 'main'
git merge 'github-bot/gh-603'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.