fix(gpu): cap how long a frame waits for compute pipelines (hang watchdog at 30 s) #315

Open
github-bot wants to merge 2 commits from github-bot/gh-315 into main AGit
Owner

@⁠Lyrnc on GitHub · 2026-11-27 20:56 UTC · original
Lyrnc:fix/compute-wait-cap → main · +86 −1 · 1 files · 2 commits · open

Builds on #243. This branch is #243's commit plus one more, so merging this lands both. If #243 lands first, this one is only the second commit.

Problem

With #243, a compute dispatch waits for its pipeline however long that takes. With an empty cache, the first cutscene met 457 compute programs in one frame, at about a second each. That frame then ran for more than 30 s. The title's own hang watchdog fires after 30 s and stores to address 0 (+0x23cf683), which crashes the title. This was reported on fxceless/victory-fork as #1420.

Fix

The fix is armin's commit from fxceless/victory-fork#1450 (still open there). The author is kept.

  • Cap per frame. A frame waits for such pipelines for at most VICTORY_PIPELINE_COMPUTE_WAIT_MS, summed over threads. The default is 8,000 ms, which leaves room under the watchdog's 30 s for makes that other threads have already started.
  • Past the cap. The rest of that frame's dispatches wait within the frame's budget, as they did before #243. The first time this happens, one warning is logged.
  • Loading. The first 600 frames make their pipelines whatever it costs, so #243's one-shot set-up passes keep working.

Conflict resolution here: #243 has no 600-frame rule, so the condition is now compute_waits() && (early || compute_room(frame)). With VICTORY_PIPELINE_COMPUTE_WAIT=0, a dispatch waits within the budget exactly as before. Only pipeline/make.rs changes.

Verification

On Windows 11, RTX 5080:

  • cargo clippy -p victory-gpu --all-targets -- -D warnings: nothing in make.rs. The errors it gives are in other files and are on main too (#265 fixes those).
  • cargo test -p victory-gpu --lib pipeline::make: 6 pass, and pending_pipeline_is_recorded_for_the_next_launch fails. It fails the same way on #243's head without this commit.
  • cargo fmt --check was not used: it already fails on main (in apps/victory and in this file), so I kept the surrounding style.

Not run in game on this branch.

AI use: Claude Code (Claude Opus 5.5) ported the commit, resolved the conflict with #243, ran the checks above and drafted this description.

🤖 Generated with Claude Code

**@⁠Lyrnc** on GitHub · 2026-11-27 20:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/315) `Lyrnc:fix/compute-wait-cap` → `main` · +86 −1 · 1 files · 2 commits · open Builds on #243. This branch is #243's commit plus one more, so merging this lands both. If #243 lands first, this one is only the second commit. ### Problem With #243, a compute dispatch waits for its pipeline however long that takes. With an empty cache, the first cutscene met 457 compute programs in one frame, at about a second each. That frame then ran for more than 30 s. The title's own hang watchdog fires after 30 s and stores to address 0 (`+0x23cf683`), which crashes the title. This was reported on fxceless/victory-fork as #1420. ### Fix The fix is armin's commit from fxceless/victory-fork#1450 (still open there). The author is kept. - **Cap per frame.** A frame waits for such pipelines for at most `VICTORY_PIPELINE_COMPUTE_WAIT_MS`, summed over threads. The default is 8,000 ms, which leaves room under the watchdog's 30 s for makes that other threads have already started. - **Past the cap.** The rest of that frame's dispatches wait within the frame's budget, as they did before #243. The first time this happens, one warning is logged. - **Loading.** The first 600 frames make their pipelines whatever it costs, so #243's one-shot set-up passes keep working. Conflict resolution here: #243 has no 600-frame rule, so the condition is now `compute_waits() && (early || compute_room(frame))`. With `VICTORY_PIPELINE_COMPUTE_WAIT=0`, a dispatch waits within the budget exactly as before. Only `pipeline/make.rs` changes. ### Verification On Windows 11, RTX 5080: - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: nothing in `make.rs`. The errors it gives are in other files and are on `main` too (#265 fixes those). - `cargo test -p victory-gpu --lib pipeline::make`: 6 pass, and `pending_pipeline_is_recorded_for_the_next_launch` fails. It fails the same way on #243's head without this commit. - `cargo fmt --check` was not used: it already fails on `main` (in `apps/victory` and in this file), so I kept the surrounding style. Not run in game on this branch. AI use: Claude Code (Claude Opus 5.5) ported the commit, resolved the conflict with #243, ran the checks above and drafted this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A draw whose pipeline is not ready within the frame's budget is dropped
and drawn again next frame. A dispatch may not be drawn again: the title
runs some compute passes once, when a scene changes, and what they leave
is read for as long as the scene lasts. A compute program met for the
first time took 4.4 s to make on a 16 GB machine; its one dispatch was
dropped after the half second of budget, and the windows of the room
before stayed blended over the picture for minutes (run 195).

A compute pipeline now waits for its own making, whatever the budget; a
draw still waits within the budget. The pipeline library has it on the
next run. `VICTORY_PIPELINE_COMPUTE_WAIT=0` restores the old behaviour.

Ported from fxceless/victory-fork a42b627 (pull request #1312), GPL-3.0-or-later.
With VICTORY_PIPELINE_COMPUTE_WAIT on (the default) a compute dispatch
makes its pipeline on the spot, however long that takes. With an empty
cache the first cutscene met 457 compute programs in one frame at about a
second each: the frame did not end for over 30 s and the title's own
hang watchdog stored to address 0 (+0x23cf683, #1420).

A frame now waits for such pipelines up to VICTORY_PIPELINE_COMPUTE_WAIT_MS
(8,000 by default, summed over threads); after that its dispatches wait
within the frame's budget as with VICTORY_PIPELINE_COMPUTE_WAIT=0. The
first 600 frames (loading) still make theirs whatever it costs.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:01:15 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/315/head:github-bot/gh-315'
git switch 'github-bot/gh-315'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-315'
git switch 'github-bot/gh-315'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-315'
git switch 'github-bot/gh-315'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-315'
git switch 'main'
git merge --squash 'github-bot/gh-315'
git switch 'main'
git merge --ff-only 'github-bot/gh-315'
git switch 'main'
git merge 'github-bot/gh-315'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.