Repository navigation
D3D12.X: clear rebind state, raise scratch pool cap, name UAV scratch for DRED, and bind active backing on CreateCommandList - #2738
Conversation
… for DRED, and bind active backing on CreateCommandList
…tor in ListState on create
luckyteagirl
left a comment
There was a problem hiding this comment.
On 223ed4d, create_list correctly resolves title allocator A to native backing B for CreateCommandList, but then passes B as the alloc argument to list_x::on_create. That stores B as ListState.allocator, which later continuation/Kickoff paths use as the logical allocator for alloc_pool::reset_list/current. If A rotates again to C while the initial recording still holds B, those paths look up B rather than A and can continue on the stale backing instead of C.
Could the list retain A as its title allocator while separately registering B as its native recording backing? Open PR #1071 already introduces on_create_with_backing(list, title_alloc, pc_alloc, ...) and created_on_backing, so this change may be easiest to coordinate with that branch. A two-rotation test (A→B at create, A→C before continuation) should verify the continuation selects C while the first recording remains pinned to B. This is exact-head source review; I did not run a title or GPU fixture.
|
Independent AMD RDNA4 (native wave64) verification of commit Tested
Not tested
AI use
|
|
Thanks @luckyteagirl — ed6c682 already introduced list_x::on_create_with_backing(list, title_alloc, pc_alloc, pso, ty) so ListState.allocator keeps the logical title allocator A while �lloc_pool::created_on and �ind::reset pin the first recording to B. Added the requested two-rotation unit test (created_on_rotated_backing_keeps_title_allocator_across_second_rotation, covering A -> B at create, A -> C before continuation, and verifying ListState.allocator == A, initial recording + �ind pinned to B, and continuation selecting C) in 20b0ad3 (passes cleanly). |
|
Tested - retail title on native Windows AMD RDNA2, PR head Tool: OpenCode with DeepSeek V4.1 Flash 1017
The baseline lost the device at 122.1 s with The PR is also Not tested: world/FPS (not reached), NVIDIA/Intel GPUs, full workspace, debug build. AI use: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests and the game runs, read the logs and wrote this comment; the counts and crash lines were checked against the logs. |
What is in it
crates/xcl/src/hle/d3d12x/bind.rs:rebind_allocator: unconditionally clear per-recording state reset by nativeReset()(heaps_ensured,pc_abi_gfx,pc_abi_cs,arg_order_clean,inline_guard,prelude_built, prelude scratch/job queues, and scratch slot states back toCOMMON) and retireprelude_ownedontobackingeven whens.allocator == backing, preventing stale descriptor-heap/ABI caches, replayed prelude jobs, and premature prelude teardown afterKickoffXor deferred-segment resets.inherit_for_split: retires.res_bufalongsides.res_retired(matchingbind::reset).pool_keeps: raiseFREE_RESentry count cap from16to256(still bounded byFREE_RES_CAP = 256 MiB) to avoid heavy 1 MiB scratch buffer create/drop churn under multi-allocator frames.default_uav_buffer: attach debug names viareal::name_resource(res.as_raw(), what)whenXCL_DRED=1(real::dred_on()).freed_two_pass_buffers_kept_for_reuse_are_cappedand addrebind_allocator_clears_per_recording_state_even_on_same_backing.crates/xcl/src/hle/d3d12x/device_x.rs&crates/xcl/src/hle/d3d12x/list_x.rs:create_list: resolvelet pc_alloc = super::alloc_pool::current(alloc);forreal::dev_create_command_listand pass both(alloc, pc_alloc)vialist_x::on_create_with_backingsoalloc_pool::created_ontracks the active PC backing whileListState.allocatorkeeps the logical title allocator for future splits/KickoffXresets.amd-dev(whererebind_allocator,default_uav_buffer, andFREE_RESlive).Tested
32.0.32029.2010), 24-thread x86_64 CPU, 32 GB RAM, Windows;rustc 1.100.0 (0ef1bc386 2026-11-09); debug (tests) and release (xcl.exe).cargo test -p xcl --lib hle::d3d12x::bind::tests::freed_two_pass_buffers_kept_for_reuse_are_capped: 1 passed, 0 failed (0.00s).cargo test -p xcl --lib hle::d3d12x::bind::tests::rebind_allocator_clears_per_recording_state_even_on_same_backing: 1 passed, 0 failed (0.00s).Regression run
Not tested
AI use
prelude_guard_dispatch_argsscratch buffers, authoring thebind.rsanddevice_x.rsfixes and unit tests, and running local tests and smoke verification. All diffs and measurements were verified locally on hardware.