Skip to content

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

Open
arminkhaleghirod wants to merge 1 commit into
fxceless:mainfrom
arminkhaleghirod:compute-wait-cap
Open

arminkhaleghirod wants to merge 1 commit into
fxceless:mainfrom
arminkhaleghirod:compute-wait-cap

Conversation

@arminkhaleghirod

Copy link
Copy Markdown

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.

…ispatch

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, fxceless#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.
@Filip722

Copy link
Copy Markdown
Contributor

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).

@lmouz823-lang

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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.

KomanderDG88 pushed a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 27, 2026
…ispatch

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, fxceless#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.

(cherry picked from commit 17a6f01, fxceless/victory-fork pull request fxceless#1450)

Port: our ready() had only the compute_waits() branch (without the
upstream rule that the first 600 frames make their compute pipelines
whatever it costs); the PR's version of the branch is taken whole, so
those frames now make theirs too, and later frames make them while under
VICTORY_PIPELINE_COMPUTE_WAIT_MS (8,000 ms a frame, summed over threads).
It matches our cold-cache crash at victory-image+0x23cf683 (a frame
over 30 s, the title's watchdog storing to 0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 27, 2026
…ELINE_COMPUTE_WAIT_MS set

Unset, a dispatch makes its compute pipeline whatever it costs, as before
(and the first-600-frames rule does not apply), so the cap can be measured
as one variable; `=8000` is upstream's default. victory-gpu lib: 392
passed, 0 failed unset. With the variable set, the pending-pipeline test
fails by design: frame 0 is one of the first 600, whose compute pipelines
are made at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KomanderDG88 pushed a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 27, 2026
…es by the card's budget

Every title buffer's copy (a least of 64 KiB) and the windows of title
memory outside buffers go to the card, up to totals chosen by the card's
budget (8 GB: 768/512 MB; 12 GB: 1/1 GB; 16 GB: 1.5/1.5 GB; 24 GB: 2/2 GB;
32 GB and more: 3/3 GB). Windows go main's way: one buffer in a GPU upload
heap where the device has such heaps, two sides where it has none. A window
goes to the card up to 97 hundredths of the budget, and the texture queue
keeps the room of both totals (at most 1.5 GiB of buffers and 2 GiB of
windows).

Every switch of its own still wins: VICTORY_CARD_BUFFERS_MIN_KB, _MIN_MB,
_MB, VICTORY_CARD_WINDOWS_MB, VICTORY_WINDOW_UPLOAD,
VICTORY_CARD_ROOM_FOR_BUFFERS. Off, nothing changes. A line at the first
copy says what was chosen.

On an RTX 5090 with fxceless#854 and fxceless#1450, four alternated runs of four minutes:
183.1 and 186.2 ms a frame without the switch, 154.2 and 158.1 ms with it.

Port: in this tree windows outside buffers stay off by default
(VICTORY_CARD_WINDOWS_MB 0, not 1,280) and VICTORY_WINDOW_UPLOAD is off by
default, so without the switch windows still do not go to the card and
with it they go with two sides unless VICTORY_WINDOW_UPLOAD=1. The room
kept (card_room_kept) is still capped by VICTORY_CARD_ROOM_KEPT_MB, now
the buffers' and the windows' room together, and that switch is named in
the start-up line too. The window line keeps reserve_window's saturating
add. The README line is left out.

(cherry picked from commit e408259)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 27, 2026
Brings, each behind its own switch and off unless set: VI-BR-PORT's held
levels (VICTORY_HELD_LEVELS), copies and refreshes (SEND_OWN, UNDER_WORDS,
UNDER_WIDE, WIDE_FILLS, REFRESH_AHEAD), page parts and guards (PAGE_PARTS,
GUARD_REST, OPEN_ONE_VIEW), the heap pass aside (HEAP_PASS_ASIDE); from
fxceless/victory-fork fxceless#1450 (PIPELINE_COMPUTE_WAIT_MS), fxceless#1461
(SAMPLER_ORDER), fxceless#1468 (CARD_READ_COPY), fxceless#1476 (CARD_SIDE), fxceless#1424
(WIDE_READS), fxceless#1427; Belobug's FidelityFX bridge (VICTORY_FIDELITYFX_DIR);
a local window icon (VICTORY_WINDOW_ICON); and fixes to LAZY_REMAP's
copies and clean pages. Nothing derived from XCL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@grosterr

Copy link
Copy Markdown
Contributor

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).

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.

KomanderDG88 pushed a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 27, 2026
…ait (VICTORY_HEAD_MAP_WAIT=1)

The title dispatches the head blend-shape map (compute 61e54e90adccaf6a,
avatarmanz/VIctory-7900XTX#166) once for a head. Here a dispatch waits
for its pipeline only within the frame's half second of budget and is
then dropped ("a dispatch without a host pipeline dropped"): with a cold
cache the head's skin around eyes and teeth can be lost.

With VICTORY_HEAD_MAP_WAIT=1:
- make::early queues that pipeline at its creation, at the front of the
  ahead queue (Queue::push/push_ahead), cache or no cache.
- Its dispatch (State::dispatch, execute_indirect of kind DISPATCH, via
  pipeline::host_dispatch_pipeline / make::ready_dispatch) waits for it up
  to 2 s, one allowance over the run (HeadMapWait); after a timeout, said
  once, later dispatches wait within the frame's budget as before.
- VICTORY_PIPELINE_COMPUTE_WAIT=1 still wins (it makes the pipeline in
  place); the fxceless#1450 cap (VICTORY_PIPELINE_COMPUTE_WAIT_MS) is honoured: a
  frame out of room waits within its budget, and the head wait is counted
  to the cap.
- Lines: the switch once; "head blend-shape map pipeline queued at its
  creation"; "head blend-shape map pipeline at its first dispatch" (frame,
  already_ready, host_pipeline, wait_ms); a warning at the deadline.

Off unless =1 (Vice-Tay has it on unless =0): unset, no pipeline is
marked, ready_dispatch is ready, and pipelines are queued, made and
waited for exactly as before. Pure tests: switch and shader match, queue
order, the bounded and once-spent wait.

Port: TaynanGT/Vice-Tay 3e3fd57901d4f26caf115e3cbb68fa52825ce6f5
(fxceless#372), GPL-3.0. Written anew for this tree (no scene_input here; the
ahead queue instead of the screen queue; no driver-failure publication
without workers).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants