GPU: schedule slow-compiling early pipelines in their own bounded queue #3296
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!3296
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3296"
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?
@pushkarreddyy on GitHub · 2026-11-26 16:17 UTC · original
pushkarreddyy:perf/gpu-pipeline-slow-queue→main· +267 −32 · 2 files · 1 commits · openSummary
Tracks host pipelines that take
>= 1000 msto compile inslow-pipelines.txtand caps concurrent early compilation of slow pipelines to a quarter of the worker pool (VICTORY_PIPELINE_SLOW=0to disable), leaving the remaining workers free for fast early pipelines and draw-requested pipelines.Root Cause
When the pipeline library is cold or invalidated after a translator/driver update, early pipelines that take several seconds each can occupy all background pipeline workers simultaneously, starving fast pipelines needed by early draws.
Changes
crates/victory-gpu/src/pipeline/library.rs:SLOW_FILE(slow-pipelines.txt),SLOW_MS(1000),slow(key), andnote_time(key, ms), persisted atomically alongsideearly-pipelines.txt.crates/victory-gpu/src/pipeline/make.rs:super::library::note_timeinPending::make.QUEUESinto aQueuesstruct withlists[0](requested),lists[1](early normal), andlists[2](early slow), capping concurrentslow_nowworkers to(workers / 4).max(1)unlessVICTORY_PIPELINE_SLOW=0.pipelines_known_to_take_long_leave_workers_for_the_othersunit test.Testing & Verification
pipelines_known_to_take_long_leave_workers_for_the_othersincrates/victory-gpu/src/pipeline/make.rs.No game files used.
AI-assisted: yes (Gemini 4 Neon)
@yumaste on GitHub · 2026-11-26 16:19 UTC · original
I reproduced a case where the slow-worker cap leaks on
30dd0df(deterministic queue test, no GPU needed). With cap = 1, queue slow A and B. A draw passes the!p.takencheck for A inenqueuebut has not pushed its urgent entry yet. A worker pops A from the slow queue, setstakenand starts compiling. The draw now pushes the urgent duplicate. A second worker discards that duplicate, but itsp.was_slow.swap(false)also releases the slot owned by the first worker. The nextQueues::pop(1)then returns B while A is still compiling.Could
Queues::popreturn the queue class with the entry, e.g.(Arc<Pending>, bool), and the worker use that local value when decrementingslow_now? A discarded slow entry would still release the reservation it took at pop time. A discarded urgent entry would never release another worker's reservation. The test is to freeze this interleaving and assert that B cannot be popped until A releases its slot.@andrewpozdnakov7-jpg on GitHub · 2026-11-26 16:50 UTC · original
I reproduced @yumaste's interleaving with a deterministic queue test on
30dd0df. One slow compile holds the only slot. The urgent duplicate is discarded while that compile is still in progress. The original logic releases its reservation at that point and admits the second slow compile too early.Follow-up
8dff2d5carries the reservation with the popped entry, as suggested. A worker releases exactly the slot its entry reserved. With the same interleaving, the second slow entry stays queued until the first compile completes. The new regression and all fivepipeline::make::testspassed. Strict GPU Clippy passed with default and all features, and policy passed. The queue test uses synthetic entries and does not measure cold-start time.@pushkarreddyy this is directly on your exact head if you want to cherry-pick it. Please retain its Git author, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding it into another commit. AI-assisted with Codex.@Dukestar69 on GitHub · 2026-11-26 17:10 UTC · original · approved these changes
Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090):
note_time) and scheduling known-slow early pipelines onto a bounded slow queue keeps worker threads free for normal draws and faster early compiles.cargo test -p victory-gpu --lib pipeline:: -- --test-threads=1(RTX 5090): 24 passed, 0 failed (includingpipelines_known_to_take_long_leave_workers_for_the_others).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.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.