startup: read descriptor copies out of shader-visible heaps from a CPU-only mirror #3627
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3627"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-30T16:26:51Z.
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 #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
Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-30T16:35:52Z.
Hardware run of this PR on a second NVIDIA GPU, one where the copy did not crash on
main.Environment
main:cf43986d; this PR:5ee979dfdebug1tests enable it,debug0,keepandnoretiredo not.mainwas a full build. The PR was an incremental build in the same worktree.Command
Result
maincf43986d5ee979dfstartup_resource_retire_views_warp_debug0startup_resource_retire_views_warp_debug1startup_resource_retire_views_keep_warpstartup_resource_retire_views_noretire_warpstartup_resource_retire_views_hardware_debug0startup_resource_retire_views_hardware_debug1startup_resource_retire_views_keep_hardwarestartup_resource_retire_views_noretire_hardwarestartup_resource_retire_views_no_mirror_control_warp(negative control)mainmain: 8/8 passed. PR: 9/9 passed. No capability skips (77) in either run. No crash onmainon this card.Both
debug1runs also log message 1328 (CreateCommittedResourceignoringInitialState) onmainand on the PR; unrelated to this change.The mirror removes message 654 in the two
debug1tests (WARP and RTX 3070 Ti). Nothing regressed in the tests run here. This run does not cover the GTX 1060 crash.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-30T17:28:16Z.
Review: APPROVED
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 at66bc2115.