Repository navigation
D3D12.X: newer list layout #139 Reset goes through title_list::reset - #929
Conversation
|
The newer-layout reset works in my native Windows probe on The adopted backing list also routes slot 139 through I tested a synthetic caller registered in the module table, with distinct older/PC marker handlers behind the real layout guard. With A local fix reused the existing OpenAI Codex (GPT-6.2 Astra) assisted with verification. |
|
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean One more passing test than main: the newer list layout's Reset through Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it. |
…eset On the newer console command-list layout (real::QUEUE_SHIFTED), titles reset pooled lists through slot ivall#139 Reset(allocator, initial_pso, flags), which real.rs routes to list_x::reset_x. title_list's wrapper vtable only overrode slots 0, 1, 2, 9, and 10, leaving slot ivall#139 as a raw forwarder to F_BACKING. Once a mid-list Wait64 split switched F_BACKING to a continuation segment, ivall#139 reset only that continuation segment and never ran title_list::reset: F_PRIMARY stayed bound to the previous recording/allocator, F_BACKING was never restored to F_PRIMARY, and extra_active kept accumulating split segments across frames. On pre-ivall#897 main that caused D3D12 device removal (0x887a0001 / debug-layer id 541) as soon as the old allocator was reused; even with ivall#897/ivall#907 allocator pooling, stale primary/prior segments continue to be resubmitted and extra_active grows until MAX_EXTRA_SEGMENTS. The wrapper's ivall#139 is now a guard::make_layout_split of its own: a title on the newer layout goes to a four-argument adapter that runs wrapper reset, while a title on the older layout and the runtime take the generated forwarder. The forwarder's tail jump keeps the caller's return address and arguments, which the backing list's own layout guard at ivall#139 needs to tell a title from the runtime; calling the backing slot from Rust would hide it and send an older-layout title to the PC method. Tests: one covers the forwarder and the newer-layout reset on fake lists; one calls the slot from a caller in a registered mapped image, with the backing slot behind a layout guard as real.rs installs it and a test-local layout flag (flag clear: the older handler with the title's arguments; flag set: the primary is reset and the split segment reclaimed). Co-Authored-By: Antigravity <noreply@google.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5df36d1 to
b3a969b
Compare
|
@ettehn Thanks for testing this and for tracing the older-layout path. I checked it in the code: the backing list's #139 sits behind The fix uses your suggested shape and is squashed into the PR's commit (head is now The new test The suite and the smoke run were repeated on the new head and the description is updated (715 passed, 3 failed as before, 41 ignored). Not tested: an older-layout retail title. Claude Code (Claude Opus 5.5) assisted with the change and the test. |
|
Verified the fix on Verification assisted by OpenAI Codex (GPT-6.2 Astra). |
|
Linux / AMD RDNA3 datapoint. Merged state: head Full suite, Not tested: retail titles (none here), Windows, RDNA4. Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting. |
|
Test report for Follow-up to @not-rex's note on #505, where they suggested this PR as the cause of the stale counter writes I reported there. Tested
Not tested: this PR alone on AI use: Claude Code (Claude Opus 5.5) ran the runs, compared the logs and wrote this. |
|
Test report for Tested
The shared failure is The note: the first test calls Not tested: a retail title, AMD. CI is Run and written with Claude Code (Claude Opus 5.5); counts rechecked by a second agent (Claude Opus 5.5), text reviewed with Claude Fable 5.2; checked by a person before posting. Change@@ -59,21 +59,23 @@
/// every other slot a thunk to the currently active PC list's entry (`F_BACKING`).
fn vtable() -> usize {
static V: OnceLock<Vtable> = OnceLock::new();
- V.get_or_init(|| {
- let mut v = vec![0usize; LIST_SLOTS];
- let trace = std::env::var_os("XCL_LIST_TRACE").is_some();
- for (slot, e) in v.iter_mut().enumerate() {
- *e = if trace { forward_traced(slot) } else { forward(slot) };
- }
- v[0] = qi as usize;
- v[1] = add_ref as usize;
- v[2] = release as usize;
- v[9] = close as usize;
- v[10] = reset as usize;
- v[139] = slot_139(v[139], &super::real::QUEUE_SHIFTED);
- Vtable(Box::leak(v.into_boxed_slice()).as_ptr() as usize)
- })
- .0
+ V.get_or_init(|| Vtable(Box::leak(slots(&super::real::QUEUE_SHIFTED).into_boxed_slice()).as_ptr() as usize)).0
+}
+
+/// `vtable`'s entries; `newer_layout` is what slot #139 looks at (a test has a flag of its own).
+fn slots(newer_layout: &'static std::sync::atomic::AtomicBool) -> Vec<usize> {
+ let mut v = vec![0usize; LIST_SLOTS];
+ let trace = std::env::var_os("XCL_LIST_TRACE").is_some();
+ for (slot, e) in v.iter_mut().enumerate() {
+ *e = if trace { forward_traced(slot) } else { forward(slot) };
+ }
+ v[0] = qi as usize;
+ v[1] = add_ref as usize;
+ v[2] = release as usize;
+ v[9] = close as usize;
+ v[10] = reset as usize;
+ v[139] = slot_139(v[139], newer_layout);
+ v
}
/// `mov rcx, [rcx + F_BACKING]; mov rax, [rcx]; jmp [rax + slot * 8]`
@@ -566,7 +568,9 @@
});
let primary = Box::into_raw(Box::new(ResetFake { vt: vt.as_ptr(), refs: 1, reset_calls: 0, slot139_calls: 0, last_alloc: 0, last_pso: 0, last_arg3: 0 }));
let seg1 = Box::into_raw(Box::new(ResetFake { vt: vt.as_ptr(), refs: 1, reset_calls: 0, slot139_calls: 0, last_alloc: 0, last_pso: 0, last_arg3: 0 }));
- let s = slot_139(forward(139), &NEWER);
+ // entry 139 of the wrapper's own table: a plain forwarder there sends the newer-layout call below
+ // to the backing list's handler (2) and the primary is not reset
+ let s = slots(&NEWER)[139];
// the title: `sub rsp, 0x28; mov rax, s; call rax; add rsp, 0x28; ret` in a mapped image
let code = unsafe { VirtualAlloc(std::ptr::null(), 0x1000, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE) as usize };
assert_ne!(code, 0); |
|
Test report for Tested
Not tested
AI use: Claude Code. A Claude Sonnet 5.5 session ran the title runs and collected the counts; Claude Opus 5.5 wrote this report. |
|
Follow-up to Pipodi's #1931 + #929 comparison, on Windows 10 19045, RTX 5070 / 610.88, i7-7700K, 32 GiB RAM. I applied #929 head
The first patched run still had sporadic presents at the timer. The last captured image was loading artwork. Its watchdog lines no longer included the five q1-waiting-on-q3 entries in the earlier control. Queue IDs are local to a run. The longer repeat used a different frame capture interval (every 100 rather than 60). It reset the D3D12 device before reaching the earlier watchdog phase, with 28.11 GiB of minimum system commit headroom. DRED did not identify an allocation. This shows a later, clean exit in one patched run, with stability still unconfirmed.
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Capture-off follow-up to my previous #929 report. Same RTX 5070, driver 610.88, A separate 300 s run with capture still off and the D3D12 debug layer enabled exited at the timer (830 PresentX calls, four GPU queue watchdog releases). XCL logged that the debug layer was enabled, but its log contained no warning/error callback lines. The observed window near the end was dark. Different diagnostic mode and timing mean this run does not establish an effect of the debug layer on stability. The reset can occur without frame capture. No game data or raw logs included. AI-assisted (OpenAI Codex, GPT-6). |
…:reset (upstream PR xcl-dev#929) Cherry-picked from xcl-dev/xcl PR xcl-dev#929. On the newer console command-list layout titles reset pooled lists through slot xcl-dev#139; the wrapper left v[139] as a raw forwarder, so after a mid-list Wait64 split the primary list was never reset and stale segments got resubmitted (freeze ~30 s in the world). Applied cleanly.
|
Merged as part of Tested on the merged tree ( Why it looked related: on a retail title's world load (newer layout, other open PRs on the tree, without this one) two runs hung the GPU (0x887a0006). Both had three mid-list splits ( Read before the merge: the whole diff. AI use: Claude Code (Claude Opus 5.5) merged it, ran the tests and wrote this on the maintainer's behalf. |
|
Correction to my comment: a run with this PR still hung, so it was not the fix for that hang. On the same retail title and tree as before plus this PR (and page aliasing, #2308), the GPU hung again (0x887a0006), in the same list of 1 366 operations, at the same draw (operation 408, The PR stays merged: what it fixes is real (the #139 Reset not reaching the wrapper), it is covered by its own tests, and the suite is clean with it. It just has nothing to do with this hang. AI use: Claude Code (Claude Opus 5.5) ran this and wrote the comment on the maintainer's behalf. |
On the newer console command-list layout (
real::QUEUE_SHIFTED), titles reset pooled command lists through slot#139(Reset(allocator, initial_pso, flags)), whichreal.rsmaps tolist_x::reset_x.title_list's wrapper vtable only overrode slots0, 1, 2, 9, 10, leavingv[139]as a raw forwarder toF_BACKING. Once a mid-listWait64split switchedF_BACKINGto a continuation segment,#139reset only that continuation segment and never rantitle_list::reset:F_PRIMARYkept its old recording/allocator,F_BACKINGwas never restored toF_PRIMARY, andextra_activekept accumulating split segments across frames. Before#897that caused0x887a0001device removals (ID3D12CommandAllocatorreset while still referenced by an un-reset primary list); even with#897/#907allocator pooling, stale primary and prior split segments stay attached and get resubmitted untilextra_activehitsMAX_EXTRA_SEGMENTS.The wrapper's
v[139]is now aguard::make_layout_splitof its own: a title on the newer layout (real::QUEUE_SHIFTED) goes to a four-argument adapter that runstitle_list::reset; a title on the older layout and the runtime keep the generated forwarder toF_BACKING, whose tail jump preserves the caller's return address for the backing list's own layout guard at#139(review finding by @ettehn: a Rust call into the backing slot hid the title caller, so an older-layout title reached the PC method).What is in it
crates/xcl/src/hle/d3d12x/title_list.rs: vtable slot#139becomesslot_139(forwarder, &QUEUE_SHIFTED), amake_layout_splitwith the generated forwarder asolderandpcand the adapterreset_139(runstitle_list::reset) asnewer. Unit tests:newer_layout_slot_139_resets_primary_and_reclaims_split_segments(forwarder and newer-layout reset on fake lists) andslot_139_keeps_the_title_caller_for_the_backing_layout_guard(a caller in a registered mapped image calls the slot with the backing slot behind a layout guard asreal.rsinstalls it; flag clear reaches the older handler with the title's arguments, flag set resets the primary and reclaims the split segment). Both use a test-local layout flag, not the globalQUEUE_SHIFTED.Tested
32.0.21045.29003), AMD Ryzen 9 7950X3D, Windows 11 Pro10.0.26300(Build26300),rustc 1.100.0 (0ef1bc386 2026-11-09), debug (cargo test) and release (cargo build --release -p xcl).cargo test --workspace --no-fail-fast -- --test-threads=4: 715 passed, 3 failed, 41 ignored on headb3a969b(integration test binaries: 41 passed, 0 failed, 20 ignored;cargo test -p xcl --lib title_listin release and in debug: 3 passed, 0 failed, 0 ignored;d3d12x::guardtests in debug: 4 passed, 0 failed).title_list.rs:hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixelsfails (3D 64x64x64 4 mips: subresource 2 mismatch) when preceded in-process bygpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes(reproduces when running onlyhle::d3d12x::title_textureswith--test-threads=1), poisoning the shared lock forhle::d3d12x::title_textures::tests::transitions_apply_when_their_list_is_submittedandhle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory. Each of the 3 passes individually (1 passed, 0 failedwith--test-threads=1).SKIPPEDGPU tests on this adapter: none (0 skipped).Wait64splits and newer-layout slot#139resets; previously hit0x887a0001device removals after the first mid-list split, and with the newer-layout part of this fix (first revision of this PR, release build) survived 64+ mid-list splits with 0 device removals. That retail run has not been repeated on the current head.Regression run
Not tested
QUEUE_SHIFTED == false) on a real title (covered by unit test only). The second unit test fails on this PR's first revision only in a debug build; in release that call was compiled as a tail jump.Wait64splits (which happen later in loading).AI use
#139bypass, write the fix and unit test intitle_list.rs, run the test and smoke commands, and draft this description; diff and test outputs reviewed by the author.make_layout_splitchange and the second unit test, rerun the suite and the smoke run, and update this description.