Repository navigation
startup: read descriptor copies out of shader-visible heaps from a CPU-only mirror - #3627
Conversation
…U-only mirror Desktop D3D12 reads CopyDescriptors sources and ClearUnorderedAccessView CPU handles only from CPU-only heaps. A console title may copy out of a shader-visible heap, and the stand-in forwarded that copy unchanged: the debug layer reports message 654 on every adapter, and a GTX 1060 driver faults in CopyDescriptorsSimple (R0Y00#3558). Each title view or sampler heap created shader-visible now gets a CPU-only mirror of its visible prefix, retained by the desktop heap like the CPU tail. Views, samplers and copy destinations in a visible range are written to the mirror and copied from there; copy sources and UAV clears read the mirror. Shadow tracking stays keyed on the visible handle. The retire-views debug-layer tests now fail on message 654 in the shim's log, which the shim drains from the info queue before the test can count it. Case 6 copies into and out of the visible heap. The control turns the mirror off with X2W_D3D12_NO_VISIBLE_HEAP_MIRROR=1 and requires the message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hardware run of this PR on a second NVIDIA GPU, one where the copy did not crash on Environment
Command ctest --preset dev --no-tests=error -j 1 -R "^startup_resource_retire_views" -V --output-on-failureResult
Both The mirror removes message 654 in the two |
R0Y00
left a comment
There was a problem hiding this comment.
Reviewed the mirror creation/lifetime, writes and copy-out/Clear CPU handle routes. Exact revision, Windows 11 build 26300.9974 Debug, WARP driver 10.0.26100.9818 and RTX 4060 Laptop GPU driver 32.0.16.1656: ctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^startup_resource_retire_views_' passed 9/9. Neither debug-enabled mirror run reported message 654. Turning the mirror off in the WARP negative control reported it four times. Also verified that this head integrates without conflict with current main at 66bc211.
Fixes #3558.
Change
Desktop D3D12 reads
CopyDescriptors/CopyDescriptorsSimplesources, and the CPU handle ofClearUnorderedAccessView*, only from CPU-only heaps. A console title may copy out of a shader-visible heap.copy_descriptor_runforwarded such a copy unchanged, so the source was in the shader-visible desktop heap.This is option 2 from the fix options comment, a CPU-only mirror:
SetPrivateDataInterface, like the existing CPU tail.DescriptorRangegains amirrorfield, anddesktop_cpu_handlecan return the mirror handle of a visible descriptor.view_slot, including the refused-SRV null), a console sampler (slot 61) or a copy into a visible range is written to the mirror first, then copied from the mirror to the visible heap. Both copies read a CPU-only heap.note_view,note_copyandshadow_slotare unchanged.Cost: one extra descriptor copy per write into a visible range, plus a CPU-only heap the size of each visible title heap.
X2W_D3D12_NO_VISIBLE_HEAP_MIRROR=1turns the mirror off. It is a negative control only, documented indocs/startup-runtime.md.Tests
As mumba17 noted on #3558, the debug layer reports the copy as message 654 on every adapter. The retire-views tests didn't catch it because the shim drains the info queue into its log in
check_device, so the test's own count is always 0.tests/cmake/startup_visible_heap_mirror.cmakeadds:FAIL_REGULAR_EXPRESSIONon message 654 forstartup_resource_retire_views_{warp,hardware}_debug1, so the contract is checked on WARP in CI.startup_resource_retire_views_no_mirror_control_warpruns with the mirror off and passes only if message 654 appears.tests/startup_resource_retire_views.cppcovers copies into and out of the visible heap. It copies a view between two visible slots and overwrites the source. It then copies both slots out to the CPU-only staging heap, and each must read what was last written there.Verification
Windows 10 19045, NVIDIA GTX 1060 6GB (driver 32.0.15.6094) and in-box WARP 10.0.19041. Dev build of this branch (
5ee979df) onmaincf43986d.Retire-views family
main(cf43986d; GTX 1060 crash measured on44a3ad5a)retire_views_hardware_debug0,_debug1,keep_hardware,noretire_hardwareCopyDescriptorsSimpleretire_views_warp_debug1retire_views_no_mirror_control_warpretire_views_warp_debug1withX2W_D3D12_NO_VISIBLE_HEAP_MIRROR=1Wider checks
^startup_resource_(budget|retire)): 39 passed, 0 failed on GTX 1060 and WARP. This is the first full pass of these families on the GTX 1060, together with startup: match descriptor shadow slots on a descriptor boundary #3563.ctest --preset pr: 65 passed, 0 failed, 24 capability skips.startup_compute_descriptor_scc_hardware,native_graphics_sampler_heap_{warp,hardware}andstartup_compute_dispatch_sampler_heap_{warp,hardware}.🤖 Generated with Claude Code