Repository navigation
startup: match descriptor shadow slots on a descriptor boundary - #3563
Conversation
Desktop CPU descriptor handles need not be addresses. On an NVIDIA GTX 1060, CPU-only view heaps get small tagged handles whose spans interleave (0x3, 0x4, 0x5 with a 0x20 increment), so a handle inside one heap's span could select another heap's shadow slot. Prefer the heap the handle sits on a descriptor boundary of, and keep the previous containing-heap match as the fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lukaslw-lab
left a comment
There was a problem hiding this comment.
Reviewed ac6d858d by 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.
- Unchanged for address handles (
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. - SHOULD: no test on CI reaches the new branch. WARP hands out address handles, so no CI case has overlapping spans. The fixed cases (
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 on main 44a3ad5a too (the output UAV element-limit reason #3546 adds). It is not caused by this PR.
Moves the shadow_slot heap choice into descriptor_heap_match.h so it can be checked without a device. Heaps are now searched newest first: a released heap keeps its entry, so a new heap handed the same tag or address is the one the handle names. Two counters report the cases the handle cannot settle (several heaps on a boundary, or none), logged only when nonzero. startup_descriptor_heap_match covers the interleaved 0x3/0x4/0x5 heaps, a fourth heap at 0x23, address handles and reused handles. The first-contains control (the lookup before this branch) and the oldest-first control must fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. Both SHOULDs are addressed in
Rerun on the same host (GTX 1060, driver 32.0.15.6094, Windows 10 19045):
Ready for more review |
R0Y00
left a comment
There was a problem hiding this comment.
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.
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 startup: release retired slot-133 title-memory textures and track slot-18 SRV reuse (slice 2) #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