Skip to content

GPU: keep replaced host resources for 6 frames; bigger dynamic descriptor pool, no fallback to stale tables - #135

Closed
mpDom wants to merge 3 commits into
Marvisak:mainfrom
mpDom:pr/gpu-page-fault-fixes
Closed

mpDom wants to merge 3 commits into
Marvisak:mainfrom
mpDom:pr/gpu-page-fault-fixes

Conversation

@mpDom

@mpDom mpDom commented Nov 24, 2026

Copy link
Copy Markdown

Two changes aimed at the host GPU page faults that end the world run (low-address faults such as 0x40da000 / 0x3ba7000).

  1. Defer dropping replaced host resources across 6 presented frames (a title frame spans 8-10 submissions, so the old 2-submission rotation freed textures that later lists of the same frame still read; seen as 'inside freed texture ...').
  2. Dynamic descriptor slots: the 65,536-slot pool ran out under 24-33 lists per frame ('no free dynamic descriptor slots'), and the draw then fell back to the unmirrored static table whose buffer/CBV slots hold 2D null views. Now the pool is 524,288 slots (65,536 when the host caps the heap), a draw or dispatch is dropped rather than run on a stale table or an unbound root view, and missing entries in fresh tables get null views of the kind the shader expects.

Tested: cargo test -p victory-gpu -p xtask (0 failures). Run on RX 6750 XT: the freed-texture crash is gone and the run gets much further into the opening cutscene.

@DaviTostes

Copy link
Copy Markdown

The test build does not compile, same failure as #134:

error[E0428]: the name `tests` is defined multiple times
   --> crates/victory-gpu/src/host.rs:2020:1
     |
 296 | mod tests {
     | --------- previous definition of the module `tests` here
2020 | mod tests {
     | ^^^^^^^^^ `tests` redefined here

The library builds; cargo test fails on every platform, so the GPU suite (Wine + vkd3d-proton here) cannot run even though the production code compiles. The new tests need to go into the existing mod tests in host.rs after a rebase.

No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).

@gw1337x

gw1337x commented Nov 24, 2026

Copy link
Copy Markdown

Tested on an RX 7800 XT (RDNA3, driver 32.0.32015.7029, Windows 11 26200, 31.6 GB): main at d2a4bae + this PR only, diag build with VICTORY_D3D12_DRED=1.

Before (same PC, main at 9aef3d9 / 35b054e builds): every world run logged no free dynamic descriptor slots 2–17 s before a low-address page fault (0x27ab000 at 91 s, 0x3810000 / 0x3813000 at 58 s). Details are in #59.

With this PR:

  • No no free dynamic descriptor slots warning, and no low-address fault.
  • The opening cutscene runs at 1–2 fps, and the run lasts 155 s instead of 58–91 s. Its subtitles show and the audio plays in full, but there is no picture (no world geometry).
  • Per frame, about 450 ms goes to title memory copies (~350 MB per frame) out of ~800–1200 ms.

It still ends on a page fault, now in freed textures:

host GPU device removed after a submission of 11 lists; page fault at 0x3a0b70000;
inside freed ["texture 2048x2048 f71 flags 0x0 (type 34)", "texture 1024x1024 f98 flags 0x0 (type 34)", "texture 2048x512 f98 flags 0x0 (type 34)"];
the nearest title memory copy below it: 0xb16800000+0x400000 at host 0x3a0500000, offset 0x670000

Breadcrumbs: only list 0 has finished, and it is 2 commands (2/2, a prelude of state transitions). List 1 (0/506) and everything after it had not started. So the access to the freed texture seems to come from list 0 (a transition on a texture already released) or from work still in flight from the previous submission. Six presented frames looks too short for at least these textures at ~1 fps.

@ifBars

ifBars commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

On Windows 10 22H2, RTX 3060 Ti 8 GB, driver 610.88, I tested the three commits through 9dac364 with #124 and our existing SRV table snapshots. The same setup previously lost the device about 17 seconds after the first heavy world frame. This time the run ended at its 36-second world limit. Windows logged no display reset. The title card faded and subsequent native captures were black. World samples were 0.8–1.2 fps, with a cold host pipeline cache.

The NVIDIA-specific detail is that the host still capped the view heap at 1,000,000 descriptors. We still reached the warning for an eight-slot table with a 65,536-slot dynamic reserve. The fresh-table failure now skips the draw. This run shows that exhaustion can occur without an immediate device loss. It does not isolate which change helped or establish stability beyond the test window.

@HenriqueSBueno

Copy link
Copy Markdown
Contributor

Tested on NVIDIA, where the host caps the view heap. Windows 11, RTX 3080 (driver 616.92), retail title, diagnostics build.

WARN victory_gpu::descriptor::host: host view heap capped at 1000000 ... count=1245184
WARN victory_gpu::descriptor::host: no free dynamic descriptor slots: a table is not made n=8 cap=65536
INFO victory_gpu::host: dropped .../frame without a host pipeline: indirect kind 0|1|2|10: prepare failed ...
  • Scale: about 350 dropped indirect draws/dispatches a frame across kinds 0, 1, 2 and 10 (55 meter lines in ~3 minutes in the world).
  • Cause: a shader reads a root view the title did not set doesn't occur, so the drops come from the dynamic slot exhaustion. On a capped heap, DYNAMIC_CAPPED is 65,536. The tables past the static part are forced into dynamic slots too, and that isn't enough for this title's world.
  • Picture: the world is still black here with or without this PR, so this isn't the only cause of the black screen.
  • Next: I'm looking at giving dynamic slots back on fence completion, or splitting the cap differently. I'll post it as a follow-up PR if it holds up.

AI-assisted (Claude Code)

@tightfall

Copy link
Copy Markdown

Tested on RX 9070 (RDNA 4), Windows 11, Adrenalin 26.11.2: a clear improvement. The world runs 5–6× longer before the device is lost, and the descriptor-slot exhaustion is gone. The remaining removal is still a fault inside freed textures.

Build: PR head 9dac364, merged locally with main at d2a4bae. The head on its own fails cargo test with E0428 (mod tests defined twice in crates/victory-gpu/src/host.rs), which #129 fixed on main, so a rebase might be worth it. Merged: cargo test --workspace 264 passed, 0 failed, 4 ignored. Series X mode, keyboard input.

main eda38aa, release this PR, release this PR, diag + VICTORY_D3D12_DRED=1
World start → device removed ~30 s ~2 min 40 s ~3 min 20 s
no free dynamic descriptor slots 1× 0 0
Draws per frame in the world up to ~1,650 up to ~3,000 up to ~1,100

With the PR, the opening cutscene plays at roughly 0.5–1.5 fps with partial frames (many draws dropped for untranslated shaders). Audio keeps going the whole time.

Remaining removal (PR, diag, DRED):

  • page fault at 0x3b9a19000; inside freed ["texture 1024x1024 f98 flags 0x0 (type 34)", "texture 1024x1024 f98 …", "texture 1024x1024 f99 …", "texture 1024x1024 f99 …", "texture 2048x2048 f98 …"]
  • submission of 11 lists; one list stopped at command 80 of 95 (op 42, DispatchMesh): mesh 1 [mesh 857b2e13c9cc107f, pixel 63051e97862e7dad]

So on this card a read of freed BC7 textures still happens, just much later. Maybe 6 presented frames isn't enough when a frame takes 1–2 s, or another retirement path still frees too early. I can rerun with other variables if that helps.

For #59: a DRED run on plain main (eda38aa, with VICTORY_D3D12_DEBUG=1) on the same card faulted somewhere else: page fault at 0x80000381d000, outside every title copy and heap, with a list stopped at command 80 of 104 in an ExecuteIndirect (op 5).

AI-assisted (Claude Code): log analysis and this write-up. The runs were done by hand.

@ka1qux

ka1qux commented Nov 24, 2026

Copy link
Copy Markdown

Test report from another machine, in case it helps: Windows 11, Core i5-13600KF, RX 7800 XT, diagnostics build with VICTORY_D3D12_DEBUG=1 and VICTORY_D3D12_DRED=1.

Build: main at d2a4bae with this PR, #205 and #214 merged (they merge cleanly).

Result (one run):

  • The dynamic-slot part works here: no no free dynamic descriptor slots warning, and no low-address page fault. On main I had that warning 4 to 10 s before a low-address fault in five runs out of five.
  • The freed-texture fault is not gone here. The world ran about 55 s and ended with:
page fault at 0x475e26000; inside freed ["texture 1024x1024 f98 flags 0x0 (type 34)", "texture 1024x1024 f71 flags 0x0 (type 34)"];
the nearest title memory copy below it: 0x726000000+0x400000 at host 0x4755c0000, offset 0x866000

Two observations about that second fault, from earlier runs on main. I am not sure of the cause; this is what I measured.

  1. In one run I numbered the host textures and logged their history. The texture the fault fell in had been created 30 s earlier, was never the resource of any descriptor slot, had one holder when the title released it, and was freed at once. The fault came 2 s later. So in that run the freed texture was not something a later list still read; it only occupied that address range.
  2. In four of eight such faults the address was just past the end of a 4 MiB copy of loose title memory (shadow::loose): 24 KB, 96 KB, 116 KB and 116 KB past it. In the other four it was 2.4 to 5.1 MB past the nearest copy, which is about what chance would give with ~900 copies, so those four say nothing either way.

My reading of (2), unconfirmed: a root view has no size, root_view gives it the one window its address is in, and what the shader reads past that window's end lies in another host buffer. The read runs off the copy into whatever is next in host address space, which faults once that neighbour is freed. One experiment in that direction: giving root views one copy per aligned 32 MiB block with an 8 MiB tail ran the world for 4 minutes without this fault (one run, ended by me), but took the process's shared video memory from about 8 GB to 14.5 GB of a 15 GB budget, so it is not something I would propose as it stands.

I have not tested this PR alone, only together with #205 and #214.

@ka1qux

ka1qux commented Nov 24, 2026

Copy link
Copy Markdown

Follow-up to my comment above, with a correction and one new measurement. Same machine (i5-13600KF, RX 7800 XT), same build (main at d2a4bae + this PR + #205 + #214), plus local diagnostics.

Correction: my root-view reading did not hold up. I tested it directly. On the next freed-texture fault the report went through the 4,000 noted commands around the last one the GPU reached (1,579 of them with root views) and looked for a root view whose host copy ends up to 16 MiB before the faulting address. It found none; the fault was 22 MB past the nearest copy of title memory. So for that fault a root view running off its 4 MiB window is not the cause, and the four small distances I listed may well have been chance. Please do not build on that part of my comment.

What still stands from it: this PR removes the dynamic-slot warning and the low-address fault here, and the freed-texture fault remains (two more runs: about 55 s and 85 s in the world).

New: on the software adapter the world's first frame dies in compute dispatches that index the title's own null descriptors. With VICTORY_D3D12_WARP=1 the run ends at the first world frame with a read of address 0 in host-generated shader code. A marker written with WriteBufferImmediate in MARKER_OUT mode before each noted command (exact on WARP, which runs commands in order) names the dispatch:

  • [compute d3e44e754b3eb6aa], 51x1x1: user data u6=0x0 and u8=0x6, used as heap indices. Slot 0 holds the title's view Shader(0, [42, 2, ...]) (no resource, R32_UINT, TEXTURE1D) and slot 6 Unordered(0, 0, [42, 4, ...]) (no resource, TEXTURE2D).
  • With that pipeline skipped (VICTORY_SKIP_PIPELINES), the next one dies the same way: [compute da1656ad2910e4c7], 35x1x1, u6=0x0, u8=0x0. The dispatches noted right after it (010a50ce68d02c16, 1547305c505a7559, 31430354dd5c259c) also have u8=0x0.

So the title keeps a null view at slot 0 (and 6) and points shaders at it whatever kind they read there. GPU-based validation had reported the same slot earlier for other pipelines ("SRV Dimension Expected: TEXTURE2D, In Descriptor: TEXTURE1D, Descriptor Heap Index: [0]"). The null views this PR and #205 fix are the ones we write; these are views the title wrote, and one descriptor cannot have the right kind for every shader that indexes it.

I do not know whether this matters on a real GPU: on the RX 7800 XT these dispatches run without a fault with this PR. It does stop WARP from getting far enough to catch the freed-texture fault at its exact command, which is what I was after.

@tightfall

Copy link
Copy Markdown

Follow-up to my earlier comment: an experiment on RX 9070 (RDNA 4), Windows 11, Adrenalin 26.11.2, same base (this PR at 9dac364 merged with main at d2a4bae), diagnostics build with DRED.

Change (experiment only, not a fix): KEEP_FRAMES in take_retired set to u64::MAX, so retired host resources are never dropped.

PR as is never drop retired
world time until device removed ~3:25 ~6:45
fault inside freed BC7 textures (1024² / 2048², f98/f99) no freed allocation named
retired resources held at the end – ~4.2 million entries (most are repeated references, VRAM did not run out)

So the remaining freed-texture fault is retirement freeing too early: something still reads those textures more than 4 presented frames after they were retired. The ages in presented frames are probably not enough on their own here.

The second run then ends with a different fault: a page fault 0x6000 past the end of a 4 MB title memory copy (offset 0x406000 into a 0x400000 window), during a submission of 23 lists, with mesh pipelines and ExecuteIndirect in flight. That looks like a read past the copied range, not a lifetime issue.

Next I want to log, in diagnostics builds, why and when each texture is retired and dropped, so the texture DRED names can be traced back to the path that freed it.

No game data in this comment. AI-assisted (Claude); tested only on the GPU above.

AntoninMichelq pushed a commit to AntoninMichelq/VIctory-forkAMD that referenced this pull request Nov 24, 2026
…rames, not the title's 60 Hz clock) into the integration

Retirement now waits for both the submissions running at retire time
and KEEP_FRAMES presented frames. A dynamic table holding constants that
finds no slots drops the draw; other tables still fall back to the
title's slots. DYNAMIC grows to 1<<19 (1<<16 when the heap is capped).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
AntoninMichelq pushed a commit to AntoninMichelq/VIctory-forkAMD that referenced this pull request Nov 24, 2026
…slots; more dynamic slots) into the integration

Already covered by PR Marvisak#135's merge (DYNAMIC 1<<19, drop on unmade
table): the branch's resolution is kept. Constant tables that find no
slots drop the draw, and other tables fall back to the title's slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
@ChruutvoLuzi

Copy link
Copy Markdown

NVIDIA numbers for the DYNAMIC_CAPPED split. RTX 4090, driver 621.01, Windows 11; the host caps the view heap at 1,000,000 and the title asks for 1,245,184. The builds are main at d2a4bae plus other PRs. The larger reserve came from #134, which uses 1 << 19 on the capped heap as well, so the title keeps 475,712 slots there.

Dynamic slots on the capped heap World runs no free dynamic descriptor slots title slot past the host heap
65,536 (as on main) 3 in all 3, 6 to 10 s before the device was removed (n=7, 20, 29) 0
524,288 (#134) 6, the longest about 75 s in the world 0 0

One caveat about the last column. In one of the 65,536-slot runs, the DRED report shows the title's user data pointing tables at view-heap slots up to 917,140: 12 different slots above 475,712, all null (never made, or left null). So the title does use slots past 475,712, even though mirror() never logged one in the 524,288-slot runs. A silent title slot past the host heap may therefore not prove that the title stays below the cap (the latest comments in #71 read it that way). I haven't checked how such a table is bound when it falls past the mirrored part.

AI-assisted (Claude Code).

@sennecools

Copy link
Copy Markdown

Tested on RX 9070 XT (RDNA 4), Windows 11 build 26300.9974, Adrenalin 26.11.2 (driver 32.0.32029.2010), offline. The dynamic-slot part works here: the warning and the low-address fault are gone. The run lasts 2.4× longer and now ends on a freed-texture fault, like the other reports above.

Build: PR head 9dac364 merged locally onto main at d2a4bae (clean merge), changes used unmodified. diag profile with --features diagnostics, VICTORY_D3D12_DRED=1, VICTORY_GPU_TIMING=1, input via VICTORY_KEYS (Enter every 10 s from 20 to 120 s). The baseline is main at d2a4bae with the same profile, switches and key script.

main d2a4bae, diag + this PR, diag
Process start → device removed 64 s 154 s
no free dynamic descriptor slots 1× (~1.3 s before removal) 0
Fault low address, no title memory copy below it, not in the view/sampler heap inside a freed 2D texture
Stopped list command 1290 of 3189, op 42 (253 of 255 lists finished) command 99 of 198, op 5 (ExecuteIndirect)
Heavy scene 1000-2000 draws/frame at ~1 fps (release run) up to 6207 draws/frame at ~1 fps

On main the removal was 0x887A0006 (hung), process exit 0x887A0005. The fault address is a low address in the same 0x37xxxxx-0x38xxxxx range as the other low-VA reports in #59. All 12 commands in flight between the stopped list's barriers were mesh dispatches (1-37 groups) of one mesh+pixel pipeline. Its u9/u10 are constant-buffer tables, which are the ones tables() remakes in dynamic slots.

A release run on d2a4bae without switches lost the device the same way: DXGI_ERROR_DEVICE_HUNG ~55 s after the 3D scene started, during submissions of 255-258 lists.

Mechanism, from reading d2a4bae (not instrumented): in crates/victory-gpu/src/draw.rs, tables() remakes every table that holds a constant buffer in dynamic slots. When HostHeap::dynamic(n) (descriptor/host.rs) returns None, tables() skips that table with continue, and bind then passes the table's title-heap offset, so the shader reads whatever the title's slots hold. The warning is behind a Once, so every failure after the first is silent. That matches one warning followed by a fault in constant-buffer-table mesh draws. With this PR the warning (same text, same Once) never appeared, so in this run the pool never ran out: the larger pool (DYNAMIC 2^16 → 2^19) is what removed the fault here, and the new drop path was not exercised.

Remaining fault: the freed-texture class that the RX 7800 XT and RX 9070 reports above also hit. It is consistent with retirement still freeing too early at ~1 fps.

Scope: one run per configuration in game, on one machine (one release and one diag run on main, one diag run with this PR). I did not test #134 separately.

AI-assisted (Claude Code): analysis and write-up; runs done on my machine.

@itsonlysimbo

Copy link
Copy Markdown

NVIDIA data point for the capped-heap path: DYNAMIC_CAPPED = 1 << 16 still runs out in the world, and 1 << 18 did not run out in any of my runs.

Setup: RTX 4070 (driver 32.0.16.2101), Windows 11. main at d2a4bae + this PR + #251, diagnostics build, DRED on. The host refuses a view heap over 1,000,000 descriptors on this card ("host view heap capped at 1000000" at start), so this PR takes the capped branch.

With DYNAMIC_CAPPED = 1 << 16: "no free dynamic descriptor slots: a table is not made" about 50 s after start, in the first world frames. The drop from this PR held (the draws were dropped, no fallback to the stale table), but the pool stayed exhausted.

With DYNAMIC_CAPPED = 1 << 18 (737,856 title slots left below the cap): the warning never appeared, in 9 world runs of 79–160 s each (also with #402, #393, #329 and #307 on top in some of them). No "title slot past the host heap" warning appeared either.

Before this PR (plain d2a4bae), the same exhaustion was followed by device removal 1–68 s later in every run, the same pattern #336 describes.

The device removals that remain after this change are a separate problem: no page fault, a different mesh or compute pipeline almost every run, and still there with the pool fixed. I'll post those separately if they turn out to be useful.

Written by Claude Code (Claude Opus 5.5), which ran the builds and read the logs.

@blazerTweaks

Copy link
Copy Markdown

Tested on NVIDIA, where the heap is capped: RTX 3060 Ti (Ampere, driver 32.0.16.1714), Windows 10 19045. The base is d2a4bae + the Agility exports (#175), and the other run is the same + this PR (9dac364) merged cleanly. Diag build, VICTORY_D3D12_DRED=1. One run each.

without #135 with #135
time in the world before device removal 36 s 3 min 07 s
no free dynamic descriptor slots once, then removal 40 s later once, 12 s into the world (n=258 cap=65536); no removal at that point
DRED stop indirect kind 10 [mesh 09c742c58e9acb62, pixel 9ee9a1b0ecdf7b74]; its table root u9 is view 1,168,095, past the 1,000,000 cap mesh 159 [mesh 4adfa13bea1c556a] at command 3 of 70 (op 42); its tables are at views 329,720 and 911,918, below the cap
page fault none none
last submission 4,832 ms, 32 lists 5,331 ms, 26 lists

My reading:

No regressions seen before the world: menus, intro, start screen and loading behave as without the PR.

AI-assisted (Claude Code); the runs are mine.

@blazerTweaks

Copy link
Copy Markdown

Follow-up on the same RTX 3060 Ti (Windows 10 19045). This time a release build (d2a4bae + #175 + this PR, --features agility, no DRED/diagnostics):

  • 7 min 42 s in the world with no device removal. I closed the window myself (the log has window closed and no host GPU failure). The diag run above was removed after 3 min 07 s, and without this PR it's 36 s.
  • no free dynamic descriptor slots ... n=97 cap=65536 still fires once, 4 s into the world, and no hang follows.
  • The opening credits render correctly over the world. The 3D scene behind them stays black: about 450–600 draws per frame run on the host and the rest are dropped "without a host pipeline".
  • Frames take 4–12 s. Late in the run most of that is preparing: copies (up to 6.5 s and about 77 MB per frame), with 1.5–3 s on the GPU.

So on this card, with this PR, the remaining limits are untranslated programs and copy cost, not device loss.

AI-assisted (Claude Code); the run is mine.

@itsRevela

Copy link
Copy Markdown
Contributor

Measured with the title, in the opening cutscene:

In the cutscene, the pool runs out: no free dynamic descriptor slots: a table is not made n=133 cap=65536. On this NVIDIA setup the shader-visible view heap is also capped: host view heap capped at 1000000 ... count=1245184.

Without this PR the same warning appears and the draw goes ahead. With it, the draw is dropped:

without #135 with #135
indirect kind 10: prepare failed (compute false, mesh true) none ~430 dropped per frame
scene depth buffer differing from its clear value 4.9-5.5% 0.8-2.8%

So in the cutscene, dropping instead of falling back loses about 430 indirect mesh dispatches a frame that drew before, and with them most of the little depth the scene had. The fallback tables were stale, so they weren't right either, but they drew something. Two things that might help:

  • a pool sized from what's left in the shader-visible heap, which here is the 1,000,000 cap less the static part;
  • recycling slots per frame before giving up.

Counts only. AI-assisted (Claude Code).

@Marvisak Marvisak closed this Nov 24, 2026
edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
… dynamic descriptor pool, no fallback to stale tables

Resolved: draw.rs keeps HEAD's drop-on-missing-table (#336); dynamic pool takes the PR's 2^19 with 2^16 when capped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
…, refreshing only changed slots

Resolved: descriptor.rs replays queued writes before publishing the heap (HEAD) and wraps it in an Arc (PR); host.rs runs prepare_bindless then take_retired (#135), Batch::flush keeps HEAD's coalesced ranges; pipeline.rs takes the PR's translate with HEAD's wave target; watch.rs takes the PR's (HEAD's unguarding inside); buffer_uav keeps HEAD's raw-window fallback; tests from both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
arnoudstorm pushed a commit to arnoudstorm/VIctory that referenced this pull request Nov 25, 2026
Resolved the conflict in emit/lower.rs by keeping both new helpers
(f64_bits_to_f32_bits from Marvisak#134 and src64_dwords from Marvisak#135).

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.