Repository navigation
Conversation
CopyDescriptorsSimple / CopyDescriptors over console heaps copied the slot words one pair at a time, each side through console_heap::slot(): a lock of the heaps and a scan of all of them per descriptor, a lock of the shared heap for its geometry per view slot, and a lock of the resource map (XCL_TRACE_FRAME diagnostics) per slot even with tracing off. copy_words_run does the run under one lock of the heaps, tries the heap of the previous pair first (heaps do not overlap, so a hit is the scan's answer), reads the shared heap's geometry once (fixed once made, never dropped), and copy_words reads the resource map only when it is noted. Same pairs, same order of page reservation (destination first), same words. Release microbenchmark (copy_run_speed, 64 view slots, 48 heaps): a lookup per slot ~5.9 us, one run ~1.6 us (3.3-3.8x). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (driver 621.35), Rust 1.99.1 MSVC, release build. Tested commit ed2b685a
Not tested Full workspace suite, AMD, shared-heap page reservation through the batched copy on a real device, retail titles, or per-frame performance. AI use Codex with GPT-6.2 Sol ran the tests and drafted this report. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A device descriptor copy over console heaps (
CopyDescriptorsSimple#24 /CopyDescriptors#23) copied the slot words one pair at a time, and looked each side of each pair up withconsole_heap::slot(). Every lookup locked the heap list and scanned all of it, locked the shared heap to read its geometry (view slots), andcopy_wordsthen locked theXCL_TRACE_FRAMEresource map once per slot, even with tracing off. That came to about 2n heap-list scans and 3n–4n mutex round-trips for every n-descriptor copy, on a path the title runs every frame.console_heap::copy_words_runnow does the whole run under one lock of the heaps:heap_of(.., hint)). Heaps never overlap, so a hit is the same heap the scan would find, and a miss falls back to the scan.(cpu, gpu, inc)once per run, and only when a view slot needs it. These values are fixed once the heap is made, andGLOBALis never set back toNone.copy_wordslooks up the resource map only whentrace_frame()is on, which is whennote_resourcewould use it.The behaviour is the same as before: the same pairs, the destination looked up before the source for each pair (so shared-heap pages are reserved in the same order), pairs with a side outside the console heaps skipped, and the same words written.
slot()now uses the sameheap_of/slot_incode.What is in it
crates/xcl/src/hle/d3d12x/console_heap.rs:slot()is split intoheap_of+slot_in. Addscopy_words_run, andcopy_wordsskips the resource-map lookup when tracing is off. Adds unit tests and an#[ignore]d release microbenchmark.crates/xcl/src/hle/d3d12x/real.rs: incopy_console_slots, the per-slot loop is replaced by onecopy_words_runcall (3 lines).No open PR touches these hunks: #187 edits
console_heap.rsonly at lines ~27 and ~157–200 (shared_heap), and no open PR editsreal.rsnearcopy_console_slots.Tested
stable-x86_64-pc-windows-msvca_run_copies_what_each_slot_did: for views and for samplers, it comparescopy_words_runwith the old per-slot loop on identical heaps. The run starts 2 slots before the end of one heap, goes into a heap right after it, then into memory that belongs to no heap; it also copies whole heaps and copies from outside the console heaps. Image T# are renumbered, V# keep their address, S# word 3 is renumbered. Run 10 times under the parallel test runner: passed every time.a_heap_hint_is_checked: a wrong hint, an out-of-range hint, a correct hint, and an address just past a heap.cargo +stable-x86_64-pc-windows-msvc test -p xcl --lib console_heap: 5 passed, 0 failed, 1 ignored. This includes the existingslots_copy_and_releaseandlarge_heaps_get_shared_pages_as_used, which exerciseslot()with the shared heap on the real device.cargo +stable-x86_64-pc-windows-msvc test -p xcl --lib: 636 passed, 2 failed, 22 ignored. The 2 failures arevram::tests::d32s8_targets_take_their_own_size_of_video_memoryandtitle_textures::tests::placed_title_textures_share_vram_and_preserve_pixels("3D 64x64x64 4 mips: subresource 2 mismatch"). They fail the same way onorigin/main(a6f5f7a) without this change, on this adapter, and are in files this PR does not touch.cargo +stable-x86_64-pc-windows-msvc clippy -p xcl --all-targets: no new warnings. The onlyconsole_heap.rswarnings are the 4 that were already there (# Safetydocs on existingunsafe fns). The release build has the same single rustc warning asmain.cargo test --release -p xcl --lib copy_run_speed -- --ignored --nocapture. It copies 64 view slots with 48 heaps registered, with the busiest pair registered last:Regression run
scripts/smoke.ps1 -Seconds 45, one run each, under a 1 s free-RAM watchdog (it never fired):These are single runs, and frame counts vary from run to run. I don't claim this change caused the difference in frame counts. The point of these runs is that nothing regressed: no device removal, no crash, and the same peak commit.
Not tested
copy_words_runon a real device. It uses the samepage_ofcode asslot(), which the existing shared-heap test covers, but no test runs a copy through it withGLOBALpresent.AI use
🤖 Generated with Claude Code