Repository navigation
D3D12.X: read a view heap's slots in place when scanning for superseded targets - #3592
Royalflamejlh wants to merge 2 commits into
Conversation
A superseded target bound through a descriptor table is remapped when a draw or dispatch binds the table (xcl-dev#3179), but only the first 256 slots of each table were read. A view further in – a bindless SRV range, or a range at an explicit offset past slot 256 – was never seen: the target kept no tiles, its writes were dropped and its reads returned zeros. The root signature's SRV and UAV ranges of each descriptor table (RTS0 1.0 and 1.1, appended and unbounded ones included) are now kept in the layout, and the scan reads those ranges and nothing else. An unbounded range ends with the view heap the table lies in (console_heap::view_heap_remaining_slots); outside any view heap it has no known extent and is not read. CBV and sampler ranges cannot name a placed target and are skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eads view heaps in place)
|
Review (head 6622097, diff read, not a merge-check; draft, checks red):
Fine: the fast path only applies when the table lies in a registered view heap, each range is cut to that heap's end, ranges outside any heap still go through AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
…ed targets While any target is superseded, every draw and dispatch bound on XCL's ABI scans the descriptor ranges its layout declares for views of superseded targets (note_superseded_in_tables, xcl-dev#3443). A table outside the committed window, such as the title's view heaps in sparse window 0, was read with read_committed_into, one read for each declared range (about 41 a bind in that run), and under Wine each read asks VirtualQuery first (Windows reads it with one ReadProcessMemory). In a run in the title's world that VirtualQuery was the first call site of all, about 17 µs a call for a 32-byte slot. A range inside a registered view heap is already cut to the heap's end, and the heap's slots are committed while it is registered (XCL commits a heap it places in the sparse windows; one in the title's memory was committed when it was made): such a range is now copied where it is, under HEAPS as view_slot_words copies, so a heap unregistered on another thread since its lookup is not freed under the copy; it is then read with read_committed_into, as a range outside any view heap is. Measured with two other changes (one read of a few resident pages in read_committed_into under Wine, and the memory report reusing its commit sum) on a tree carrying other unmerged work, RTX 4060 Ti, Wine 11.21, 1 run each with the same options, the title in its world: 1.19 -> 3.70 frames a second. What each change gives on its own was not measured. Test: in-heap ranges are found without read_committed (red without the change); a bounded range outside any heap, or in one unregistered since its lookup, is read through it; a view heap's slots are copied only while it is registered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6622097 to
6ccc2f8
Compare
|
@Foniass thanks; fixed at
AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and drafted this reply. |
|
Follow-up review (head 6ccc2f8, since 6622097, diff read, not a merge-check; draft, checks red):
New: none. Fine: the in-place copy now runs under AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
The merge of 6ccc2f8 kept the stack's older line, which copied a view heap's slots without HEAPS; the reviewed head copies them under it (copy_view_heap_slots) and its test failed here without this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stacked on #3443; only the top commit (
662209739) belongs here.With #3443, once any render target is superseded, every draw and dispatch bound on XCL's ABI reads each descriptor range its layout declares, one 32-byte slot at a time (about 41 reads a bind), through
title_textures::read_committed_into. Under Wine that function asksVirtualQueryregion by region (its whole-range read is skipped there, #2844), each call under Wine's one virtual-memory lock. A range inside a registered view heap is now copied where it is: its slots stay committed while the heap is registered. Ranges outside every heap are read as before.What is in it
hle/d3d12x/bind.rs(scan_superseded_in_tables_with): a range inside a registered view heap is read in place; a test that the scan reads such ranges where they are (5 against 0 without the change).Tested
x86_64-pc-windows-gnu, release, head6ccc2f80c(Foniass's review points fixed; the results below that name662209739were taken there) on D3D12.X: look for superseded targets in every declared table range #3443's7afecf845:cargo test -p xcl --release --lib -- bind::: 115 passed, 1 failed (gpu_two_pass_indirect_commands_keep_their_own_records, which fails onmain6bfb5c515here too), 1 SKIPPED.6ccc2f80c, under Wine on CPU Vulkan (no card),cargo test -p xcl --release --lib -- --test-threads=4: 2578 passed, 13 failed, 29 ignored; the parent7afecf845fails the same 13;main6bfb5c51: 2735 passed, 11 failed (the 2 extra here are theindirect_guardtests, fixed onmainafter this branch's base). Skipped on all three trees: a test that crashes the binary under Wine, the D32S8 test that hangs under Wine, and theuma_drivertests (over 12 GB).XCL_LOOK_STATS=2, from another fork), 1 run each, 900 s: theVirtualQuerycall site inread_committed_intomade 150,000 to 195,000 calls a second, 1.12 s of thread time a second on average; frames a second in the world 1.19. With this change and two others of ours together (a cheaper Wine read inread_committed_into, and reusing the memory report's commit sum): that call site was not in the top list, and 3.70 frames a second. The gain from this change alone was not measured.Regression run
xcl-smokeblocks are owed.Not tested
read_committed_intomakes oneReadProcessMemoryfor the range, so the gain is expected to be small), AMD, the whole suite.AI use