gpu(cores): add VICTORY_OWN_CPUS to pin emulator threads off title cache domain #202

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

@⁠Androtim on GitHub · 2026-11-30 05:29 UTC · original
Androtim:feat/iter199-cores-own-cpus → main · +76 −5 · 1 files · 1 commits · closed without merging

Summary

  • Add VICTORY_OWN_CPUS support (auto or <first>-<last>) in victory-gpu/src/cores.rs to pin emulator threads onto secondary cache domains or an explicit logical-processor range and set the process default CPU set, leaving the title's primary cache domain uncontended on dual-CCD systems where VICTORY_FAST_CORES sees a single efficiency class.
  • Add own_cpus_auto_is_the_other_cache_and_a_range_is_by_number unit test covering auto, explicit ranges, inverted ranges, and invalid inputs.

Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib cores:: -- --test-threads=1
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings
**@⁠Androtim** on GitHub · 2026-11-30 05:29 UTC · [original](https://github.com/Androtim/MiniVI/pull/202) `Androtim:feat/iter199-cores-own-cpus` → `main` · +76 −5 · 1 files · 1 commits · closed without merging ## Summary - Add `VICTORY_OWN_CPUS` support (`auto` or `<first>-<last>`) in `victory-gpu/src/cores.rs` to pin emulator threads onto secondary cache domains or an explicit logical-processor range and set the process default CPU set, leaving the title's primary cache domain uncontended on dual-CCD systems where `VICTORY_FAST_CORES` sees a single efficiency class. - Add `own_cpus_auto_is_the_other_cache_and_a_range_is_by_number` unit test covering `auto`, explicit ranges, inverted ranges, and invalid inputs. ## Verification - `cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib cores:: -- --test-threads=1` - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings` - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:18:02 +00:00
github-bot closed this pull request 2026-12-01 20:18:02 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-11-30 07:33 UTC · original

CI check is failing (FAILURE); marking triage: needs work so it can be fixed before GPU testing.

**@⁠Androtim** on GitHub · 2026-11-30 07:33 UTC · [original](https://github.com/Androtim/MiniVI/pull/202#issuecomment-7271868918) CI check is failing (`FAILURE`); marking `triage: needs work` so it can be fixed before GPU testing.
Author
Owner

@⁠Androtim on GitHub · 2026-11-30 11:03 UTC · original

Automated triage for the maintainers (not an approval).

Verdict: needs-work · CI (check): failing

Review Summary

PR #202 adds opt-in VICTORY_OWN_CPUS (auto or <first>-<last>) support in crates/victory-gpu/src/cores.rs, refactoring cpu_sets() onto group0_cpu_sets(), adding own_cpus(), chosen_of(), and cpu_logical(), wiring own_cpus() into ask(), and adding unit test own_cpus_auto_is_the_other_cache_and_a_range_is_by_number. The feature is opt-in (off when VICTORY_OWN_CPUS is unset) and does not alter default behavior.

Findings

  1. CI is failing: The PR currently has failing CI checks that need to be resolved.
  2. Malformed VICTORY_OWN_CPUS values are silently ignored: In own_cpus(), let chosen = chosen_of(asked, &all)?; returns None without logging when asked fails to parse (e.g., typos, inverted ranges, or a single CPU index), whereas empty or all-CPU matches emit a tracing::warn!. Invalid values should also emit a warning for consistency.
  3. Process-wide SetProcessDefaultCpuSets scope & stage() bypass:
    • own_cpus() calls SetProcessDefaultCpuSets(GetCurrentProcess(), ...) lazily on the first ask() call, which constrains all threads in the process lacking an explicit affinity/CPU set (not only emulator threads, if any title or driver threads run without explicit affinity).
    • In ask(), the if let Some(own) = own_cpus() branch returns before if stage() < from, so VICTORY_OWN_CPUS applies to all keep_*_on_fast_cores callers regardless of VICTORY_FAST_CORES.
  4. Minor cleanup:
    • own_cpus() can return Option<&'static [u32]> via .as_deref() instead of Option<&'static Vec<u32>>.
    • In Priority::keep(), the modified // SAFETY: comment cites self.applied != Some(on) rather than the actual Win32 safety invariant (calling SetThreadPriority on GetCurrentThread() with a valid priority constant).

To change the verdict:

  • Investigate and fix the failing CI check(s).
  • Log a tracing::warn! in own_cpus() when VICTORY_OWN_CPUS is set but chosen_of() returns None (invalid syntax / inverted range).
  • Clarify or tighten the SetProcessDefaultCpuSets / stage() interaction (and optionally simplify own_cpus() return type to Option<&'static [u32]> and restore/fix the Priority::keep safety comment).

Generated with Antigravity CLI (agy).

**@⁠Androtim** on GitHub · 2026-11-30 11:03 UTC · [original](https://github.com/Androtim/MiniVI/pull/202#issuecomment-7276469373) <!-- minivi-triage v1 head=06a6236273cc2395e36266f445c75c120809341f verdict=needs-work ci=failing at=2026-11-30T11:03:51Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-work` · **CI (`check`):** `failing` ### Review Summary PR #202 adds opt-in `VICTORY_OWN_CPUS` (`auto` or `<first>-<last>`) support in `crates/victory-gpu/src/cores.rs`, refactoring `cpu_sets()` onto `group0_cpu_sets()`, adding `own_cpus()`, `chosen_of()`, and `cpu_logical()`, wiring `own_cpus()` into `ask()`, and adding unit test `own_cpus_auto_is_the_other_cache_and_a_range_is_by_number`. The feature is opt-in (off when `VICTORY_OWN_CPUS` is unset) and does not alter default behavior. ### Findings 1. **CI is failing**: The PR currently has failing CI checks that need to be resolved. 2. **Malformed `VICTORY_OWN_CPUS` values are silently ignored**: In `own_cpus()`, `let chosen = chosen_of(asked, &all)?;` returns `None` without logging when `asked` fails to parse (e.g., typos, inverted ranges, or a single CPU index), whereas empty or all-CPU matches emit a `tracing::warn!`. Invalid values should also emit a warning for consistency. 3. **Process-wide `SetProcessDefaultCpuSets` scope & `stage()` bypass**: - `own_cpus()` calls `SetProcessDefaultCpuSets(GetCurrentProcess(), ...)` lazily on the first `ask()` call, which constrains *all* threads in the process lacking an explicit affinity/CPU set (not only emulator threads, if any title or driver threads run without explicit affinity). - In `ask()`, the `if let Some(own) = own_cpus()` branch returns before `if stage() < from`, so `VICTORY_OWN_CPUS` applies to all `keep_*_on_fast_cores` callers regardless of `VICTORY_FAST_CORES`. 4. **Minor cleanup**: - `own_cpus()` can return `Option<&'static [u32]>` via `.as_deref()` instead of `Option<&'static Vec<u32>>`. - In `Priority::keep()`, the modified `// SAFETY:` comment cites `self.applied != Some(on)` rather than the actual Win32 safety invariant (calling `SetThreadPriority` on `GetCurrentThread()` with a valid priority constant). ### To change the verdict: - Investigate and fix the failing CI check(s). - Log a `tracing::warn!` in `own_cpus()` when `VICTORY_OWN_CPUS` is set but `chosen_of()` returns `None` (invalid syntax / inverted range). - Clarify or tighten the `SetProcessDefaultCpuSets` / `stage()` interaction (and optionally simplify `own_cpus()` return type to `Option<&'static [u32]>` and restore/fix the `Priority::keep` safety comment). --- _Generated with Antigravity CLI (`agy`)._
Author
Owner

@⁠Androtim on GitHub · 2026-12-01 01:38 UTC · original

Closing conflicting opt-in VICTORY_* toggle PR per #276 policy (replace flawed base paths with default-on replacements rather than stacking opt-in toggles).

**@⁠Androtim** on GitHub · 2026-12-01 01:38 UTC · [original](https://github.com/Androtim/MiniVI/pull/202#issuecomment-7297726139) Closing conflicting opt-in VICTORY_* toggle PR per #276 policy (replace flawed base paths with default-on replacements rather than stacking opt-in toggles).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI!202
No description provided.