startup: match descriptor shadow slots on a descriptor boundary #3563
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3563"
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-30T07:23:36Z.
Refs #2468. Refs #3558.
Change
shadow_slotinsrc/startup_stubs/d3d12_capture.inlfound a descriptor's tracking slot by checking whether the desktop CPU handle lay inside a heap's span. Desktop CPU handles need not be addresses. On a GTX 1060, CPU-only view heaps get small tagged handles whose spans interleave, for example three two-descriptor heaps at 0x3, 0x4 and 0x5 with a 0x20 increment. A handle in one heap therefore fell inside an earlier heap's span and was tracked in the wrong slot.The lookup now prefers the heap where the handle sits on a descriptor boundary, and searches the heaps newest first. A released heap keeps its entry, so when a new heap is handed the same tag or address, the new heap is the one the handle names. Handles that are real addresses (WARP and the other adapters measured so far) resolve as before, apart from that reuse case.
The choice lives in
src/startup_stubs/descriptor_heap_match.hso it can be tested without a device. The handle alone cannot settle two cases: several heaps with the handle on a boundary (starts that differ by a multiple of the increment), or no heap with it on a boundary. The header documents both, and two counters report them in the periodicx2w-d3d12log, printed only when nonzero.Verification
Windows 10 19045, NVIDIA GTX 1060 6GB driver 32.0.15.6094, in-box WARP 10.0.19041. Dev build of this branch (
b359ac71) onmain44a3ad5a.startup_descriptor_heap_matchand its two controlsctest --preset prstartup_descriptor_heap_matchchecks the three interleaved heaps from the GTX 1060, a fourth heap at 0x23 that shares a boundary, address handles, and a reused tag and address. The first-contains control is the lookup onmainand fails 8 cases; the oldest-first control fails the 4 shared-boundary and reuse cases.Now passing on the GTX 1060:
startup_resource_retire_reasons_hardware: it held one view reference too few.startup_resource_retire_title_hardware_debug0and_debug1: Tv2 was kept after heap2 was released, as reported on #2468.All three already passed on WARP and still do.
The four remaining failures are the
startup_resource_retire_views_*_hardwarecrashes. They are a separate problem: a descriptor copy from a shader-visible heap, tracked in #3558.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-30T10:10:49Z.
Review: APPROVED
Reviewed
ac6d858dby reading the diff; not built or run.Verdict: approve. On adapters whose CPU handles are real addresses, the lookup gives the same result as before. On interleaved tagged handles it picks the right heap whenever only one heap has the handle on a descriptor boundary. No MUST.
d3d12_capture.inl:258-269). Real heap spans don't overlap, so at most one heap contains a handle. That heap is returned whether or not the handle is on a boundary, with the same floor index androomas before.- SHOULD: the boundary test still has blind spots, and they are silent. Two heaps whose start handles differ by a multiple of the increment (0x3 and 0x23 with 0x20) both match on a boundary, and whichever registered first wins. Released heaps also never leaveheap_infos():retire_drop_heap_views(d3d12_xs_device.cpp:6344) only clears their shadow. So if the driver reuses a tag, the stale entry comes first and takes the new heap's descriptors. The stale-entry problem predates this PR, but tagged handles make reuse of small values likelier. With tagged handles the fallback to the first containing heap is also wrong by construction. A counter for multi-heap matches and fallbacks would show whether either happens in a run, and the comment could name the limit.startup_resource_retire_reasons_hardware,..._title_hardware_debug0/1) need the GTX 1060. A small check of the lookup with the body's three heaps (0x3/0x4/0x5, increment 0x20, two descriptors each) would pin the boundary preference, and a fourth heap at 0x23 would pin the limit above.CI: Windows passed. The red Linux job is
tests/startup_triage_run_check.py, which fails onmain44a3ad5atoo (the output UAV element-limit reason #3546 adds). It is not caused by this PR.Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-30T15:16:20Z.
Thanks for the review. Both SHOULDs are addressed in
b359ac71:main. The two cases the handle cannot settle (several heaps on a boundary, or none) are documented in the newsrc/startup_stubs/descriptor_heap_match.h. Each has a counter in the periodicx2w-d3d12log, printed only when nonzero.startup_descriptor_heap_matchchecks it without a device, covering the 0x3/0x4/0x5 heaps, a fourth heap at 0x23, address handles, and a reused tag and address. Two controls must fail: first-contains is the lookup onmainand fails 8 cases, and oldest-first fails the 4 shared-boundary and reuse cases.Rerun on the same host (GTX 1060, driver 32.0.15.6094, Windows 10 19045):
ctest --preset pr: 72 passed, 0 failed, 14 capability skips.Ready for more review
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-30T15:53:44Z.
Review: APPROVED
Independent re-review of
b359ac71. The revised lookup prefers a boundary match and then the newest registration, and reports ambiguous boundaries and off-boundary fallbacks.ctest --preset release --no-tests=error -R '^startup_descriptor_heap_match'passed 3/3, including both expected-failure controls for first-contains and oldest-first. These are source-built span tests, with no GPU dependency. The earlier review's two follow-ups are addressed.