perf: scale shadow, pipeline, and DirectStorage worker counts with CPU cores #49

Open
fever308 wants to merge 1 commit from upstream-pr/49 into main
fever308 commented 2026-11-24 20:54:47 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by fever308 on 2026-11-24T20:54:47Z.


Summary

crates/
├── victory-gpu/src/
│   ├── shadow.rs         # copy_wide_max_jobs = clamp(cores / 2, 1, 8); wide_worker_count = clamp(cores / 4, 1, 8)
│   └── pipeline/make.rs  # pipeline_worker_count = clamp(cores / 2, 2, 12)
└── victory-hle/src/
    └── modules/dstorage.rs  # dstorage_worker_count = clamp(cores, 2, 16)

Evidence

  • Before: copy_wide capped at 6 threads on all hosts, wide workers clamped to 2..=6, host pipeline workers clamped to 2..=8, and DirectStorage spawned one worker per logical core with no upper cap.
    After:
    • cargo test -p victory-gpu worker_count_scales_with_cores + copy_wide_max_jobs_scales_with_cores: passed.
    • cargo test -p victory-hle dstorage_worker_count_scales_with_cores: 1 passed.
    • cargo clippy (--all-targets -- -D warnings, default and --all-features) on victory-gpu and victory-hle: clean.

Merge Danger

Door: two-way

Pure worker-count formulas evaluated once on first pool initialization.

Blast Radius: Workers

Changes background thread counts for shadow memory copies, host pipeline compilation, and DirectStorage decompression across low- and high-core hosts.

<!-- greyfinch-sync:fxceless/victory-fork:issue:5480164811 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/49). Originally posted by [fever308](https://github.com/fever308) on 2026-11-24T20:54:47Z. --- ## Summary ```text crates/ ├── victory-gpu/src/ │ ├── shadow.rs # copy_wide_max_jobs = clamp(cores / 2, 1, 8); wide_worker_count = clamp(cores / 4, 1, 8) │ └── pipeline/make.rs # pipeline_worker_count = clamp(cores / 2, 2, 12) └── victory-hle/src/ └── modules/dstorage.rs # dstorage_worker_count = clamp(cores, 2, 16) ``` ## Evidence - **Before:** `copy_wide` capped at 6 threads on all hosts, `wide` workers clamped to `2..=6`, host pipeline workers clamped to `2..=8`, and DirectStorage spawned one worker per logical core with no upper cap. **After:** - `cargo test -p victory-gpu worker_count_scales_with_cores` + `copy_wide_max_jobs_scales_with_cores`: passed. - `cargo test -p victory-hle dstorage_worker_count_scales_with_cores`: 1 passed. - `cargo clippy` (`--all-targets -- -D warnings`, default and `--all-features`) on `victory-gpu` and `victory-hle`: clean. ## Merge Danger **Door:** two-way Pure worker-count formulas evaluated once on first pool initialization. **Blast Radius:** Workers Changes background thread counts for shadow memory copies, host pipeline compilation, and DirectStorage decompression across low- and high-core hosts.
Headache3318 commented 2026-11-25 05:08:58 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Headache3318 on 2026-11-25T04:14:15Z.


Corpus count at current main (c96b4f2). Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted. Results: 26,084/26,084 programs translated to IR (100%). 25,598/25,694 known-type programs emitted DXIL (96 not emitted). 8,015/25,598 emitted programs passed validation (31.3%). 17,873 total errors across 27 error classes. Top error: Pipeline State Validation mismatch (17,367 = 97% of all errors). By type: compute 100% pass (2,672/2,672), mesh 30.2% (2,649/8,762), vertex+pixel 19.0% (2,694/14,164). Required installing dxil.dll from Microsoft.Direct3D.DXC NuGet into Wine prefix to enable --validate.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7152657467 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/49#issuecomment-7152657467). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-25T04:14:15Z. --- Corpus count at current main (c96b4f2). Machine: Arch Linux, kernel 7.3.5-arch1-1, 3x RTX 4090 driver 620.73.04, Proton, AI-assisted. Results: 26,084/26,084 programs translated to IR (100%). 25,598/25,694 known-type programs emitted DXIL (96 not emitted). 8,015/25,598 emitted programs passed validation (31.3%). 17,873 total errors across 27 error classes. Top error: Pipeline State Validation mismatch (17,367 = 97% of all errors). By type: compute 100% pass (2,672/2,672), mesh 30.2% (2,649/8,762), vertex+pixel 19.0% (2,694/14,164). Required installing dxil.dll from Microsoft.Direct3D.DXC NuGet into Wine prefix to enable --validate.
fever308 commented 2026-11-25 05:08:59 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by fever308 on 2026-11-25T04:17:09Z.


Thanks for sharing the baseline numbers, @Headache3318! Just a quick heads-up that this PR is for scaling CPU worker counts (shadow / pipeline / DirectStorage), not shader translation/validation — in case you meant to post the corpus report on a shader or corpus tracking issue.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7152702925 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/49#issuecomment-7152702925). Originally posted by [fever308](https://github.com/fever308) on 2026-11-25T04:17:09Z. --- Thanks for sharing the baseline numbers, `@Headache3318`! Just a quick heads-up that this PR is for scaling CPU worker counts (shadow / pipeline / DirectStorage), not shader translation/validation — in case you meant to post the corpus report on a shader or corpus tracking issue.
Headache3318 commented 2026-11-30 12:41:23 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Headache3318 on 2026-11-30T12:41:23Z.


Fair — taken. The corpus numbers were posted here as the baseline the DirectStorage worker counts run against, but you are right that the measurements themselves are of the translator, not of this PR's change, so they do not belong as evidence on this thread. The full report with the environment line already lives on the testers' tracker (Marvisak/VIctory#49, same machine, same build lineage), so nothing is lost — happy for this comment to be treated as off-topic context, and future corpus counts from this box go to the tracker only.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7278786884 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/49#issuecomment-7278786884). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-30T12:41:23Z. --- Fair — taken. The corpus numbers were posted here as the baseline the DirectStorage worker counts run against, but you are right that the measurements themselves are of the translator, not of this PR's change, so they do not belong as evidence on this thread. The full report with the environment line already lives on the testers' tracker (Marvisak/VIctory#49, same machine, same build lineage), so nothing is lost — happy for this comment to be treated as off-topic context, and future corpus counts from this box go to the tracker only.
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/49:upstream-pr/49'
git switch 'upstream-pr/49'

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