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

Open
kais7654 wants to merge 3 commits from upstream-pr/2582 into main
kais7654 commented 2026-11-25 16:11:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kais7654 on 2026-11-25T16:11:29Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6608625532 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2582). Originally posted by [kais7654](https://github.com/kais7654) on 2026-11-25T16:11:29Z. --- 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.
oni-swr commented 2026-11-25 17:05:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T16:33:51Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168180208 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2582#issuecomment-7168180208). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T16:33:51Z. --- **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.
kais7654 commented 2026-11-25 17:05:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kais7654 on 2026-11-25T16:45:18Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168480390 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2582#issuecomment-7168480390). Originally posted by [kais7654](https://github.com/kais7654) on 2026-11-25T16:45:18Z. --- > **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.
Marvisak commented 2026-11-25 23:06:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:14:56Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176123034 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2582#issuecomment-7176123034). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:14:56Z. --- <!-- victory-triage v1 head=fd872f4396c9ab864a32cc6708feb8d58c35e249 verdict=needs-rebase at=2026-11-25T22:14:51Z --> 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](https://claude.ai/code)_
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2582:upstream-pr/2582'
git switch 'upstream-pr/2582'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2582'
git switch 'upstream-pr/2582'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2582'
git switch 'upstream-pr/2582'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2582'
git switch 'main'
git merge --squash 'upstream-pr/2582'
git switch 'main'
git merge --ff-only 'upstream-pr/2582'
git switch 'main'
git merge 'upstream-pr/2582'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2580
No description provided.