Bug: GPU reset (TDR) on the first world frame since #352 (physical pages from 2 MiB sections), even with VICTORY_SECTION_MB unset #428
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX#428
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@jean-melikian on GitHub · 2026-11-26 18:18 UTC · original
Summary
Since
mainincludes #352 (ee8b92e1"perf(victory): physical pages from 2 MiB sections (VICTORY_SECTION_MB, off by default)" and its mergeba38fae6), every session on my machine ends with a GPU reset (Windows TDR,nvlddmkmevent 153) on the first world frame after loading a save, about 35-45 s after the story packs open.VICTORY_SECTION_MBis not set (default, off).Reverting only #352's changes under
third_party/victory(inplace.rs,victory-gpu/src/lib.rs,victory-hle/src/modules/xmem.rs, restored fromcd5c44d) on top ofce0f90fremoves the TDR: the game reaches the world, runs, and passes 5 stable minutes.Environment
victory.exe run <game exe> --executedirectly (not through the launcher), same environment forwarmandrunBisection
cd5c44dcd5c44d+ #392ce0f90f+ #392 (+ #381, #389, #350 in some runs)ce0f90fstory000openedce0f90fwithout #352cd5c44dOther suspects were ruled out on the way:
VICTORY_HEAP_SCAN_ALT(#394): TDR with it unset and with=0(we don't use the launcher, so it was never on).VICTORY_KEPT_VIEWS_YIELD): TDR with=0.cd5c44d.The only
third_party/victorycommits incd5c44d..ce0f90fareed60e312(#394),ee8b92e1andba38fae6(#352).What I ran
Environment (identical for every run in the table):
Expected
Same behaviour as
cd5c44d: the world loads and the game keeps running.What happened
On
ce0f90f, the first world frame is very heavy in copies, then the driver resets the GPU about 5 s later.ce0f90f(TDR), lasthostline before the reset:Windows System log:
nvlddmkmevent 153 a few seconds later (no event 13 in that run; some otherce0f90fruns loggednvlddmkm13 "SM Warp Exception: MMU Fault"). The pipeline library loaded fine (host pipeline library loaded bytes=542221118 mapped=true), so this is not a cold pipeline rebuild.ce0f90fwithout #352 (OK): the first world frames copy 100-186 MB instead of ~892 MB, and the session continues into the world.Possible cause (reading the diff)
With
VICTORY_SECTION_MBunset, #352 should behave like before. One behaviour change does apply in that case: when a section closes, the GPU side now unmaps its own view of it immediately. Before, the view stayed until the handle number was reused. A copy still writing through that view would then fault and fall back, which could explain the huge copy frame (and, withVICTORY_QUIET_BACK=1, possibly the hang). I haven't verified this withVICTORY_D3D12_DEBUG=1.Unrelated, for context
Even with #352 reverted, long sessions (~10-12 min) still end with
host GPU device removed(no TDR) after shared memory climbs to ~9 GB and the log showsno free dynamic descriptor slots. That is a separate issue, reported in #412.AI assistance: the bisection runs were driven and analysed with an AI assistant (Claude); the measurements come from my own sessions on my machine. No game files are included.
@KainanP on GitHub · 2026-11-26 20:11 UTC · original
Thanks for the careful bisection, @jean-melikian. #352 was mine, and your reading matches the diff: with
VICTORY_SECTION_MBunset it was meant to be a no-op, but it also changed when the GPU side drops its own view of a closed section (now immediately, before only when the handle number was reused). A copy still in flight through that view can then fault. I'm preparing a fix that restores the old behaviour exactly when the switch is off, and with the switch on unmaps a closed section's view only after the submissions that may use it have finished. I'll link the PR here; if the maintainer prefers, reverting #352's three files is also safe in the meantime.AI use: Claude Code (Claude Opus 5.5).
@KainanP on GitHub · 2026-11-26 20:19 UTC · original
Follow-up on the fix I said I was preparing. Short version: current
mainno longer contains #352, so there is nothing left to revert there, and I am not opening a PR against it.Cause (on
ce0f90f, the tree you bisected). WithVICTORY_SECTION_MBunset, #352 changed two things on the GPU side. Both ran on every section close:Drop for Section(xmem) called the newvictory_gpu::title_memory_section_closed. That function unmapped our own view of the section (VICTORY_QUIET_BACK'shost_aliasview) at once. Before #352, that view stayed mapped until Windows reused the handle number. A copy-back already writing through it (host::write_alias) then faulted and took the fallback path.host_aliasstopped finding it for views that were still in the map.The allocator part (
allocate_physicalwith one section per request) also differed slightly with the switch off. A page count too large to multiply now set*count = 0; before, it was left unchanged. Thedebugline was also logged before the host call instead of after it. Neither difference is GPU-related.Where
mainis now. #409 replacedthird_party/victorywith the combined base, and its PR body listsVICTORY_SECTION_MB(ee8b92e) among themaincommits the new base does not carry. On37d46867there is notitle_memory_section_closed, noVICTORY_SECTION_MB, and noallocate_physical:XMemAllocatePhysicalPagesmakes one section per request again. The new base has its owntitle_memory_section_gone, which unmaps our own whole-section view when a section is dropped. That is upstream (VIctory-7900XTX) code, not #352. Its only users are CPU writes (land,titlewrite,watch), and they holdwatch::title_memory_readingwhile they use the view, which keeps the title from unmapping and so from dropping the section. GPU submissions never go through that view, so the fault path described above does not exist there.@jean-melikian, could you check whether current
main(the combined base) still gets the TDR on your 3080 Ti on the first world frame? Your environment variables are from the Neptune base, and most of them (VICTORY_COPY_COALESCE,VICTORY_MERGE_SUBMISSIONS,VICTORY_STEP_INDEX, ...) are not read by the new base. Useanyxboxx runwith the default set, or the Windows/NVIDIA profile. If it still resets, it is a new bug in the combined base and I will look at it separately. If it doesn't, this issue can be closed as fixed by #409.The same change was proposed to VIctory as Marvisak/VIctory#3177. It has no GPU side at all (no close hook, no unmap), but I pushed a change there (9bfd4aac) so that with
VICTORY_SECTION_MB=0the allocator behaves exactly as before, plus a test for the count case.AI use: Claude Code (Claude Opus 5.5) read the diffs and wrote this; not tested in game.