Skip to content

Fix the 7–11 minute pool crash (upstream audio fixes), plus GPU stability fixes - #959

Open
Sashwiin wants to merge 23 commits into
fxceless:mainfrom
Sashwiin:share
Open

Sashwiin wants to merge 23 commits into
fxceless:mainfrom
Sashwiin:share

Conversation

@Sashwiin

Copy link
Copy Markdown

Fixes the pool crash at 7–11 minutes into the world (a certain title's instance pool fills up) by bringing in upstream's 8 XMA/audio fixes; the intro stream no longer stalls, and a test run went 36 minutes without a crash. Also: an opt-in watchdog skip, choosing the host GPU by name, pipeline-library safety, bounded GPU waits, reuse of upload buffers, and an experimental page-pool in-place mode (off by default). Tested on an RTX 5070 Ti laptop with 16 GB of RAM.

🤖 Generated with Claude Code

ruvenesh and others added 22 commits November 25, 2026 19:12
…ld 1.0.2.1)

The title ends the process on purpose when its main thread has not advanced
for about 30 one-second ticks (a write to address 0 at +0x23cf683, with a
second one at +0x2215c35 right after the handler call). On a host much slower
than the console a long load can exceed that window.

With VICTORY_NO_WATCHDOG=1 the loader jumps over the abort site and makes the
handler's fault a NOP. Each patch is applied only if the original BLAKE3
starts with the 1.0.2.1 identity and the exact original bytes are at the
offset; otherwise it logs a warning and does nothing. Off by default.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
(cherry picked from commit d2c93fa)
The hook was enabled by the variable being set at all, so =0 or an empty
value turned it on. Treat those as off, as a reviewer suggested.

Checked: cargo clippy -p victory-loader --target x86_64-pc-windows-msvc -- -D warnings is clean and the loader tests build (box, cross-compiled). Not run on Windows.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
(cherry picked from commit 85c04d1)
Windows' default GPU was always used. VICTORY_ADAPTER=<part of a name>
(case ignored) picks a hardware adapter whose name holds it, logging
every adapter's name. On a laptop with an NVIDIA GPU (32-lane waves
only) and an RDNA 2 integrated one (the console GPU's family, 64-lane
waves natively), the title can run on the latter as a reference for what
it should draw. `translate --cache` follows it too (its host target).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A library belongs to one adapter and driver; on another the host rejects
it, a run starts an empty one and saves it over the old. With
VICTORY_ADAPTER set the library is kept in a folder of that name
(pipelines\adapter-<name>), so a reference run on a second GPU never
replaces the library pre-built on the default one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ever saved over

Run 53 found no library at start ("no host pipeline library yet") where
a 1.8 GB pre-build had been, started an empty one and saved it over the
file. An unreadable file is now left alone (no pipelines kept that run);
one the host rejects (another adapter or driver, damage) is moved aside
as host-pipelines.rejected.bin before an empty one is started.

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

Host::execute waited for each submission with no end. A host that loses
its device need not signal the fences of the work it dropped:
vkd3d-proton after a GPU fault does not, and by default does not report
the device removed either. The title's submit thread then stays in our
wait, its render thread blocks on its full submission ring, and 30 s
later the title's own watchdog ends the run at image+0x23cf683 (fxceless#1118),
with nothing of ours in crashes.log to say that the GPU faulted.

The wait now goes in 250 ms slices:

* between slices the device is asked whether it was removed; if so the
  wait ends and the existing check after the submission reports it;
* a submission still running is said so at 10 s and 20 s;
* at 25 s it is given up with a report of its own ("has not finished a
  submission ... and reports no removal"). The limit is below the
  title's 30 s so the run ends with the cause, not with the title's
  null write. vkd3d-proton's own source calls a wait of over 5 s a lost
  device; Windows resets a device after about 2 s.

A fence that comes is taken as before; a device that is removed and
signals (Windows) is reported by the check after the wait, as before.

Tested on Linux only (RTX 5080, driver 620.70, GE-Proton11-6's Wine,
vkd3d-proton 30b0eb9), on main + fxceless#177 + fxceless#259, where the world faults the
GPU in every run (Xid 13, fixed by fxceless#542):
* without this, with or without VKD3D_CONFIG=fault: the title's crash at
  +0x23cf683 24 to 30 s after the Xid, in 9 of 9 runs, and no report;
* with this and VKD3D_CONFIG=fault: "device removed: 0x887A0005" 4 s
  after the Xid;
* with this and vkd3d-proton's defaults: the two warnings, then the
  stall report 25 s after the submission began.
New unit test of the wait (no GPU); cargo test --workspace under Proton:
333 passed, the same ten environmental failures as main; clippy
-D warnings with and without --all-features; cargo xtask policy. Not run
on Windows.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit b58b779fdedc4e8724bcab295276c455e587c8f9)
…nto title memory

The 5 s debug summary showed most busy workers neither reading nor
decoding (run-auto-4: 12.5 busy, 0.8 reading). It now also says how many
workers were telling the GPU side of a write (guards opened, copies and
textures marked) and writing physical pages through a buffer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In-place windows and buffers covered private memory only; most of what
the title has copied lies in its page pool (run-auto-11: 137 windows in
place, 2301 turned down as view memory). With the switch the runtime
makes physical-page sections committed (reserved again if the host
cannot), each is opened once as a host heap, which locks nothing, and a
range one run of one section shows gets a buffer placed at its offset.
Such buffers are not held to VICTORY_INPLACE_MB. A view mapped anew lets
go of what was in place there, as before.

Also notes that level 2 hangs the device with the relay (on by default).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The host opens no section of 4 GiB or more (E_INVALIDARG; on the
software adapter 4095 MB opens and 4096 MB does not), and the title asks
for its 6.1 GiB pool in one call, so run-auto-12 opened none of it: 728
windows refused. With VICTORY_INPLACE_POOL=1 the pool is now made of
committed sections of 1 GiB each; runs of pages break at their seams as
they do between allocations. A section the host refuses is remembered
and not asked again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An opened section is resident with the card whole: run-auto-13 opened
four of 1 GiB for 63 MB of windows, the fifth was refused for memory and
command lists then failed to close (E_OUTOFMEMORY). The pool is now made
of 32 MiB sections, opened only where a window lies, and no more than
VICTORY_INPLACE_POOL_MB (2048) of them are opened; past that, windows
are copied as before. The status line says how much is open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
run-auto-16 opened sections up to the 2 GiB cap while the windows in
them were let go (269 remapped), so they held 1952 MB for 453 MB of
windows, and recording a compare then ran the card's share of PC memory
out (E_OUTOFMEMORY). Each open section now counts the buffers placed in
it and is closed when the last goes; the cap is 1024 MB. The status line
says how many were closed again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decoder::decode took the caller's bit count as the end of the frame. Past
the data the bit reader returns zeros, and a stereo tile header reading
only zeros gives the subframe to no channel, so it never moves on; with a
count beyond the data it never overreads either, and looped for good.
Clamp the end to the bits the data holds. A frame from read_frame always
holds its bits, so its decoding does not change.

Add deterministic noise tests (xorshift64, fixed seeds, as BCPack's):
buffers of noise packets, streams of noise frames with clean and damaged
headers, frames in mono and stereo at each sample rate, bit counts past the
data, and read_frame and packet at any offset. Every walk is bounded and
every decode must give one frame of samples. The bit-count test hangs
without the fix; the others pass on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d4d1822)
… frames

A frame that ends in a packet where no frame begins (the tail of a frame that crossed packets, then padding) left the next frame pointing into that padding, which ended the stream early. Now the next frame is found by following each packet's skip to the next packet with frames.

(cherry picked from commit ba42db6)
… forever

The decoder fills an XMA voice's output ring until the write block
(word 0, bits 27-31) comes round to the title's read block (word 9,
bits 0-4). The write block wraps modulo the ring size (word 0, bits
22-26), and so does a read block moved on by command 18, but a read block
the title set up at or past the ring's end was compared as it was: no
write block ever equalled it. With a stream that loops forever the pass
never ended, holding that voice's lock, so the title's next command on
the voice (advance, disable) waited for good, and releasing the context
arrays did too.

Take the read block modulo the ring size as well, as the write side
already does. A test sets up read block 6 on a ring of four with an
endless loop and requires the pass to end within seconds, with blocks 0
and 1 filled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1054fe8)
imdct_half worked out every pre- and post-rotation with sin_cos on each
call (n of them per subframe) and ran its FFT on two fresh Vecs. The
rotations, the bit-reversed order and the butterfly rotations now come
from a table built once for 128, 256 and 512 samples; the work buffers
live on the stack. Every value is computed with the same expression (the
butterflies with the same running product), so the output is bit for
bit what it was.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 4eb0898)
When a frame ended a loop, decode cut it at the loop's end subframe, set
the loop's skip (the subframes of the loop's first frame that lie before
the loop) and then took that skip out of the frame in hand: the loop's
last. So the head of the last frame was dropped instead, and the first
frame played from its start, with the audio before the loop in it. The
number of samples came out the same; the seam did not.

The pending skip is still applied to the frame in hand, and the loop's
skip is set after it, for the frame decoded next.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 985d8d4)
…write

The write block (context word 0, bits 27-31) was used as it is for the first
block of a pass, so one at or past the ring size (bits 22-26) was written
past the ring's end, possibly into another APU allocation, before it wrapped
with (write + 1) % size. Take it modulo the ring first, as the read block is
taken, and as advance_read does.

(cherry picked from commit 7a5d85e)
Read complete payload bytes directly inside an XMA2 packet. Keep the bit reader for packet headers, interleaved stream skips and the final partial byte. Add coverage for all eight alignments at packet boundaries and EOF. On Windows x86-64, 36,720 synthetic reads matched the previous implementation, including returned bytes and the next frame position. A release microbenchmark of read_frame measured 1009 to 168 ns for 128-byte frames and 7977 to 1062 ns for 1 KiB frames (median of nine runs).

(cherry picked from commit 03a6f22)
One upload buffer was made and freed per copy recorded into a list:
155,286 of them (61.7 GB) in run-auto-20, and the driver held 242 blocks
of 32 MB (5.4 GB) of write-combined memory for them. A list now takes a
buffer of the next power of two (at least 64 KiB, at most 32 MiB) from
the ones earlier lists gave back, and gives its buffers back when it is
reset after its submissions ran (or dropped); at most 256 MB is kept.
VICTORY_UPLOAD_POOL=0 makes one buffer per copy, as before.

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

Copy link
Copy Markdown
Author

Overlaps: the watchdog commits match #364; GPU selection overlaps #261/#750 (this one picks by name); some XMA fixes overlap #301, #627 and #877. The new part is the evidence: with upstream's 8 XMA commits the intro stream stops stalling and the 7–11 minute pool crash is gone (36 min in the world, no crash). Happy to split this PR or drop the overlapping commits.

…ory does to the frame

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

Copy link
Copy Markdown

An independent Linux check on ffe4a3a passed 13 built-in XMA tests, with three ignored. A source-built seven-packet stream also preserved a 1,031-bit frame and reached the next frame across an interleaved continuation and empty packet. The same input passes #627, and 0b0074e instead points into padding.

The other synthetic control distinguishes the two implementations. When a packet's declared first-frame position is beyond its payload, #627 rejects it. On main and this head the parser can select a bit in a later packet's header as the next frame. This favors keeping #627's bounds check when splitting the shared packet traversal changes. I also confirmed the APU edits overlap #567 and the deferred loop-start skip overlaps #301.

These results cover the XMA parser and source comparison. They do not reproduce the Windows audio path or attribute the reported 36-minute in-game result to an individual change.

AI-assisted using Codex.

@Ym1r1710

Copy link
Copy Markdown
Contributor

Tried just the 8 upstream XMA commits from this PR on their own (cherry-picked onto current main plus #812, no watchdog / GPU selection / in-place pool commits). RTX 5080 16 GB, Windows 11, Series X profile.

15 min run (stopped it at 904 s myself), no crash, no device removal. Frame rate stayed flat at 6.7-7.0 fps the whole way, including the 7-11 minute window. Cherry-picks applied clean.

So the audio part alone seems to be enough for the pool crash, at least on my setup. Can't say for sure the base would have crashed on this machine though, I didn't do a long run without them.

KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 25, 2026
…tchdog switches and three test fixes listed

The fork now follows victory-fork through a merge of its 3973179. The table
of what the fork adds gains fxceless#955 (pipeline workers, off by default), the
opt-in title watchdog hook from fxceless#959 (off by default, not used in the
measurement recorded here) and the three test fixes fxceless#963, fxceless#952 and fxceless#978.
English and Spanish.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Copy link
Copy Markdown

Linux/Proton follow-up: selected the eight audio-only commits documented below, plus the stricter continuation-packet parser from #627 (b786897). Original authorship/provenance retained. I did not import this PR's unrelated GPU, watchdog or page-pool bundle.

CachyOS, Ryzen 7 9800X3D, RTX 5090, NVIDIA 620.73.04, GE-Proton 11-14 with the pinned Linux runtime. Native formats: 35 passed / 5 ignored. Full HLE: 104 passed / 1 pre-existing Wine failure (missing WSAConnectByList). New malformed-input, continuation bounds, ring wrapping, multi-frame skip bookkeeping and short/misaligned output tests pass. Cached transform and byte-gathering equivalence checks pass. Application build and all-target/all-feature Clippy pass.

Two combined title trials rendered incomplete world scenes, then hit the same existing fixed-pool breakpoint after 518.31 s and 432.27 s. Neither recorded an NVIDIA Xid, native allocation failure or OOM. Both started from verified copies of the same seven-file profile; the second used a separate writable data folder. They also contain half-data changes (and a later shader-analysis correction), and reuse warmed caches, so they are not isolated audio A/B tests. This does not show the audio subset resolving our progression blocker.

An inherited limitation remains: a skip consuming all decoded PCM can still result in a zero output block; the added skip tests cover bookkeeping, not that timing case.

Source pins, tests and limitations: https://github.com/ThomasHFWright/LinVictory/blob/linux-edge/docs/linux-improvements.md
Title results: https://github.com/ThomasHFWright/LinVictory/blob/linux-edge/docs/linux.md

AI-assisted integration/testing with OpenAI Codex. Aggregate results only; no game files, generated data or raw logs attached.

PiloteCode pushed a commit to PiloteCode/victory-fork that referenced this pull request Nov 25, 2026
…ever saved over (fxceless#959)

The author's run 53 found no library at start ("no host pipeline library
yet") where a 1.8 GB pre-build had been, started an empty one and saved
it over the file. A library file that is there but cannot be read or
mapped (held by a scanner, say) is now left alone: no pipelines are kept
that run. One the host rejects (another adapter or driver, damage) is
moved aside as host-pipelines.rejected.bin before an empty one is
started; if it cannot be moved, no pipelines are kept that run either.
Taken alone from the pull request's 23 commits.
PiloteCode added a commit to PiloteCode/victory-fork that referenced this pull request Nov 25, 2026
… jobs not counted finished (fxceless#964), kernel copies when the copy fault handler cannot be registered (fxceless#990), textures picked by index rechecked after their schedule (fxceless#956, VICTORY_HEAP_RECHECK_EVERY/_WHOLE_MB, off), an unreadable pipeline library left alone (fxceless#959), shader-written textures the title reads copied back in the console's layout (fxceless#999, VICTORY_TEXTURE_BACK, off), a test retry (fxceless#952)
PiloteCode added a commit to PiloteCode/victory-fork that referenced this pull request Nov 25, 2026
…device copy jobs, fxceless#990, fxceless#959), fxceless fxceless#995's fixes (saves no longer stopped by error 4395, texture re-check on the texture's own bytes, textures uploaded before a DirectStorage write made due again), legacy squares without their select, and switches for the coherence stages, barriers and copy-back measurements (off); 132 ms a frame in the world at PCIe gen 5
PiloteCode added a commit to PiloteCode/victory-fork that referenced this pull request Nov 26, 2026
…ever saved over (fxceless#959 by Sashwiin Somu, as our 1d594aa)

A library file that is there but cannot be read or mapped (held by a
scanner, say) is left alone: no pipelines are kept that run, instead of an
empty library saved over it (a 1.8 GB pre-build was lost so). One the host
rejects (another adapter or driver, damage) is moved aside as
host-pipelines.rejected.bin before an empty one is started; if it cannot be
moved, no pipelines are kept that run either.
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.