Wide threads: the processor count is worked out once, not at every spread of work #3573
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!3573
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3573"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@tphira612 on GitHub · 2026-11-30 01:16 UTC · original
perf/wide-threads-once→main· +16 −7 · 1 files · 1 commits · closed without mergingWhat it changes
wide_threads()inshadow.rscached onlyVICTORY_WIDE_THREADS. Without it (the default), every call askedstd::thread::available_parallelism()again.queued,wide_eachandwide_each_scopedcall it one to three times per spread of work, on the submitting thread. On Windows that call asks the system for the process's affinity and job limits each time.The count is now worked out once in the
OnceLock. The value, the clamps and the switch are unchanged. The helper threads are started once with this count anyway.How it was tested
cargo test --locked -p victory-gpu --lib:shadow::wide_testspass. Two failures are not from this change:every_switch_of_the_translator_is_in_the_keyalso fails onmain, anda_change_is_saved_at_once_however_the_game_was_startedpasses when run alone.cargo build --release --locked -p victoryandcargo xtask policy --stagedpass. Clippy is clean invictory-gpu; it stops onvictory-shadererrors already onmain(fixed by #3560, #3530, #3385).wide_threads() cached only VICTORY_WIDE_THREADS; without it, every call asked std:🧵:available_parallelism() again, and queued, wide_each and wide_each_scoped call it one to three times per spread of work on the submitting thread. On Windows that call asks the system for the process's affinity and job limits: 862 to 998 ns a call on a Ryzen 9 5900X, 2 ns cached (200,000 calls a sample, release build). The helper threads are started once with this count, so a count that changed later would not match them anyway.Pull request closed