Skip to content

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

Open
KevinPratap wants to merge 1 commit into
Marvisak:mainfrom
KevinPratap:gpu/pipeline-workers-normal-priority
Open

KevinPratap wants to merge 1 commit into
Marvisak:mainfrom
KevinPratap:gpu/pipeline-workers-normal-priority

Conversation

@KevinPratap

Copy link
Copy Markdown
Contributor

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

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

AI-assisted.

🤖 Generated with Claude Code

simnJS added a commit to MiamiGame/XTP that referenced this pull request Nov 24, 2026
In the world the title's own threads keep the processors busy, and
below-normal workers get almost no time: VIctory measured 236 pipelines
a minute at the start screen and 7 a minute in the world. XTP's Series S
sessions since 18:28 drop 571 to 747 draws a frame waiting for a
pipeline "being made" (watch pass 6, item 120).

Critical review: XTP already takes the first-used pipeline first (its
queue plays the part of VIctory #546), so this change only decides
whether the workers run. The cost is CPU time taken from the title's
threads while a backlog drains; the pool stays at half the logical
processors (2 to 16). Measure draws "being made" and the frame's
preparation time in the next Series S session.

Ported from Marvisak/VIctory#1505 (head ade80d2) by KevinPratap

Co-authored-by: KevinPratap <98597979+KevinPratap@users.noreply.github.com>
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
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 <noreply@anthropic.com>
@KevinPratap
KevinPratap force-pushed the gpu/pipeline-workers-normal-priority branch from ade80d2 to d4ef6a5 Compare November 24, 2026 22:33
@KevinPratap

Copy link
Copy Markdown
Contributor Author

Rebased onto today's main (70564ae). 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.

nazmi added a commit to nazmi/VIctory that referenced this pull request Nov 24, 2026
Three review workers over ~30 PRs against the freshly merged upstream tree,
plus three of our features the merge had discarded, re-applied with their
tests: f32_to_half NaN/nearest-even (Marvisak#843), unique-temp atomic library
writes (Marvisak#1660), VICTORY_PIPELINE_WORKERS (Marvisak#1728).

Integrated: Marvisak#1146, Marvisak#1161, Marvisak#1474, Marvisak#1592, Marvisak#1058, Marvisak#1505, Marvisak#1177, Marvisak#1507, Marvisak#1236,
Marvisak#1180 (with a new regression test for the cached opcode name).
Duplicates confirmed against upstream's own code: Marvisak#957, Marvisak#1103, Marvisak#1057, Marvisak#299.
Obsolete: Marvisak#513 (title_args no longer exists), Marvisak#1507's sibling Marvisak#334 covers it.
Refused: Marvisak#1030 (zip dump of game data), Marvisak#962 (deletes .gitignore).

Verified before this merge: fmt 0 differing, both Clippy gates exit 0,
xtask policy 220 files ok, workspace 662 passed / 0 failed (10 GPU tests
skipped that fail identically on upstream/main itself on this host).
devin-ai-integration Bot referenced this pull request in Personed/Bored Nov 24, 2026
Port upstream #1505 and #1728: workers no longer run below the title's priority, where busy world threads starved them, and VICTORY_PIPELINE_WORKERS can raise the worker count on many-core Linux/Windows hosts.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Personed referenced this pull request in Personed/Bored Nov 25, 2026
…ty-wave

* GPU: copy shader writes into write-watched pages under Wine

Port upstream #1831: when WriteProcessMemory/NtWriteVirtualMemory refuses an untouched MEM_WRITE_WATCH page under Wine, use the kernel read path into that destination so copy-back still lands.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* GPU: load cached pipelines outside the library lock

Port the Wine part of upstream #1722. vkd3d-proton treats a library load as a full compile, so holding the global library lock serialised all workers. Loads of different names can now overlap; same-name loads remain serialised as D3D12 requires.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* GPU: drop unready indirect calls before the argument clamp

Port upstream #1635: a call whose host pipeline is not ready cannot run, so do not refresh and clamp records that nothing will read.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* GPU: run indirect mesh dispatches as one-record ExecuteIndirect

Port upstream #1749: DispatchMeshX with group counts in GPU memory now uses the host indirect mesh path instead of being dropped.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Shaders: leave runaway translated loops after 2^14 iterations

Port upstream #1819. The previous 2^20 limit could outlast a driver reset; 2^14 bounds runaway loops to milliseconds per wave while VICTORY_SHADER_LOOP_LIMIT remains an override.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Input: keep the keyboard stand-in while XInput pads are idle

Port upstream #1430: virtual or untouched controllers no longer disable keyboard controls; real input outside the XInput deadzones takes over, and fallback keys regain control once host pads are idle.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* GPU: keep pipeline workers competitive and configurable

Port upstream #1505 and #1728: workers no longer run below the title's priority, where busy world threads starved them, and VICTORY_PIPELINE_WORKERS can raise the worker count on many-core Linux/Windows hosts.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: stoltembergg <stoltembergg@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

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

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants