GPU: pipeline workers at the title's priority, not below it #1504

Open
KevinPratap wants to merge 1 commit from upstream-pr/1505 into main
KevinPratap commented 2026-11-24 18:35:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KevinPratap on 2026-11-24T18:35:15Z.


Problem

Pipeline workers lower themselves to THREAD_PRIORITY_BELOW_NORMAL. In the world, the title's own threads keep every processor busy, and below-normal threads then get almost no time. Draws whose pipelines are not made yet are dropped, so the screen stays black until the backlog clears, and on a laptop it never did.

Measured on an RTX 4050 Laptop (16 logical processors, diagnostics build, counting host pipeline log lines per minute):

pipelines made per minute waiting
start screen 236
in the world, below normal 7 (6-11) ~1,700 for 17 minutes
in the world, normal priority (with #546 and #1129) 100-300 down to ~600 in 15 minutes

With the backlog draining, the same run went from about 10 to up to 1,475 recorded draws a frame.

Fix

The workers keep the title's priority (the call is removed). #546 decides which pipeline a worker takes next; this decides whether the workers run at all. The two are independent and merge together.

Verified

  • cargo clippy -p victory-gpu --all-targets: no new warnings; cargo test -p victory-gpu --lib pipeline::make passes.
  • The numbers above are from an integration branch on that laptop; the before and after runs differ in #546/#1129 too, so the table shows the combined effect, and the 7-a-minute row alone shows the starvation.

Only crates/victory-gpu/src/pipeline/make.rs changes.

AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6588780226 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1505). Originally posted by [KevinPratap](https://github.com/KevinPratap) on 2026-11-24T18:35:15Z. --- ## Problem Pipeline workers lower themselves to `THREAD_PRIORITY_BELOW_NORMAL`. In the world, the title's own threads keep every processor busy, and below-normal threads then get almost no time. Draws whose pipelines are not made yet are dropped, so the screen stays black until the backlog clears, and on a laptop it never did. Measured on an RTX 4050 Laptop (16 logical processors, diagnostics build, counting `host pipeline` log lines per minute): | | pipelines made per minute | waiting | |---|---:|---:| | start screen | 236 | | | in the world, below normal | 7 (6-11) | ~1,700 for 17 minutes | | in the world, normal priority (with #546 and #1129) | 100-300 | down to ~600 in 15 minutes | With the backlog draining, the same run went from about 10 to up to 1,475 recorded draws a frame. ## Fix The workers keep the title's priority (the call is removed). #546 decides which pipeline a worker takes next; this decides whether the workers run at all. The two are independent and merge together. ## Verified - `cargo clippy -p victory-gpu --all-targets`: no new warnings; `cargo test -p victory-gpu --lib pipeline::make` passes. - The numbers above are from an integration branch on that laptop; the before and after runs differ in #546/#1129 too, so the table shows the combined effect, and the 7-a-minute row alone shows the starvation. Only `crates/victory-gpu/src/pipeline/make.rs` changes. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
KevinPratap commented 2026-11-24 23:05:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KevinPratap on 2026-11-24T22:33:08Z.


Rebased onto today's main (70564ae0). The new queue already puts draw-requested pipelines first (as #546 did), but work() still lowers the workers to THREAD_PRIORITY_BELOW_NORMAL; this removes that call. cargo clippy -p victory-gpu --all-targets -- -D warnings is clean, and the pipeline::make tests pass. With the pre-build from the shader pack, fewer pipelines are made in the world, so this matters most on a first run and for pipelines the pack doesn't cover. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7146366081 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1505#issuecomment-7146366081). Originally posted by [KevinPratap](https://github.com/KevinPratap) on 2026-11-24T22:33:08Z. --- Rebased onto today's `main` (70564ae0). The new queue already puts draw-requested pipelines first (as #546 did), but `work()` still lowers the workers to `THREAD_PRIORITY_BELOW_NORMAL`; this removes that call. `cargo clippy -p victory-gpu --all-targets -- -D warnings` is clean, and the `pipeline::make` tests pass. With the pre-build from the shader pack, fewer pipelines are made in the world, so this matters most on a first run and for pipelines the pack doesn't cover. AI-assisted.
Marvisak commented 2026-11-25 04:06:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:16:42Z.


Automated triage for the maintainers.

Merge candidate. Removes the SetThreadPriority(..., THREAD_PRIORITY_BELOW_NORMAL) call from work() in crates/victory-gpu/src/pipeline/make.rs, so the pipeline workers (half the logical processors, clamped to 2..8) run at normal priority. I checked that nothing else in make.rs depends on the lower priority and that the change is limited to that call. The measurements in the description mix this change with others (#546, #1129), so the gain from this change alone is shown only by the 7-pipelines-a-minute starvation row; whether normal-priority workers cost the title's own threads too much is a maintainer's call.

CI: no check runs reported for this head.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7151762790 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1505#issuecomment-7151762790). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T03:16:42Z. --- <!-- victory-triage v1 head=d4ef6a596be3832544b6ed975ba617988a187723 verdict=merge-candidate at=2026-11-25T03:16:40Z --> Automated triage for the maintainers. **Merge candidate.** Removes the `SetThreadPriority(..., THREAD_PRIORITY_BELOW_NORMAL)` call from `work()` in `crates/victory-gpu/src/pipeline/make.rs`, so the pipeline workers (half the logical processors, clamped to 2..8) run at normal priority. I checked that nothing else in `make.rs` depends on the lower priority and that the change is limited to that call. The measurements in the description mix this change with others (#546, #1129), so the gain from this change alone is shown only by the 7-pipelines-a-minute starvation row; whether normal-priority workers cost the title's own threads too much is a maintainer's call. CI: no check runs reported for this head. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 01:04:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:56:22Z.


Code review and RTX 5090 + WARP verification at head d4ef6a596be3 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-gpu/src/pipeline/make.rs:295-300):
    • Removes SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL) (and its unsafe FFI block) so pipeline compilation workers run at normal priority alongside title threads instead of starving under load, while preserving the (cpus / 2).clamp(2, 8) pool sizing and now-before-early queue priority. Verified no other SetThreadPriority calls remain in the repo.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-gpu --tests -- -D warnings (default + --features diagnostics): 0 warnings
    • victory-gpu --lib -- pipeline::: 23/23 passed default on RTX 5090; 26/26 passed (--features diagnostics) on both RTX 5090 and WARP.

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179265064 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1505#issuecomment-7179265064). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T00:56:22Z. --- Code review and RTX 5090 + WARP verification at head `d4ef6a596be3` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-gpu/src/pipeline/make.rs:295-300`)**: - Removes `SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL)` (and its `unsafe` FFI block) so pipeline compilation workers run at normal priority alongside title threads instead of starving under load, while preserving the `(cpus / 2).clamp(2, 8)` pool sizing and `now`-before-`early` queue priority. Verified no other `SetThreadPriority` calls remain in the repo. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory-gpu --tests -- -D warnings` (default + `--features diagnostics`): 0 warnings - `victory-gpu --lib -- pipeline::`: **23/23 passed** default on RTX 5090; **26/26 passed** (`--features diagnostics`) on both RTX 5090 and WARP. LGTM.
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/1505:upstream-pr/1505'
git switch 'upstream-pr/1505'

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/1505'
git switch 'upstream-pr/1505'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1505'
git switch 'upstream-pr/1505'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1505'
git switch 'main'
git merge --squash 'upstream-pr/1505'
git switch 'main'
git merge --ff-only 'upstream-pr/1505'
git switch 'main'
git merge 'upstream-pr/1505'
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
Marvisak/VIctory!1504
No description provided.