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

Open
github-bot wants to merge 1 commit from github-bot/gh-1505 into main AGit
Owner

@⁠KevinPratap on GitHub · 2026-11-24 18:35 UTC · original
KevinPratap:gpu/pipeline-workers-normal-priority → main · +4 −6 · 1 files · 1 commits · open

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

**@⁠KevinPratap** on GitHub · 2026-11-24 18:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1505) `KevinPratap:gpu/pipeline-workers-normal-priority` → `main` · +4 −6 · 1 files · 1 commits · open ## 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)
Below normal, the world's busy threads starved the workers: on an RTX 4050 Laptop (16 logical processors) pipelines were made at 236 a minute at the start screen and 7 a minute once in the world, with about 1,700 waiting, and draws whose pipelines are not made yet are dropped. At normal priority the same kind of run made 100-300 a minute in the world.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:34:22 +00:00
Author
Owner

@⁠KevinPratap on GitHub · 2026-11-24 22:33 UTC · original

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.

**@⁠KevinPratap** on GitHub · 2026-11-24 22:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/1505#issuecomment-7146366081) 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:16 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 03:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/1505#issuecomment-7151762790) <!-- 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)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:56 UTC · original

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.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 00:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/1505#issuecomment-7179265064) 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 can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1505/head:github-bot/gh-1505'
git switch 'github-bot/gh-1505'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1505'
git switch 'github-bot/gh-1505'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1505'
git switch 'github-bot/gh-1505'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1505'
git switch 'main'
git merge --squash 'github-bot/gh-1505'
git switch 'main'
git merge --ff-only 'github-bot/gh-1505'
git switch 'main'
git merge 'github-bot/gh-1505'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1505
No description provided.