cores: place VIctory's threads off the title's CCD on two-CCD Ryzens (VICTORY_CCD, off by default) #398

Closed
github-bot wants to merge 1 commit from gh-pr/398/head into gh-pr/398/base
Owner

@⁠motioncsgo on GitHub · 2026-11-26 23:30 UTC · original
motioncsgo:ccd-placement → main · +252 −12 · 2 files · 1 commits · closed without merging

Off by default. Adds placement for CPUs with two or more equal last-level caches (Ryzen 5900X/5950X, 7900X/7950X, 9900X/9950X, Zen 2 3000 series). Today cores.rs places our threads only on hybrid CPUs and X3D parts. On a symmetric two-CCD Ryzen, every VIctory thread floats over both CCDs, while the title pins its own threads to logical CPUs 0–15 (it imports SetThreadGroupAffinity, bound to the host). On a 5950X that is all of CCD0.

What changes

  • cores.rs reads which last-level cache each CPU set belongs to (l3_domain_of_sets, the lowest logical processor under that cache). Where there are two or more caches of one size and neither class nor cache size already picks "fast" cores, VICTORY_CCD decides (ccd_split):
    • far (or 1): our placed threads (submit, relay, land, aside, heap sync, views and the victory-list translators) prefer the caches without CPU 0, so the title has its CCD to itself.
    • near: the critical threads (stages 1–2) stay beside the title; only the list translators (stage 3) move away.
    • unset or 0: as before.
  • Stage-3 threads also register when VICTORY_CCD can be on (they don't by default with VICTORY_FAST_CORES=2).
  • VICTORY_LANE_CORE=1 now takes effect on these CPUs too: the submit thread is registered, and on a 5950X it gets CPUs 30–31.
  • Diagnostics: VICTORY_AB=<s>,VICTORY_CCD switches it live (queue.rs settles again on a phase change, as for VICTORY_CACHE_CORES/VICTORY_LANE_CORE). VICTORY_CCD_MODE=near picks near for the on phases.
  • Hybrid CPUs and X3D (fast_by_class, fast_by_cache) behave exactly as before; ccd_split returns None there.
  • Tests: the split for 5950X / 5900X / 3950X layouts; None for one complex (9800X3D), X3D, hybrid and unknown domains; mode parsing; this machine's domains.

Measurements

Ryzen 9 5950X, RX 7900 XTX (32.0.32015.12012), 64 GB DDR4, Windows 11 26200. Diag build of Belobug a-publier cd8dfc06 (= this repo's c9c932c + 3) with this patch. play.ps1 defaults + renderer ports 1, 2, 5, 6 and 7 + VICTORY_FETCH_CHECK=1, Series X 2560×1440 → 3840×2160, RT off. New story from the same save state, prologue cell, no input. Pipelines warmed for the ports variant.

Same-scene A/B, VICTORY_AB=20,VICTORY_CCD,VICTORY_LANE_CORE, 23 phases of 20 s in the world (~400 frames each), each compared with its neighbouring baseline phases:

combination mean frame p90 vs baseline (paired) faster in
baseline 49.4 ms (20.2 fps) 53.3 ms — —
VICTORY_CCD=far 47.6 ms (21.0 fps) 51.3 ms −3.0% (−1.1 … −4.4) 6 of 6
VICTORY_LANE_CORE=1 48.2 ms (20.7 fps) 53.2 ms −1.7% (+1.1 … −3.0) 5 of 6
both 47.0 ms (21.3 fps) 51.0 ms −4.4% (−3.1 … −5.3) 5 of 5
  • CCD0 load: 11.5 → 7.2–7.6 cores; process CPU: 17.5 → 16.6–16.9 cores (about −8% CPU time per frame). GPU stays at 75–78% busy.
  • Why it helps now: with the renderer ports on, a VICTORY_TIMELINE capture puts ~25 ms of the ~47 ms critical chain on the title's own thread ("outside our spans"). That thread shared its CCD0 cores with our helpers (8 victory-list threads at ~34 ms CPU each per frame).
  • Without the ports, placement made no frame-time difference (the submit thread was the limit), only CPU time. A whole-process CCD0 affinity was the same speed with ~3.6 fewer cores busy.

Not verified

  • One machine, one scene. 12-core parts (6 cores per CCD; the title's CPUs 0–15 span both CCDs) and Zen 2 are untested. Results from those would be welcome.
  • near is implemented but not measured.
  • On this branch the cores:: unit tests pass with and without diagnostics. cargo clippy -p victory-gpu --all-targets --all-features -- -D warnings reports nothing in cores.rs or queue.rs; its existing failures elsewhere on main (panel.rs, place.rs, rtstamps.rs, list.rs, texture.rs, watch.rs; see #280) are unchanged. The game A/B was run on the Belobug base named above, not on this exact head.

To try it: VICTORY_CCD=far (+ VICTORY_LANE_CORE=1), or VICTORY_AB=20,VICTORY_CCD,VICTORY_LANE_CORE in a diagnostics build and compare the A/B phase lines.

🤖 Generated with Claude Code

**@⁠motioncsgo** on GitHub · 2026-11-26 23:30 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/398) `motioncsgo:ccd-placement` → `main` · +252 −12 · 2 files · 1 commits · closed without merging Off by default. Adds placement for CPUs with two or more equal last-level caches (Ryzen 5900X/5950X, 7900X/7950X, 9900X/9950X, Zen 2 3000 series). Today `cores.rs` places our threads only on hybrid CPUs and X3D parts. On a symmetric two-CCD Ryzen, every VIctory thread floats over both CCDs, while the title pins its own threads to logical CPUs 0–15 (it imports `SetThreadGroupAffinity`, bound to the host). On a 5950X that is all of CCD0. ## What changes - `cores.rs` reads which last-level cache each CPU set belongs to (`l3_domain_of_sets`, the lowest logical processor under that cache). Where there are two or more caches of one size and neither class nor cache size already picks "fast" cores, `VICTORY_CCD` decides (`ccd_split`): - `far` (or `1`): our placed threads (submit, relay, land, aside, heap sync, views and the `victory-list` translators) prefer the caches **without** CPU 0, so the title has its CCD to itself. - `near`: the critical threads (stages 1–2) stay beside the title; only the list translators (stage 3) move away. - unset or `0`: as before. - Stage-3 threads also register when `VICTORY_CCD` can be on (they don't by default with `VICTORY_FAST_CORES=2`). - `VICTORY_LANE_CORE=1` now takes effect on these CPUs too: the submit thread is registered, and on a 5950X it gets CPUs 30–31. - Diagnostics: `VICTORY_AB=<s>,VICTORY_CCD` switches it live (`queue.rs` settles again on a phase change, as for `VICTORY_CACHE_CORES`/`VICTORY_LANE_CORE`). `VICTORY_CCD_MODE=near` picks near for the on phases. - Hybrid CPUs and X3D (`fast_by_class`, `fast_by_cache`) behave exactly as before; `ccd_split` returns `None` there. - Tests: the split for 5950X / 5900X / 3950X layouts; `None` for one complex (9800X3D), X3D, hybrid and unknown domains; mode parsing; this machine's domains. ## Measurements Ryzen 9 5950X, RX 7900 XTX (32.0.32015.12012), 64 GB DDR4, Windows 11 26200. Diag build of Belobug `a-publier` `cd8dfc06` (= this repo's `c9c932c` + 3) with this patch. `play.ps1` defaults + renderer ports 1, 2, 5, 6 and 7 + `VICTORY_FETCH_CHECK=1`, Series X 2560×1440 → 3840×2160, RT off. New story from the same save state, prologue cell, no input. Pipelines warmed for the ports variant. Same-scene A/B, `VICTORY_AB=20,VICTORY_CCD,VICTORY_LANE_CORE`, 23 phases of 20 s in the world (~400 frames each), each compared with its neighbouring baseline phases: | combination | mean frame | p90 | vs baseline (paired) | faster in | |---|---|---|---|---| | baseline | 49.4 ms (20.2 fps) | 53.3 ms | — | — | | `VICTORY_CCD=far` | 47.6 ms (21.0 fps) | 51.3 ms | −3.0% (−1.1 … −4.4) | 6 of 6 | | `VICTORY_LANE_CORE=1` | 48.2 ms (20.7 fps) | 53.2 ms | −1.7% (+1.1 … −3.0) | 5 of 6 | | both | 47.0 ms (21.3 fps) | 51.0 ms | **−4.4%** (−3.1 … −5.3) | 5 of 5 | - CCD0 load: 11.5 → 7.2–7.6 cores; process CPU: 17.5 → 16.6–16.9 cores (about −8% CPU time per frame). GPU stays at 75–78% busy. - Why it helps now: with the renderer ports on, a `VICTORY_TIMELINE` capture puts ~25 ms of the ~47 ms critical chain on the title's own thread ("outside our spans"). That thread shared its CCD0 cores with our helpers (8 `victory-list` threads at ~34 ms CPU each per frame). - Without the ports, placement made no frame-time difference (the submit thread was the limit), only CPU time. A whole-process CCD0 affinity was the same speed with ~3.6 fewer cores busy. ## Not verified - One machine, one scene. 12-core parts (6 cores per CCD; the title's CPUs 0–15 span both CCDs) and Zen 2 are untested. Results from those would be welcome. - `near` is implemented but not measured. - On this branch the `cores::` unit tests pass with and without `diagnostics`. `cargo clippy -p victory-gpu --all-targets --all-features -- -D warnings` reports nothing in `cores.rs` or `queue.rs`; its existing failures elsewhere on `main` (panel.rs, place.rs, rtstamps.rs, list.rs, texture.rs, watch.rs; see #280) are unchanged. The game A/B was run on the Belobug base named above, not on this exact head. To try it: `VICTORY_CCD=far` (+ `VICTORY_LANE_CORE=1`), or `VICTORY_AB=20,VICTORY_CCD,VICTORY_LANE_CORE` in a diagnostics build and compare the `A/B phase` lines. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:56:36 +00:00
github-bot closed this pull request 2026-11-27 00:56:36 +00:00
Author
Owner

@⁠motioncsgo on GitHub · 2026-11-26 23:34 UTC · original

Closing in favour of #399, which has the same change as an inline patch (git am), so I don't have to keep a fork around. Thanks!

**@⁠motioncsgo** on GitHub · 2026-11-26 23:34 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/398#issuecomment-7205655245) Closing in favour of https://git.gtahub.st/github/avatarmanz--VIctory-7900XTX/issues/399, which has the same change as an inline patch (`git am`), so I don't have to keep a fork around. Thanks!

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.