Skip to content

D3D12.X: unmap sparse tiles after the work the title's queues were given - #496

Draft
notdxbi wants to merge 1 commit into
ivall:mainfrom
notdxbi:pr-unmap-after-title-work
Draft

notdxbi wants to merge 1 commit into
ivall:mainfrom
notdxbi:pr-unmap-after-title-work

Conversation

@notdxbi

@notdxbi notdxbi commented Nov 24, 2026

Copy link
Copy Markdown

When the title unmaps physical pages in a sparse window, sparse::decommitted unmapped their tiles (UpdateTileMappings to NULL) on the sparse queue at once, ahead of work still in flight on the title's queues that reads or writes those tiles. While a retail game streamed its world (Linux, RTX 5060), NVIDIA's MMU faulted in a copy engine (NVRM Xid 31 … ENGINE CE0 … FAULT_PTE, a GPU VA with nothing mapped) and the device was lost. Now each known title queue signals a fence of its own and the sparse queue waits for it before unmapping; nothing waits on the CPU. Part of #175 / #248.

What is in it

  • hle/d3d12x/sparse.rs: after_work_on(state, queues), called by decommitted with present::known_queues() before unmap_tiles; one fence per title queue (a fence shared by several queues could go backwards).
  • Test unmapping_waits_for_work_on_title_queues (GPU): with a title queue held on a gate fence, the sparse queue's next signal does not complete until the gate opens. Without the change it fails ("the unmap queue went ahead of the title's work in flight").

Tested

Regression run

  • None: scripts/smoke.ps1 needs Windows (see Not tested).

Not tested

  • Windows: no Windows machine here, so no scripts/smoke.ps1 blocks and no MSVC build; this PR needs someone to run the regression on Windows before it can be merged.
  • AMD.

AI use

  • Claude Code with Claude Opus 5.5: found the cause, wrote the change, the test and this description. The runs and numbers are real, on the hardware above; the PR is opened by me after checking them.

🤖 Generated with Claude Code

When the title unmaps physical pages in a sparse window,
sparse::decommitted unmapped their tiles (UpdateTileMappings to NULL) on
the sparse queue at once, ahead of work still in flight on the title's
queues that reads or writes those tiles. While a retail game streamed
its world under Wine on an RTX 5060, NVIDIA's MMU faulted in a copy
engine (NVRM Xid 31, a GPU VA with nothing mapped) and the device was
lost. Now each known title queue signals a fence of its own and the
sparse queue waits for it before unmapping; nothing waits on the CPU.
In the same scenario the fault did not happen again.

Test unmapping_waits_for_work_on_title_queues: with a title queue held
on a gate fence, the sparse queue's next signal does not complete until
the gate opens. It fails without the change.

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.

1 participant