Skip to content

Device hung on AMD: the GPU reads retired textures after the registry released them; --placed-textures avoids it #23

Backlog

Description

@Sr-0w

On an RX 7800 XT the device hangs (DXGI_ERROR_DEVICE_HUNG) 3 to 8 minutes into the opening cutscene. DRED puts the page fault in a retired texture that GpuTextureRegistry released after its grace period. With --placed-textures the same boot ran past 10,000 presents without a device removal.

Setup: RX 7800 XT (16 GB), Adrenalin 32.0.32029.2010, 64 GB RAM, Windows 11 26300. main at 72b7328 plus #20 and #21. Run with --d3d12-dred --sample-threads 30.

What DRED says

A local change named every retired texture fs-retired-<console address> at retirement (ID3D12Object::SetName). Every device removal looked the same: reason 0x887a0006, then a page fault on a recently freed retired texture.

ERROR [d3d12-debug] device removed: reason 0x887a0006
ERROR [d3d12-debug] DRED page fault at GPU VA 0x60a846000
ERROR     recently freed: fs-retired-25a921b0000 type 34
ERROR     recently freed: fs-retired-25b009b0000 type 34
Boot Presents at removal Freed texture(s) DRED names
main ~6,000 fs-retired-25a921b0000, fs-retired-25b009b0000
main + descriptor tracking (below) 11,400 fs-retired-2f5ae060000, fs-retired-2f57b460000
same 5,400 fs-retired-27a91b80000
same 5,400 fs-retired-27b0df28000: 512x1024 BC7 made by slot 70, retired at present 5,141, released at 5,261
same 6,000 fs-retired-231cab00000 (1024x2048 BC1), fs-retired-230abf00000 (1024x1024 BC7), fs-retired-230da500000 (3840x2160 R8G8B8A8_UNORM_SRGB, GPU-written)
--placed-textures none by 10,200 the boot ended on an access violation inside CreatePipelineState (amdxc), not a device removal

At removal the queues were only about 0.15 s behind, so the GPU was not running 120 presents late.

What I tried that did not fix it

The registry releases a retired texture once its grace period ends, whatever still names it. docs/gpu-resources.md lists this as a limit that had not been seen ("the game rewrites its views when it reuses memory").

I tried counting, per texture, the desktop descriptors that hold a view of it, and releasing a retired texture only once that count was zero. The count covered:

  • slot-70 views;
  • SRVs and UAVs created on a slot-133 texture's own resource;
  • desktop copies, which propagate the source's texture;
  • every other write or copy over a descriptor, which lets go of the view it held.

It did not stop the faults. The textures DRED named had all been viewed (1 to 4 times), and every one of those descriptors had been written over by a later slot-70 write to the same handle before the texture was retired. So whatever the GPU reads them through is not a desktop descriptor the loader writes. I could not find that path.

Why placed textures avoid it

With --placed-textures, a released read-only texture gives its range back to a 256 MB heap that stays alive. A stale read then hits mapped memory, as it would on the console, where a descriptor names memory rather than an object. Without it, the committed resource is freed and its VA unmapped, and the GPU page-faults. GPU-written textures are still committed in both modes. One of the textures above was a GPU-written target, but no removal happened with placed textures.

Questions

  1. Is there a reason --placed-textures is off by default? On this machine it is what keeps the opening cutscene running.
  2. Do you know of a path by which programs reach a texture without the desktop descriptor the loader wrote? For example, records the game keeps outside its heaps, with an index the loader has since reused. If so, keeping released textures' memory mapped (placed or in heaps) may be the right fix, rather than tracking descriptors.

I can share the logs or the diagnostic patch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions