perf(cpu): pin GPU and host threads to P-cores and optional disk I/O to E-cores #15
No reviewers
Labels
No labels
accessibility
bench-bm-v1
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/PastiiJay--klbf-lab!15
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-15"
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?
@Vladimir-Human on GitHub · 2026-11-25 16:32 UTC · original
Vladimir-Human:perf/hybrid-cpu-affinity→beta· +480 −0 · 4 files · 1 commits · openPin performance-critical GPU frame threads to performance cores (
EfficiencyClassmax) on hybrid CPUs and optionally move DirectStorage worker threads onto efficiency cores (VICTORY_DISK_CORES=slow).What is in it
crates/victory-gpu/src/affinity.rs+crates/victory-gpu/src/lib.rs:OnceLock-cachedGetSystemCpuSetInformationtopology probe (partition_cpu_sets), logging fast/slow logical processor counts once and remaining a complete no-op on uniform (non-hybrid) CPUs or non-Windows platforms.SetThreadSelectedCpuSetssoft scheduler preference helpers:keep_on_fast_cores(default on when hybrid cores exist; opt-outVICTORY_FAST_CORES=0) andkeep_on_slow_cores(opt-inVICTORY_DISK_CORES=slow).Cargo.tomlandCargo.lockuntouched for--lockedbuilds).crates/victory-gpu/src/host.rs: pinsvictory-late-wait,victory-relay, and the synchronous caller ofHost::submit(one-shotthread_local!) to fast cores.crates/victory-hle/src/modules/dstorage.rs: callskeep_on_slow_cores("dstorage")on DirectStorage worker threads (VICTORY_DISK_CORES=slow).Verification (
305e0ef, Windows 11 Build 26300, Intel Core i5-13400F 12 fast LPs / 4 slow LPs, Rust 1.98.1)cargo test -p victory-gpu --locked affinity::tests:: -- --nocapture(repeated 5x): 5/5 runs passed (verifies liveGetCurrentProcessorNumberExplacement on fast vs slow cores across parent +VICTORY_DISK_CORES=slow+VICTORY_FAST_CORES=0child processes).#[cfg(not(windows))]build & unit tests: verified clean (0warnings,3/3pure unit tests pass).cargo test --workspace --locked --no-fail-fast: 584 passed, 1 pre-existing failed, 12 ignored (the sole failure is pre-existingorigin/klbf-amd/betaxtaskrepository_passes_policyonlower.rs> 512 KiB anddocs/klbf/logo.svg;cargo clippyreports 0 warnings in all 4 modified/added files, with pre-existing lints untouched in unrelated files).Intel Core i5-13400F, 3 trials x 400 iters):unpinnedmean69.1–92.5 us/ p99294.2–543.2 us/ max2,021–10,659 usvspcore+bg_slowmean51.9–54.4 us/ p9964.4–103.1 us/ max105.5–162.2 us(4–5x lower p99, >15x lower max spikes).Not tested
OnceLockuniform-CPU fallback logic.AI use
gemini-4-hydrogen-high+gemini-4-neon-xhigh).@HandshakeHackin on GitHub · 2026-11-25 16:51 UTC · original
I checked the uniform-CPU fallback on a Windows runner using an AMD EPYC 9V74 (4 logical processors exposed). With fast-core selection enabled and
VICTORY_DISK_CORES=slow, the topology probe reported no hybrid tiers and both pin requests returnedfalse. The four existing affinity tests and the additional uniform-CPU assertion passed. The live hybrid test printed its expected skip on this host.Windows test output
@PastiiJay on GitHub · 2026-11-25 17:02 UTC · original
Thanks a lot @Vladimir-Human! Noted. I'll test it on the RX 9070 XT in the next test build and report back here.
@PastiiJay on GitHub · 2026-11-25 17:16 UTC · original
Thanks again @Vladimir-Human. While porting it onto the next test build I found that this build already pins the late-wait, relay and submit threads to the fast cores (
VICTORY_FAST_CORES, on by default) and can keep the DirectStorage workers on the slow cores (VICTORY_DISK_CORES=slow). So this PR would pin the same threads twice. I'm leaving it open for now. If you see a thread the existing switch misses, tell me and I'll add it. #16 is ported and under test now.@Vladimir-Human on GitHub · 2026-11-25 20:52 UTC · original
Thanks @PastiiJay for checking! Looking at the current
betatree (e328c88), the only other persistent/pool background workers aside fromvictory-late-wait,victory-relay,victory-submit, anddstorageare thevictory-pipelines-{i}shader compile workers (which already setTHREAD_PRIORITY_BELOW_NORMALinpipeline/make.rs),card accountingdiagnostics walks, andshadow::victory-wide-{i}workers. Keepingvictory-pipelines-*on slow/efficiency cores when hybrid E-cores exist is about the only extra knob worth considering so shader compilation stays out of the render P-cores' cache.Since your internal build already covers
late-wait/relay/submitviaVICTORY_FAST_CORESanddstorageviaVICTORY_DISK_CORES=slow, I'm completely fine closing #15 once those changes land onbeta(or keeping only the hybrid/uniform-CPU fallback helper if needed). Thanks for testing #16 and #29 as well!@PastiiJay on GitHub · 2026-11-25 20:53 UTC · original
Thanks @Vladimir-Human, that's a very useful map of the remaining threads. Agreed: we keep #15 open until those changes land on
beta, then close it with credit to you.The idea of keeping the
victory-pipelines-*workers on efficiency cores makes sense. Our test CPU (Ryzen 7 9800X3D) has no E-cores, so we can't measure it ourselves. If an Intel hybrid owner wants to try it, a before/after with the frame-time lines would tell us whether it's worth adding.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.