D3D12.X: a descriptor copy looks its console slots up under one lock #466
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!466
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-466"
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?
@TG0000 on GitHub · 2026-11-24 00:40 UTC · original
TG0000:perf/d3d12x-hotpath→main· +186 −13 · 2 files · 1 commits · openA 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
@thehollowedone on GitHub · 2026-11-24 00:45 UTC · original
Tested
Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (driver 621.35), Rust 1.99.1 MSVC, release build. Tested commit ed2b685a
cargo test --release --locked -p xcl --lib console_heap -- --test-threads=1 --nocapture— 5 passed, 0 failed, 1 ignored (the benchmark), and 0 reported skips.cargo test --release --locked -p xcl --lib copy_run_speed -- --ignored --nocapture— passed in three separate processes. Across six samples from this revision’s synthetic benchmark (64 descriptors, 48 heaps), per-slot lookup took 3,743–3,921 ns per copy and batched lookup took 1,031–1,052 ns per copy, a 3.6–3.7× speedup in this benchmark.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.
@H0UNDZER0 on GitHub · 2026-11-24 02:14 UTC · original · edited 2026-11-24 02:20 UTC
Tested on an RTX 5080: pass. This adds the whole suite, which the RTX 3080 Ti run above lists as not tested: 678 passed, 0 failed.
ed2b685a9b9fea12f31c104c74a656d6ac9e942b, this PR's head as is (on its base2997c9a), release build.XCL_*variables set.cargo build --release --workspace --locked: OK, the same singlefetch_updatewarning asmain.cargo test --workspace --release --no-fail-fast --locked -- --test-threads=4, run twice (the second with--show-output): 678 passed, 0 failed, 42 ignored both times.main2997c9agives 676 / 0 / 41 on this PC: the difference is this PR's 2 new tests and its ignored benchmark.SKIPPED: the usual 2,gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64).console_heap:a_run_copies_what_each_slot_didanda_heap_hint_is_checkedpass, and so doslots_copy_and_releaseandlarge_heaps_get_shared_pages_as_used(the shared heap on this device).Not tested
copy_words_runwith the shared heap present on a real device: no test makes one, as the description says.main. At the time of the run that was508a0c7;git merge-treeshowed no conflict.scripts/smoke.ps1.AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2)
@Alpha325 on GitHub · 2026-11-25 02:41 UTC · original
I extended the release microbenchmark at
ed2b685a9b9fea12f31c104c74a656d6ac9e942bto cover 1, 4, 16, and 64 view descriptors. Both paths ran in the same PR build, comparing the per-slot loop withcopy_words_run. I registered 48 synthetic heaps and tested source/destination pairs at the front and back of the list.Windows 11 build 26200.9974, Ryzen 5 7600X3D, Rust 1.100.0 MSVC release. Five fresh processes, two paired measurements per process with timing order reversed, and 20,000 copies per measurement.
The smallest gain was a single descriptor at the back of the list (1.05–1.09× across the ten pairs). The 64-descriptor back-of-list case measured 3.38–3.46×.
cargo test --release --offline --locked -p xcl --lib console_heap -- --test-threads=1 --nocapturereturned 5 passed, 0 failed, 1 ignored, and no skip markers. I ran the ignoredcopy_run_speedbenchmark separately with--ignored --test-threads=1 --nocapture.Scope — CPU descriptor lookup and copy time with synthetic heaps. Frame rate and GPU execution time were outside this test.
AI use — OpenAI Codex (GPT-6) extended the benchmark, ran it, and drafted this report.
@DavidM1911 on GitHub · 2026-11-25 14:15 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@DavidM1911 on GitHub · 2026-11-26 02:45 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.