perf(gpu): shard RETIRED resource queue 16-way and add VICTORY_WIDE_THREADS #139

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

@⁠dcastell1 on GitHub · 2026-11-27 18:42 UTC · original
dcastell1:perf/sharded-retired-wide-threads → main · +55 −13 · 2 files · 1 commits · open

Summary

  1. Shard RETIRED 16-way (crates/victory-gpu/src/host.rs):

    • retire_resource and retire previously pushed ~20,000 items per frame across recording, descriptor-sync, and submitting threads onto a single global Mutex<VecDeque<(u64, Retired)>> (noted as ~2.9% of submitting-thread wall-time mutex contention in #57's samply profile).
    • Replaces the single lock with 16 round-robin thread-indexed Mutex<VecDeque<(u64, Retired)>> shards. Within each thread's shard, started timestamps arrive monotonically; bury(finished) drains all 16 shards and drops retired COM objects outside the locks, preserving identical bury_lag lifetime semantics.
  2. Cache wide_threads() and expose VICTORY_WIDE_THREADS (crates/victory-gpu/src/shadow.rs):

    • wide_threads() was queried on every wide() invocation (~95 calls/frame) and hard-clamped to 2..=6.
    • Caches the result in a OnceLock (preserving the existing 2..=6 default when unset) and honours VICTORY_WIDE_THREADS (1..=16) so high-core CPUs (for example 16 P-core logical processors on i9-12900K/13900K/14900K or 16-core Ryzen) can widen parallel refresh batches without oversubscribing.

Verification

  • Hardware: Windows 11 (build 26300), i9-12900K (8P+8E / 24 threads), 64 GB RAM, GeForce RTX 5090 32 GB (driver 621.40), Series X profile, --res 4k --dlss quality --framegen 4.
  • cargo test --locked -p victory-gpu --lib wide_threads_tests: 1 passed, 0 failed.
  • cargo test --locked -p xtask: 6 passed, 0 failed (asset policy green).

Note: Made with AI assistance and reviewed, built, and tested by a human.

**@⁠dcastell1** on GitHub · 2026-11-27 18:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/139) `dcastell1:perf/sharded-retired-wide-threads` → `main` · +55 −13 · 2 files · 1 commits · open ## Summary 1. **Shard `RETIRED` 16-way (`crates/victory-gpu/src/host.rs`):** - `retire_resource` and `retire` previously pushed ~20,000 items per frame across recording, descriptor-sync, and submitting threads onto a single global `Mutex<VecDeque<(u64, Retired)>>` (noted as ~2.9% of submitting-thread wall-time mutex contention in #57's `samply` profile). - Replaces the single lock with 16 round-robin thread-indexed `Mutex<VecDeque<(u64, Retired)>>` shards. Within each thread's shard, `started` timestamps arrive monotonically; `bury(finished)` drains all 16 shards and drops retired COM objects outside the locks, preserving identical `bury_lag` lifetime semantics. 2. **Cache `wide_threads()` and expose `VICTORY_WIDE_THREADS` (`crates/victory-gpu/src/shadow.rs`):** - `wide_threads()` was queried on every `wide()` invocation (~95 calls/frame) and hard-clamped to `2..=6`. - Caches the result in a `OnceLock` (preserving the existing `2..=6` default when unset) and honours `VICTORY_WIDE_THREADS` (`1..=16`) so high-core CPUs (for example 16 P-core logical processors on i9-12900K/13900K/14900K or 16-core Ryzen) can widen parallel refresh batches without oversubscribing. ## Verification - Hardware: Windows 11 (build 26300), i9-12900K (8P+8E / 24 threads), 64 GB RAM, GeForce RTX 5090 32 GB (driver 621.40), Series X profile, `--res 4k --dlss quality --framegen 4`. - `cargo test --locked -p victory-gpu --lib wide_threads_tests`: **1 passed, 0 failed**. - `cargo test --locked -p xtask`: **6 passed, 0 failed** (asset policy green). --- *Note: Made with AI assistance and reviewed, built, and tested by a human.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 18:46:25 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/shadow.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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