HLE: the title's idle and lowest threads run below normal #2903
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2903
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2903"
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?
@0xkn0wh3r3 on GitHub · 2026-11-25 23:32 UTC · original
0xkn0wh3r3:hle/title-idle-threads-below-normal→main· +71 −0 · 1 files · 2 commits · openWhat
SetThreadPriorityis now handled by the kernel module. When the title asks for idle (-15) or lowest (-2) priority, the thread gets below normal (-1) instead. Every other priority goes to the host unchanged.VICTORY_TITLE_PRIORITIES=0passes every priority through as before.Why
Some of the title's threads set themselves to idle priority, the streaming pager among them. On the console an idle thread still gets whatever the rest of the title leaves of its core. On a PC the cores are also busy with other programs and with our own workers (pipeline workers already run below normal). With all of those busy, an idle-priority thread ran about once every four seconds, whenever the Windows scheduler boosted it, and any loading waiting on it stalled too. The fork measured loads finishing 1.1 s late on average and 4.8 s at worst.
Nothing here depends on the GPU vendor.
Where it comes from
From the avatarmanz/VIctory-7900XTX fork, commit
0d065d3. The cherry-pick keeps its author. One change: the host call now goes through kernel'shostmodule (a stub on non-Windows), asTerminateProcessdoes, so the module still builds off Windows. The comment no longer names the fork's runs.Tested (Windows 11, RTX 5070 Ti)
cargo test -p victory-hle: 154 passed. New tests:no_title_thread_waits_for_idle_processors(the priority mapping) andan_idle_title_thread_is_set_below_normal_on_the_host(a real thread asks for -15 and the host reports -1).cargo clippy -p victory-hle --all-targets -- -D warnings: clean.Not tested
@matheusfrta on GitHub · 2026-11-26 02:13 UTC · original
Tested
c6fa949on Windows 11 (NVIDIA GeForce GTX 1080 Ti, driver 32.0.15.8266), Rust 1.99.0 MSVC:cargo test -p victory-hle --locked: 157 passed / 0 failed.cargo clippy -p victory-hle --lib --tests --locked -- -D warnings: clean.cargo xtask policy: ok.@Marvisak on GitHub · 2026-11-26 02:18 UTC · original
Automated triage for the maintainers.
Merge candidate (a recommendation to look, not an approval). This adds a
SetThreadPriorityexport to the HLEkernelmodule (modules/kernel.rs, which covers kernel32/kernelbase).title_prioritymaps only IDLE (-15) and LOWEST (-2) to BELOW_NORMAL (-1) and passes every other value through unchanged;VICTORY_TITLE_PRIORITIES=0turns the mapping off. The Win32 constants are right. This is host scheduling, not console semantics, and the PR states the reason (late loads from idle-priority threads competing with the pipeline workers, which run below normal). CIcheckpasses.Generated by Claude Code
@kotekompotek on GitHub · 2026-11-25 23:35 UTC · original · reviewed
Sound: mapping the title's idle/lowest range (-15..=-2) to below-normal keeps those threads ahead of our own below-normal workers while staying under the title's normal threads — the measured starvation (boost-only runs, seconds-late loads) is exactly what the clamp fixes. Range is correct since Windows priorities can't go below -15. The =0 opt-out preserves title semantics. LGTM.
@fuzeofficlal on GitHub · 2026-11-25 23:43 UTC · original · reviewed
Verified head
51a71e98cleanly onorigin/main(63bcca43) on Windows 11 x64.Code Review
THREAD_PRIORITY_BELOW_NORMAL(-1) with theVICTORY_TITLE_PRIORITIES=0escape hatch is clean and keeps non-Windows builds intact.IDLE..=LOWEST(-15..=-2) also maps invalid Win32 priority values in-14..=-3to-1(succeeding instead of failing withERROR_INVALID_PARAMETERasSetThreadPrioritynormally does); matchingIDLE | LOWESTdirectly avoids accepting invalid values.GetThreadPrioritypasses through to the host, so a title querying back its own priority sees-1(covered by the new test).Local Verification
cargo test --locked -p victory-hle: 154/154 unit tests passed (includingno_title_thread_waits_for_idle_processorsandan_idle_title_thread_is_set_below_normal_on_the_host), plusfidelityfx(1/1) andno_dll_planting(1/1).cargo clippy --locked -p victory-hle --tests -- -D warnings(default and--features diagnostics) &cargo xtask policy(191 files ok): clean.@Dukestar69 on GitHub · 2026-11-26 13:11 UTC · original · approved these changes
Verified against
origin/main(63bcca4):cargo test -p victory-hle --lib modules::kernel:: -- --test-threads=1: 7/7 passed (includingan_idle_title_thread_is_set_below_normal_on_the_hostandno_title_thread_waits_for_idle_processors).cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly maps idle and lowest title thread priorities to
THREAD_PRIORITY_BELOW_NORMALon the host.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.