D3D12.X: a console list keeps its record chunk across Reset #510
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!510
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-510"
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 01:07 UTC · original
TG0000:perf/d3d12x-hotpath2→main· +302 −49 · 1 files · 2 commits · openEvery console-shaped command list (made by
CreateCommandListX, so every list the title records through D3D12.X) did this on each recording:Resetdropped its record chunks and allocated a new zeroed 1 MiB chunk (vec![0u8; CHUNK]). That is a fresh large allocation, page faults on first touch, and the free of the old chunk, for every list every frame.Closefirst copied the whole recording into aVec<Vec<u32>>(chunks(4).map(from_le_bytes).collect()), then replayed it.SetComputeRoot32BitConstants,SetDescriptorHeaps,ResourceBarrier,CopyBufferRegion,ClearUnorderedAccessView*,CopyTextureRegion) each built their record in a heapVecbefore copying it into the chunk.Now:
Resetkeeps the first chunk. It zeroes the part the last recording wrote (up to the write pointer), so the chunk is as a new zeroed one, and starts the next recording in it. Any other chunks are freed as before, so a list holds the same memory as before: one chunk between recordings.Box<[u32]>, andClosereads the records where they were written (&c[..used / 4]).uma_copytakes the arena and block list rather than the wholeListState, so the loop can borrow the chunks while it uploads argument tables.push_parts(slices and stack arrays, no allocation). The words are the same.The behaviour is the same: the same words in the same order, the same chunk geometry (
F_WRITE,F_END,F_DISPATCH_END), records split across chunks the same way, and a zeroed chunk at the start of every recording.What is in it
crates/xcl/src/hle/d3d12x/console_list.rsonly. It addsseal_last,recycle_chunksandpush_parts, plus thesparefield.closeandrecorded_wordsread the chunks directly. There are two new unit tests and an#[ignore]d release microbenchmark.No open PR touches
console_list.rs(I checked all open PRs' file lists). This PR does not touchreal.rs,bind.rsorlist_x.rs.Tested
stable-x86_64-pc-windows-msvcmethods_record_the_same_words: every recording method (root constants with and without a count, root constant, root descriptor, descriptor heaps, two transitions, buffer copy, float UAV clear, texture copy with and without a box, dispatch, barrier), compared with words built by hand from the old encodings. I also ran this same test against the unchangedorigin/maincode, and it passed there too, so the encodings are unchanged.a_reset_reuses_the_first_chunk_zeroed: a recording three chunks long reads back whole and in order. After Reset, the next recording starts at the first chunk's address, with the sameF_END/F_DISPATCH_END, one chunk, and that chunk all zero. Words the inline code writes itself (past the last method's record) are zeroed too. The next recording reads back only its own words.cargo +stable-x86_64-pc-windows-msvc test -p xcl --lib console_list: 7 passed, 0 failed, 1 ignored.title_list's test of console-list objects still passes.cargo +stable-x86_64-pc-windows-msvc test -p xcl --lib: 633 passed, 4 failed, 21 ignored. None of the 4 is in this file:vram::tests::d32s8_targets_take_their_own_size_of_video_memoryandtitle_textures::tests::placed_title_textures_share_vram_and_preserve_pixelsfail the same way onorigin/mainon this adapter.rdna2::tests::llvm_gfx10_corpusandrecomp::tests::buffer_format_table_matches_llvmneed the untrackedtests/data/llvm-amdgpufolder, which a fresh worktree does not have.cargo +stable-x86_64-pc-windows-msvc clippy -p xcl --all-targets: no new warnings. The 6 warnings inconsole_list.rswere already onmain(# Safetydocs on existingunsafe fns,cl_release's slice cast, the existingchunks_exact). The release build has the same single rustc warning asmain.cargo test --release -p xcl --lib console_list_frame_speed -- --ignored --nocapture. It models one recording per frame (Reset, a heaps record, then 64 dispatches each with a pipeline, 12 root constants, two root descriptors and two transitions, then Close reading the words). Before: the old chunk allocation, a Vec per record and the copy-out. After: the list's own code, including theLISTSlock the old path skipped in the bench.Regression run
scripts/smoke.ps1 -Seconds 45, one run each, under a 1 s free-RAM watchdog (FreePhysicalMemorybelow 3.5 GB; it never fired), one game instance at a time. Firstorigin/main(47efa2e, a later commit of main than this PR's base), then this PR's head:These are single runs, and frame counts vary a lot from run to run on this machine (other builds are often compiling on it): an earlier run of
main(2997c9a) gave 692 frames, and an earlier run of an earlier head of this PR gave 835. 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 (15096 MB against 15118 MB).Not tested
closewith a real PC list in a unit test. The replay loop is unchanged apart from reading the words in place; the smoke run exercises it.AI use
🤖 Generated with Claude Code
@Alpha325 on GitHub · 2026-11-24 01:23 UTC · original
Independent release-build check on clean PR head
26d98b66bc30f978c1b30b72ca862065629bcb05, using a Ryzen 5 7600X3D, Windows 11 build26200.9974, and Rust 1.100.0 MSVC x64.cargo test --offline --locked --release -j 4 -p xcl --lib console_list -- --test-threads=1 --nocapture7 passed, 0 failed, 1 ignored. The recording-format and chunk-reuse tests both passed. The ignored test was the benchmark, which I ran separately five times.
In the PR's CPU benchmark (64 dispatches per recording), the modeled old path took 22.06–23.54 µs per recording and the new path took 2.01–2.21 µs, a 10.3–11.7× speedup across the five runs. This measures CPU recording overhead only. I did not measure GPU execution or frame rate. These tests also did not cover the zero-count paths raised in review.
AI use: OpenAI Codex (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, 678 passed, 0 failed. This adds the whole suite to the partial runs above (the
record,resetandconsole_listtests).26d98b66bc30f978c1b30b72ca862065629bcb05, 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).methods_record_the_same_wordsanda_reset_reuses_the_first_chunk_zeroedpass, with the otherconsole_listtests. The test title (e2e) ends withfailures: 0.Not tested
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)
@TG0000 on GitHub · 2026-11-24 10:22 UTC · original
Thanks @shdann, good catch.
SetDescriptorHeapsandResourceBarriernow go through a smallcountedhelper that returns an empty slice for a zero count, so the null array is never read, and the record header is written as before. New testa_call_with_no_entries_records_its_header_for_a_null_arraycalls both (andSetRootConstants) with zero entries and a null array; with the guard removed it aborts on thefrom_raw_partsprecondition check.I also rebased onto the current
main(one conflict inconsole_list.rs, with the newIO_UMA_BASE_HIline). New headb661095;cargo test -p xcl --lib console_list: 8 passed, 0 failed, 1 ignored. The full lib run shows the same 3 failures as a cleanmainon my GPU (title_texturesx2,vram::d32s8_targets...), unrelated to this change.AI-assisted (Claude Sonnet 5.5).
@Toons29 on GitHub · 2026-11-25 02:56 UTC · original
Regression run of
88f16482on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 101 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.@DavidM1911 on GitHub · 2026-11-25 13:53 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!
@towiice on GitHub · 2026-11-24 01:12 UTC · original · reviewed
Tested PR head
26d98b6on NVIDIA GeForce GTX 1650 SUPER (Turing / TU116, driver 610.88), Windows 11 build 10.0.26300 (26H2), Rust 1.100.0 (stable-x86_64-pc-windows-gnullvm), DXCv1.9.2609:cargo test -p xcl --lib record -- --test-threads=4: 6 passed, 0 failed (includinghle::d3d12x::console_list::tests::methods_record_the_same_words).cargo test -p xcl --lib reset -- --test-threads=4: 7 passed, 0 failed (includinghle::d3d12x::console_list::tests::a_reset_reuses_the_first_chunk_zeroed).Builds and passes cleanly on Turing /
gnullvm.@shdann on GitHub · 2026-11-24 01:12 UTC · original · reviewed
At console_list.rs:501 and :506, the new from_raw_parts calls require a non-null pointer even for a zero-length slice. The old loops did not read either pointer when n was zero. A call with zero entries and a null array can now cause undefined behavior. Use an empty slice for zero entries and preserve the existing record header. Please test both zero-count paths. Static review with OpenAI Codex (GPT-6.2 Sol).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.