Repository navigation
GPU: graphics pipelines are made before compute ones, and compute never takes every worker - #3025
Luislariosss wants to merge 1 commit into
Conversation
Updated Wine verification:
|
|
The reserved worker preserved a real cold draw on RTX 5080 and WARP for I queued eight valid synthetic compute pipelines as early starts and held their CPU compilation at a test barrier. A guest
Both warm pixels were 0.25 and the untouched control was 0.50 throughout. On the PR, the stream case waited 507–510 ms for the first draw. With stage-based classification it took 11.2 ms on RTX and 10.5 ms on WARP in this setup. These waits include the artificial CPU backlog. I also measured the accounting paths identified in the Wine review. On the PR, all eight ordinary compute PSOs finished and the graphics PSO rendered. After promoting one queued early start, the idle pool still reported |
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed 47069285 against main (63bcca43). There are three concrete bugs in crates/victory-gpu/src/pipeline/make.rs:
-
Promoted duplicate compute queue entries permanently leak a
compute_busyslot (make.rs:319-322,383-387)- When a compute pipeline is started early (
queues[3]) and later promoted by a waiting dispatch (queues[1]), both entries remain queued. - When a worker pops the second (duplicate) entry,
next()already incrementedqueues.compute_busy += 1. Thenp.taken.swap(true, Ordering::Relaxed)returnstrue, soif !takenis skipped andComputeSlot(compute)is never constructed —compute_busyis never decremented. - On a 2-worker pool (
compute_busy + 1 < 2), a single promoted compute pipeline permanently lockscompute_busy == 1and blocks all subsequent compute pipeline builds indefinitely. - Creating
let _slot = ComputeSlot(compute);immediately after dequeue (before checkingtaken) prevents the leak.
- When a compute pipeline is started early (
-
Completed compute pipelines never decrement
WAITINGor triggerdrained()(make.rs:224-226,388-399)enqueueincrementsWAITINGfor both graphics and compute pipelines on first queue, butwork()hasif compute { continue; }at line 388 beforeWAITING.fetch_sub(1, Ordering::Relaxed)at line 397.- Once any compute pipeline is built,
WAITINGstays permanently non-zero anddrained()can never fire. Removing the earlyif compute { continue; }(with_slotconstructed beforeif p.taken.swap(true, ...) { continue; }) lets both pipeline kinds share completion bookkeeping cleanly.
-
Unit test fails
--all-featuresCI and fails in isolation on 2 workers (make.rs:54-58,407-428)Pending::new(Vec::new(), None)omits the#[cfg(feature = "diagnostics")] skip_hashes: &[String]argument, causing the current--all-featuresCI failure.graphics_go_first_and_compute_leaves_a_workerinitializes the process-globalWORKERSOnceLockto2and pops fromnext(&mut queues)without ever releasingcompute_busy: after popping"compute a dispatch waits for",compute_busyis1, socompute_free(1 + 1 < 2) becomesfalse,"early compute"is never popped, and the iterator yields only 3 items while the assertion expects 4. Passingworkers: usizeintonext(queues, workers)also keeps the test isolated from globalWORKERSstate and lets you test slot release and duplicate-entry behavior directly.
4706928 to
5abc4cd
Compare
|
Thanks for the review — all three points were real and are fixed in 5abc4cd:
|
kotekompotek
left a comment
There was a problem hiding this comment.
LGTM — verified the queue ordering (gfx-now 0, compute-now 1, gfx-early 2, compute-early 3), compute_free keeps ≥1 slot for graphics without starving compute at 1 worker, taken dedups multi-queue entries, ComputeSlot returns the slot even on a compiler panic. Real fix for the 180×3.7s compute stall.
|
Verified your The compute-only pipeline-state stream still took all eight workers. With the same controlled CPU backlog, the first draw waited 505 ms on RTX and 506 ms on WARP and left its D32 pixel at the clear value (0.50). Both subsequent warm draws wrote 0.25. The stream constructor supplies Cherry-pick |
|
Automated triage for the maintainers. The four-queue ordering and the cap on compute workers in
The added doc comment on CI: Generated by Claude Code |
…er takes every worker In Grand Theft Auto VI's world about 180 compute pipelines take the host driver 3.7 s each on average (up to 24 s; the other compute ones 0.1 s). Queued in order of first use they held every worker for minutes while the scene's graphics pipelines, made in milliseconds, waited behind them and their draws were dropped: in one 360 s run the compile queue sat at ~870 and ~500-1000 draws a frame were dropped for want of a pipeline. With graphics first, and compute never holding more than all workers but one (the slot given back on a panic too), the queue went to 7 within three minutes, dropped draws fell to ~370, and characters, faces and lights that had been missing appeared. Measured on a Ryzen 5 9600X; 232 tests, clippy clean.
5abc4cd to
018b56a
Compare
|
Both points of the triage are fixed in the new head:
The doc comment on
|
|
The combined test on #3353 keeps your exact The scheduler/presentation tests passed with both feature configurations. If you take the queue resolution or regression, please preserve its Git author or add |
Problem
In Grand Theft Auto VI's world about 180 compute pipelines take the host driver 3.7 s each on average (up to 24 s; the other compute pipelines take 0.1 s). Queued strictly by first use, they held every pipeline worker for minutes while the scene's graphics pipelines — which compile in milliseconds — waited behind them, and their draws were dropped until a pipeline was ready.
Change
crates/victory-gpu/src/pipeline/make.rs: the worker queues are split into four, taken in this order — graphics a draw waits for, compute a dispatch waits for, then those started early — and compute never holds more than all workers but one (if only one worker could be spawned, compute takes it, else nothing compute would ever be made). The count of compute compilations lives under the same lock as the queues, and the slot is given back through a guard, so a panic in the compiler cannot keep it and a worker about to sleep cannot miss the wake-up.Measurement (Ryzen 5 9600X, RX 9060 XT)
One 360 s run before and one after, same build profile and cache state:
232 tests, clippy clean.
Risk
When no graphics pipeline is queued, peak compute compilation is one worker lower, so a compute-only queue drains a little more slowly.