GPU: cap the time a frame waits for compute pipelines made at their dispatch (#1420) #1450

Open
arminkhaleghirod wants to merge 1 commit from upstream-pr/1450 into main
arminkhaleghirod commented 2026-11-27 09:34:23 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by arminkhaleghirod on 2026-11-27T09:34:23Z.


Fixes the +0x23cf683 crash in #1420 without turning compute waiting off.

Cause. With VICTORY_PIPELINE_COMPUTE_WAIT on (the default), a compute dispatch builds its pipeline on the spot, however long that takes. With an empty cache, the first cutscene hit 457 compute programs in one frame, at about a second each. The frame did not end for over 30 s, so the title's own hang watchdog stored to address 0.

Change. A frame now waits for such pipelines for at most 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 build theirs whatever it costs.
  • Time is charged only to the frame it started in.
  • The cap is checked before a build starts, so a frame can run over by the builds already in flight. That's why the default sits well under 30 s.

Tested on an RTX 4080 16 GB, Ryzen 9 7950X, 32 GB RAM, Windows 11. Diag build of 9a9091d plus this change, Series X profile, the run-278 switch set, VICTORY_BVH_BUILDER=0.

  • Before (same switches, fresh cache, compute waiting on): the +0x23cf683 fault in 2 of 2 runs, about a minute after Enter on the start screen. In the log, frame=3107 stayed stuck for about 30 s while compute pipelines were built one by one.
  • After (fresh cache, compute waiting on): the cap tripped once at frame 4189 (a frame waited its cap for compute pipelines). The game reached the world and ran 5+ minutes without a fault.

One machine and one scene, so the 8 s default may want tuning on slower CPUs.

<!-- greyfinch-sync:fxceless/victory-fork:issue:5524370500 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1450). Originally posted by [arminkhaleghirod](https://github.com/arminkhaleghirod) on 2026-11-27T09:34:23Z. --- Fixes the `+0x23cf683` crash in #1420 without turning compute waiting off. **Cause.** With `VICTORY_PIPELINE_COMPUTE_WAIT` on (the default), a compute dispatch builds its pipeline on the spot, however long that takes. With an empty cache, the first cutscene hit 457 compute programs in one frame, at about a second each. The frame did not end for over 30 s, so the title's own hang watchdog stored to address 0. **Change.** A frame now waits for such pipelines for at most `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 build theirs whatever it costs. - Time is charged only to the frame it started in. - The cap is checked before a build starts, so a frame can run over by the builds already in flight. That's why the default sits well under 30 s. **Tested** on an RTX 4080 16 GB, Ryzen 9 7950X, 32 GB RAM, Windows 11. Diag build of 9a9091d plus this change, Series X profile, the run-278 switch set, `VICTORY_BVH_BUILDER=0`. - **Before** (same switches, fresh cache, compute waiting on): the `+0x23cf683` fault in 2 of 2 runs, about a minute after Enter on the start screen. In the log, `frame=3107` stayed stuck for about 30 s while compute pipelines were built one by one. - **After** (fresh cache, compute waiting on): the cap tripped once at frame 4189 (`a frame waited its cap for compute pipelines`). The game reached the world and ran 5+ minutes without a fault. One machine and one scene, so the 8 s default may want tuning on slower CPUs.
Filip722 commented 2026-11-27 10:12:41 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-27T10:12:41Z.


This cap addresses a startup stall I measured on RTX 5060 Laptop / GE-Proton11-14 with a 9a9091d-based build. The startup trace recorded 193 completed compute waits. In one frame, a single recording thread accumulated 28.010 seconds of returned waits before the title watchdog. An earlier replay with the older bounded-wait option got farther and later hit NVIDIA Xid 13 SKEDCHECK36_DEPENDENCE_COUNTER_UNDERFLOW. Those are separate observations on that earlier build.

At 17a6f01d, a caller can sample frame N, reach compute_room after N+1 has already used its budget, and reset the count back to frame N. The next N+1 caller then starts with an empty budget. I tested a one-file correction that lets a newer token reset the budget and sends stale callers through the existing bounded fallback. Late completions leave the newer tally alone. The old reset condition failed the deterministic regression. The corrected MSVC build passed the targeted case and all six scheduler tests under Proton. The staged source-only asset check also passed.

Review commit

Assisted by Codex (GPT-6.2-Sol High).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7215608894 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1450#issuecomment-7215608894). Originally posted by [Filip722](https://github.com/Filip722) on 2026-11-27T10:12:41Z. --- This cap addresses a startup stall I measured on RTX 5060 Laptop / GE-Proton11-14 with a `9a9091d`-based build. The startup trace recorded 193 completed compute waits. In one frame, a single recording thread accumulated 28.010 seconds of returned waits before the title watchdog. An earlier replay with the older bounded-wait option got farther and later hit NVIDIA Xid 13 `SKEDCHECK36_DEPENDENCE_COUNTER_UNDERFLOW`. Those are separate observations on that earlier build. At `17a6f01d`, a caller can sample frame N, reach `compute_room` after N+1 has already used its budget, and reset the count back to frame N. The next N+1 caller then starts with an empty budget. I tested a one-file correction that lets a newer token reset the budget and sends stale callers through the existing bounded fallback. Late completions leave the newer tally alone. The old reset condition failed the deterministic regression. The corrected MSVC build passed the targeted case and all six scheduler tests under Proton. The staged source-only asset check also passed. [Review commit](https://github.com/Filip722/victory-fork/commit/9adf04d4cbe9bddac1e54d63797946d25769e079) Assisted by Codex (GPT-6.2-Sol High).
lmouz823-lang commented 2026-11-27 13:47:53 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by lmouz823-lang on 2026-11-27T13:47:53Z.


Windows repro for the crash in #1420: Windows 11 build 26200, RTX 4060 Laptop GPU (8 GiB, driver 610.88).

I built base 9a9091d180f044726463d3db819808086daeebae and this PR's 17a6f01d7be53a3696614654a2fd970a37879b25 as release builds with diagnostics. Both carried the same local AppContainer scratch-path policy shim; there were no local pipeline or GPU behavior changes. Each run used a separate AppContainer copy of the same save and warm shader cache, Series X, scripted Enter at 2 s and 18 s, and GPU timing plus DRED.

Build / setting Result
Base 9a9091d, default waits 0xc0000005 after 91.61 s
PR 17a6f01, default 8,000 ms compute cap Same fault after 163.95 s
PR 17a6f01, VICTORY_PIPELINE_COMPUTE_WAIT_MS=2000 Same fault after 98.22 s

All three faults were writes to 0x0 at victory-image-b99f876b74d4a77f.dll+0x23cf683; the next two frames were +0x2215c35 and +0x2215eca. The cap did not prevent this fault in these replays. This is one run per setting, so the elapsed-time differences alone do not show an improvement or regression. None reached sustained playable world rendering. No game assets or derived files are attached.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7219956219 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1450#issuecomment-7219956219). Originally posted by [lmouz823-lang](https://github.com/lmouz823-lang) on 2026-11-27T13:47:53Z. --- Windows repro for the crash in #1420: Windows 11 build 26200, RTX 4060 Laptop GPU (8 GiB, driver 610.88). I built base `9a9091d180f044726463d3db819808086daeebae` and this PR's `17a6f01d7be53a3696614654a2fd970a37879b25` as release builds with `diagnostics`. Both carried the same local AppContainer scratch-path policy shim; there were no local pipeline or GPU behavior changes. Each run used a separate AppContainer copy of the same save and warm shader cache, Series X, scripted Enter at 2 s and 18 s, and GPU timing plus DRED. | Build / setting | Result | | --- | --- | | Base `9a9091d`, default waits | `0xc0000005` after 91.61 s | | PR `17a6f01`, default 8,000 ms compute cap | Same fault after 163.95 s | | PR `17a6f01`, `VICTORY_PIPELINE_COMPUTE_WAIT_MS=2000` | Same fault after 98.22 s | All three faults were writes to `0x0` at `victory-image-b99f876b74d4a77f.dll+0x23cf683`; the next two frames were `+0x2215c35` and `+0x2215eca`. The cap did not prevent this fault in these replays. This is one run per setting, so the elapsed-time differences alone do not show an improvement or regression. None reached sustained playable world rendering. No game assets or derived files are attached.
lukinhasnojento commented 2026-11-27 14:53:36 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by lukinhasnojento on 2026-11-27T14:53:36Z.


Follow-up test context (2026-11-27): a later build using the pipeline pre-build approach in PR #1226, with early-use keys identified from a prior run involving the #1450/#1442 changes, advanced into the prologue without reproducing +0x23cf683 in the observed window. The tested build was based on the pre-build PR, not this PR, so this is not evidence that #1450 prevents the watchdog. Performance remained very low and draws were still dropped; this is a preliminary single-run observation, not a confirmed fix. No game files, derived assets, screenshots, or raw logs are attached.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7221362462 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1450#issuecomment-7221362462). Originally posted by [lukinhasnojento](https://github.com/lukinhasnojento) on 2026-11-27T14:53:36Z. --- Follow-up test context (2026-11-27): a later build using the pipeline pre-build approach in PR #1226, with early-use keys identified from a prior run involving the #1450/#1442 changes, advanced into the prologue without reproducing +0x23cf683 in the observed window. The tested build was based on the pre-build PR, not this PR, so this is not evidence that #1450 prevents the watchdog. Performance remained very low and draws were still dropped; this is a preliminary single-run observation, not a confirmed fix. No game files, derived assets, screenshots, or raw logs are attached.
grosterr commented 2026-11-27 15:08:16 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by grosterr on 2026-11-27T15:08:16Z.


Another data point for #1420 / this fix, on different hardware: RTX 3060 12 GB, Ryzen 7 5700X (8c/16t), 32 GB RAM, Windows 11, Series S profile, old line (main 9a9091d plus a stack of open PRs).

  • Without this PR: a crash during loading about 4.5 minutes after start, right after re-warming the shader cache (pipeline library cold): 0xc0000005 at <image>+0x23cf683 (write 0x0: nothing mapped there), the same address as in #1420.
  • With this PR merged: five runs since (about 1.5 hours in total, 10–40 minutes each), no crash.

Caveat: by then the pipeline library was warm, and one run without this PR but with the warm library did not crash either, so these runs show that nothing else broke rather than prove the fix on a cold library. The address matches #1420 exactly.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7221672587 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1450#issuecomment-7221672587). Originally posted by [grosterr](https://github.com/grosterr) on 2026-11-27T15:08:16Z. --- Another data point for #1420 / this fix, on different hardware: RTX 3060 12 GB, Ryzen 7 5700X (8c/16t), 32 GB RAM, Windows 11, Series S profile, old line (`main` 9a9091d plus a stack of open PRs). - **Without this PR:** a crash during loading about 4.5 minutes after start, right after re-warming the shader cache (pipeline library cold): `0xc0000005 at <image>+0x23cf683 (write 0x0: nothing mapped there)`, the same address as in #1420. - **With this PR merged:** five runs since (about 1.5 hours in total, 10–40 minutes each), no crash. Caveat: by then the pipeline library was warm, and one run without this PR but with the warm library did not crash either, so these runs show that nothing else broke rather than prove the fix on a cold library. The address matches #1420 exactly.
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/1450:upstream-pr/1450'
git switch 'upstream-pr/1450'

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/1450'
git switch 'upstream-pr/1450'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1450'
git switch 'upstream-pr/1450'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1450'
git switch 'main'
git merge --squash 'upstream-pr/1450'
git switch 'main'
git merge --ff-only 'upstream-pr/1450'
git switch 'main'
git merge 'upstream-pr/1450'
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
fxceless/victory-fork!1450
No description provided.