startup: descriptor copies from a shader-visible heap crash the NVIDIA driver #3560
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#3560
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?
@Jess-Doit on GitHub · 2026-11-30 06:08 UTC · original
Summary
On an NVIDIA GTX 1060, all four
startup_resource_retire_views_*_hardwaretests crash with an access violation inside the driver'sCopyDescriptorsSimple. The same tests pass on WARP.The crash happens on the first descriptor copy in case 2 of
tests/startup_resource_retire_views.cpp, a guest copy from the shader-visible heap into a CPU-only staging heap.copy_descriptor_runinsrc/startup_stubs/d3d12_xs_device.cppforwards it unchanged to the desktop device, so the source handle is in a shader-visible desktop heap.Desktop D3D12 requires the source descriptors of
CopyDescriptors/CopyDescriptorsSimpleto be in a non-shader-visible heap, because shader-visible heaps may live in memory the CPU cannot read reliably. WARP tolerates the copy, but this driver faults on it. A console title can legally copy out of a visible heap, so this is a runtime gap and not only a test issue.Evidence
mainat2ff74a6a.CopyDescriptorsSimplefor one descriptor, with the source in the shader-visible heap and the destination in the CPU-only heap. The shim's own bookkeeping after it never ran.retire_reasons_hardwareandretire_title_hardware_debug0/1, are separate. They fail an expectation instead of crashing. The title cases are the heap2 retention result reported on #2468.Possible fix
Keep a CPU-only desktop mirror for each shader-visible heap. Write every view, sampler and copy destination to both the mirror and the visible heap, and use the mirror as the source whenever a copy reads from a visible range. This also gives the capture and retire code a readable copy. I'm happy to prepare a PR if this direction is acceptable.
Ready for more review
@Jess-Doit on GitHub · 2026-11-30 06:28 UTC · original
A note on fix options, after reading
view_slot,copy_descriptor_run,note_copyand the heap creation path onmain44a3ad5a. Each option changes a different amount, so I'd like a direction before opening a PR.copy_descriptor_run, when a source run lies in a shader-visible desktop range, rebuild each source descriptor at the destination from its view record (slot, resource, description), the same wayview_slotwould. Visible-heap writes stay as they are, so this is the smallest change. It depends on the record's resource still being alive when the copy happens, which holds with retire on but needs a check with it off. It also cannot rebuild a descriptor that has no record.view_slotneeds a second write, including refused and default views and the console sampler, and the heap uses twice the descriptor memory.ExecuteCommandLists. Copies become trivially valid. It is the largest change:shadow_slot,note_heapand the internal heap users assume the desktop CPU handle is the visible heap.My preference is 2, because it matches desktop semantics exactly and keeps the shadow tracking keyed as it is today. Option 1 is the quickest if you'd rather start small. The fixture already exists: the four retire-views cases crash on the GTX 1060 and should pass with any of these options.
Ready for more review
github-bot referenced this issue2026-11-30 12:45:37 +00:00
@mumba17 on GitHub · 2026-11-30 13:58 UTC · original
Independent NVIDIA data point. On main
077bff3a, Release, Windows 11 build 26300, RTX 3090 (Ampere, driver 32.0.16.1664):All 8 passed:
hardware_debug0,hardware_debug1,keep_hardwareandnoretire_hardware, plus the four WARP variants. None of them crashed inCopyDescriptorsSimple.So the fault does not reproduce on every NVIDIA driver. It appears on the GTX 1060 (Pascal, 32.0.15.6094, Windows 10) and not on Ampere with a current driver. The copy is still outside the D3D12 rules, so a passing NVIDIA run cannot serve as the regression check here.
The debug layer does catch it deterministically. In
startup_resource_retire_views_hardware_debug1, the RTX 3090 logs message ID 654 for the first copy:The test still passes, because nothing fails on that message. Whichever fix option is chosen, the fixture could assert that message 654 no longer appears, which checks the contract on any adapter. A copy-source assertion in the shim would work too.
(Edited: the first version of this comment said the debug layer did not flag the copy. It does, as shown above.)
@Jess-Doit on GitHub · 2026-11-30 16:40 UTC · original
Thanks @mumba17. Message 654 turned out to be the check this needed. #3629 implements option 2, a CPU-only mirror of each shader-visible title heap, and uses your suggestion as its regression check:
retire_views_{warp,hardware}_debug1tests now fail if message 654 appears. That runs on WARP in CI, so it no longer depends on a driver that faults.check_device, so the test's ownGetNumStoredMessagescount is always 0. The new check reads the shim's log instead.X2W_D3D12_NO_VISIBLE_HEAP_MIRROR=1) passes only if message 654 appears.Results on the GTX 1060:
If option 1 or 3 is preferred instead, the message check and the new case 6 carry over unchanged.
Ready for more review