Skip to content

GPU: a screen pass's own pool never waits longer than the frame budget (fixes #2433) - #2582

Open
kais7654 wants to merge 3 commits into
Marvisak:mainfrom
kais7654:gpu/screen-pass-workers
Open

kais7654 wants to merge 3 commits into
Marvisak:mainfrom
kais7654:gpu/screen-pass-workers

Conversation

@kais7654

Copy link
Copy Markdown

Takes #2435 by @pushkarreddyy (adapted from @Belobug's tree) onto current main,
authorship preserved in the first commit, and addresses its triage's two
points.

What stays: the screen-pass classification (no vertex input, no depth or
stencil, triangle topology — GraphicsState::screen_pass), and two
pipeline kinds with their own queues, workers and per-frame budget
accounting: the ordinary pool (2..=8 workers) and two dedicated screen
workers. The lighting-table fills of #2433 (PS_IntegrateEnvBRDF*,
PS_AreaLightIlluminance, drawn once at world entry) are no longer stuck
behind a world's worth of pipelines, and a world's waits can no longer
spend a screen pass's budget.

What changes from #2435: no 20 s budget. A screen-classified pass is
nearly every full-screen draw the title runs, so a cold one could hold
the frame for seconds — the stall the budget exists to prevent. Both
kinds now share the same half-second budget; a misclassified pass can
only move pools, never wait longer than the ordinary pool allowed. The
screen workers make the one-off fills within moments, so a longer wait
is not needed for them.

Also, a draw whose pipeline was not made within its kind's budget is now
logged once by key ("a draw's pipeline is not made within the frame's
budget; the draw is skipped") — the drop the triage asked to see, so a
run that loses a once-drawn pass shows it and testers (thanks to the
readback protocol of #2435's thread) can turn it into the missing
evidence on the hardware where the drop happens.

Local check: clippy --workspace --all-targets with and without
--all-features, -D warnings clean; victory-gpu tests pass on a capped
RTX heap except the two failures that #1943's not-yet-merged fix owns.

Merge note (from #2435's review): #2250's VICTORY_PIPELINE_THREADS env
adds worker count control where queue() starts its pool — when it
lands, its env should apply to the ordinary kind only.

pushkarreddyy and others added 2 commits November 25, 2026 17:06
Following the triage of Marvisak#2435 (pushkarreddyy's cherry-pick above, adapted
from Belobug's work): the proposal gave a screen-classified pass a 20 s
per-frame wait, but such a pass is nearly every full-screen draw the title
runs, so a cold one could hold the title's frame for seconds. The two
kinds keep their own queues, workers and budget accounting, and both
budgets are the same half a second: a world's pipelines cannot spend a
screen pass's budget away (the lighting-table fills are made within
moments by the two screen workers), and a misclassified pass can only
move pools, never wait longer than the ordinary pool allowed.

A draw whose pipeline was not made within the budget is now logged once
by key, so a run losing a once-drawn pass shows it.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@oni-swr

oni-swr commented Nov 25, 2026

Copy link
Copy Markdown

oni-swr verification — head 44d4ade12bab84d01f78ac9ede603b3c0f19e715 (merge base da82e44, two commits behind main), origin/main 67e8ae1401df112248aed36d0024483181b718b7

Environment: Windows 11 Pro (26200), rustc 1.98.1, WARP only (VICTORY_D3D12_WARP=1 with --features diagnostics, which is what makes the host device the software adapter; Windows SDK 10.0.26100.0 dxil.dll on PATH). No hardware GPU use in the reported runs, no game files, no retail data. Merge check: git merge-tree --write-tree origin/main <head> is clean. Tested both the PR head and the merge with origin/main (7d523f8).

Commands / results

  • Focused cargo test --locked -p victory-gpu --features diagnostics --lib -- screen_pass pipeline::: head 17 passed, merged 17 passed, 0 failed, 0 ignored (includes the new screen_pass_requires_triangle_without_inputs_or_depth)
  • cargo test --locked -p victory-gpu --features diagnostics (lib 199 passed, 1 ignored): merged 3/3 runs green; head 2/3 green, 1 run failed only memory::tests::a_submission_that_missed_leaves_the_copies_at_once — a pre-existing WARP flake I also measured on origin/main (9/60 runs), unrelated to this diff.
  • cargo clippy --locked -p victory-gpu --features diagnostics --all-targets -- -D warnings (merged tree): clean.

Review: The classification and the two-kind queue/budget bookkeeping look correct (per-kind FRAME/WAITED_US arrays, per-kind QUEUES/WORKERS, workers named per kind; start early-start path uses the same queues). Both kinds keep the 500 ms budget, so a misclassified pass cannot wait longer than before, a reasonable replacement for #2435's 20 s. Small notes, none blocking: (1) the dropped warning fires when a draw merely missed this frame's budget, and that pipeline can still be made later, so "the draw is skipped" is true for that frame only; (2) the new behaviour is only unit-tested via the classifier, and the dedicated-worker/budget separation has no test (needs timing, so understandable); (3) a draw is warned about once per key for the process lifetime (small HashSet<String>, bounded by pipeline count).

Overlap: this is the same fix as open #2435 (also "fixes #2433", the original by @pushkarreddyy): #2582 states it supersedes it with different budget semantics, so only one of the two should land. #2250's VICTORY_PIPELINE_THREADS (mentioned in the description) is not open in the list I checked. #2556 and #2471 touch pipeline/make.rs / pipeline/host.rs and merge cleanly with this PR.

AI disclosure: this review and verification were done by Claude Code (Claude Sonnet 5.5), not a human reviewer. Comment-only; no code changed.

…s a test

From oni-swr's verification of Marvisak#2582: the dropped warning said "the draw
is skipped" where the budget only costs the pipeline's draw this frame —
the message now says so, and names the pass drawn only once, which the
skip loses outright. The routing to the screen pool itself had no test:
a screen-classified pipeline now goes through `ready` in a test, so both
worker pools' spawn paths run under test.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
@kais7654

Copy link
Copy Markdown
Author

oni-swr verification — head 44d4ade12bab84d01f78ac9ede603b3c0f19e715 (merge base da82e44, two commits behind main), origin/main 67e8ae1401df112248aed36d0024483181b718b7

Environment: Windows 11 Pro (26200), rustc 1.98.1, WARP only (VICTORY_D3D12_WARP=1 with --features diagnostics, which is what makes the host device the software adapter; Windows SDK 10.0.26100.0 dxil.dll on PATH). No hardware GPU use in the reported runs, no game files, no retail data. Merge check: git merge-tree --write-tree origin/main <head> is clean. Tested both the PR head and the merge with origin/main (7d523f8).

Commands / results

  • Focused cargo test --locked -p victory-gpu --features diagnostics --lib -- screen_pass pipeline::: head 17 passed, merged 17 passed, 0 failed, 0 ignored (includes the new screen_pass_requires_triangle_without_inputs_or_depth)
  • cargo test --locked -p victory-gpu --features diagnostics (lib 199 passed, 1 ignored): merged 3/3 runs green; head 2/3 green, 1 run failed only memory::tests::a_submission_that_missed_leaves_the_copies_at_once — a pre-existing WARP flake I also measured on origin/main (9/60 runs), unrelated to this diff.
  • cargo clippy --locked -p victory-gpu --features diagnostics --all-targets -- -D warnings (merged tree): clean.

Review: The classification and the two-kind queue/budget bookkeeping look correct (per-kind FRAME/WAITED_US arrays, per-kind QUEUES/WORKERS, workers named per kind; start early-start path uses the same queues). Both kinds keep the 500 ms budget, so a misclassified pass cannot wait longer than before, a reasonable replacement for #2435's 20 s. Small notes, none blocking: (1) the dropped warning fires when a draw merely missed this frame's budget, and that pipeline can still be made later, so "the draw is skipped" is true for that frame only; (2) the new behaviour is only unit-tested via the classifier, and the dedicated-worker/budget separation has no test (needs timing, so understandable); (3) a draw is warned about once per key for the process lifetime (small HashSet<String>, bounded by pipeline count).

Overlap: this is the same fix as open #2435 (also "fixes #2433", the original by @pushkarreddyy): #2582 states it supersedes it with different budget semantics, so only one of the two should land. #2250's VICTORY_PIPELINE_THREADS (mentioned in the description) is not open in the list I checked. #2556 and #2471 touch pipeline/make.rs / pipeline/host.rs and merge cleanly with this PR.

AI disclosure: this review and verification were done by Claude Code (Claude Sonnet 5.5), not a human reviewer. Comment-only; no code changed.

@oni-swr Thanks for the verification @oni-swr — points 1 and 2 are addressed in fd872f4:

  1. The dropped warning now says "its draw is skipped this frame — a pass
    drawn only once is lost", which is exact under both classifications.
  2. The routing has a test: a_screen_pass_is_made_by_its_own_workers
    runs a screen-classified pipeline through ready, so both worker
    pools' spawn paths are exercised (the ordinary kind was the only one
    covered before). Timing behavior itself stays untested, as you said —
    that needs a real run, which the logged drop should make reportable.

On 3, agreed — that is the shape I went for: one warning per key for the
process lifetime, bounded by the pipeline count.

On the overlap: #2582 supersedes #2435's 20 s budget — happy for
@pushkarreddyy to test/review this one, and if the maintainers prefer
landing the cherry-pick + budget revision as updates to #2435 itself, I
am fine with that too: same two-pool design either way, and only one
should land.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main: it conflicts in crates/victory-gpu/src/pipeline/make.rs. No content review was done this time; it will be reviewed once it is rebased onto current main.


Generated by Claude Code

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.

4 participants