Repository navigation
D3D12.X: split title_list command lists around mid-list Wait64 after Write64 - #797
Merged
theaustinayers merged 2 commits intoNov 24, 2026
Merged
Conversation
Bridge monotonic `Wait64BitValueX` / `Wait32BitValueX` and `Write64BitValueX` sequences across queues via real `ID3D12Fence` `queue.Wait` / `queue.Signal` instead of blocking the CPU submission thread until timeout (related to xcl-dev#505). Track submitted and pending wait/signal dependencies as an exact `(queue, seq)` directed graph (including same-cell write/wait edges and same-queue FIFO ordering) so genuine cross-queue cycles are detected and broken deterministically at Signal time without false positives on pipelined frames, backed by a GPU completion watchdog and unit/GPU regression tests.
…Write64 When a single command list records `Write64BitValueX` followed later in the same list by `Wait64BitValueX` / `Wait32BitValueX` on a value produced by another queue that waits on the earlier write, executing the list as a single atomic `ExecuteCommandLists` submission creates a cross-queue cycle. Extend `title_list` with separate `F_PRIMARY` and `F_BACKING` slots so `list_x` can transparently split `title_list`-backed command lists around mid-list waits after writes (opt-out via `XCL_SPLIT_MIDLIST_WAIT=0`), carrying active D3D12/UMA bindings across segments, expanding all segments on `ExecuteCommandLists`, and reusing closed spare PC lists on the same command allocator across `Reset` and `KickoffX`.
|
Test run of Tested
Review: Stacked on #795; I reviewed the top commit's structure only. It splits lists at mid-list waits, which #708 (open) also does, so the same choice applies as for #795. Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
cmt8
added a commit
to cmt8/xcl
that referenced
this pull request
Nov 24, 2026
…able vkd3d-proton takes a heap, fence, resource, descriptor or query heap, root signature, pipeline state or command signature only with its own vtable - an assert() in each of its methods and wherever one is passed in, which the release builds keep (the process ends with status 3) - and a command allocator only by a run-time check (CreateCommandList / Reset: E_INVALIDARG). Adoption replaced that vtable pointer, so on vkd3d-proton the real backend stopped at the first such object (the test title at its first heap). Under Wine (util::under_wine) the classes whose console slots all sit inside the PC interface - heap, resource, descriptor / query heap, root signature, pipeline state, command signature, command allocator - get XCL's PC slots written into the runtime's own table instead (VirtualProtect, as XAudio2's patch), only up to the interface's method count, and only when the object answered QueryInterface for that interface with itself; orig_fn finds the entries from before by the table. The table is shared by every object of the class (swap-chain buffers too); the overrides already take objects XCL did not create. Console calls past the PC interface on these classes no longer reach a logging stub. Command lists keep their extended table (the console layout is reordered and longer than the PC one): around the runtime's ExecuteCommandLists they carry the runtime's table, which vkd3d-proton reads only during the call. Fences are not covered yet (console ivall#12 is past the end of the PC table). On Windows nothing changes: every new path is behind under_wine(), and orig_fn's lookup has no table on Windows. vkd3d-proton 3.1's tables have exactly the PC interfaces' method counts (heap 10, resource 17, descriptor heap 11, root signature 8, pipeline state 9, query heap 8, command signature 8, allocators 9; read from its source). Wine 11.22, vkd3d-proton 3.1 release DLLs, RX 7900 XTX RADV: bind::create_list_reset_and_clear_state_track_initial_pso_on_d3d12 passes (aborted before); the other seven tests that aborted and the e2e test title now stop at the fence assertion. Not run on Windows. On upstream 1ec4c98 KickoffX also submits the earlier segments of a list ivall#797 split around a mid-list Wait64: those go with the runtime's table as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cmt8
added a commit
to cmt8/xcl
that referenced
this pull request
Nov 24, 2026
… behind ff59ccd wrote XCL's PC slots into vkd3d-proton's own allocator table, which ends after the PC's 9 methods. A console title calls past them (upstream's log names allocator xcl-dev#9, a logging stub answered 0 on Windows): found with a retail title under Wine, whose call landed on the zeros after vkd3d-proton 3.1's table (its slots 9-11 are 0, another table follows) and executed address 0 about 29 s in. The fence's way (07bccd7) instead: under Wine CreateCommandAllocator does not adopt the runtime's allocator; it returns an object of XCL's (alloc_x::wrap) with the console length - the PC methods call the runtime allocator's through its own table (bundle allocators have another), QueryInterface gives the wrapper back for the allocator itself, AddRef / Release are the runtime allocator's count, Release and Reset keep alloc_release / alloc_reset's bookkeeping on the wrapper (list_x::on_allocator_release, console_list::allocator_reset), and xcl-dev#9 on are the same "ID3D12CommandAllocator::#N (not on PC)" stubs as on Windows. Every allocator XCL keeps (list_x, console_list, bind) is the pointer its caller has, the wrapper; only where an allocator goes to the runtime is it unwrapped (alloc_x::for_runtime): the device's CreateCommandList (also console CreateCommandList / CreateCommandListX), a list's Reset on the PC path (cl_reset, also console_list's Reset) and the console's (list_x::reset_x: xcl-dev#10, xcl-dev#139, the DMA list) and KickoffX's Reset. These are the places vkd3d-proton 3.1 takes an allocator back (d3d12_command_list_Reset, d3d12_bundle_Reset, and CreateCommandList through Reset). Allocators are no longer patched in place. The pair is made before CreateCommandAllocator returns, so no caller ever has the runtime's allocator. On Windows nothing changes: CreateCommandAllocator takes the new path only under util::under_wine(), and for_runtime passes the allocator as it is there. Test: alloc_x::tests::a_wrapped_allocator_forwards_to_the_runtime_allocator (no GPU). Wine 11.22, vkd3d-proton 3.1 release DLLs, RX 7900 XTX RADV: it, bind's create_list_reset_and_clear_state_track_initial_pso_on_d3d12, gpu_sparse_vram_descriptors_buffers_and_xmem, title_textures' gpu_mirror_upload_... and placed_title_textures_..., both gpu_compute_e2e tests, list_x's reset_commits_state_..., fence_x's and the in-place test pass, each in its own process, with no "Invalid command allocator." in any log; the whole suite gives the same results as before the change (no pass -> fail; the same four failures) and the e2e test title the same 49 checks passed and one failed (its window is not cloaked under Wine). The retail title was not run again. Not run on Windows. On upstream 1ec4c98 the allocator also goes to the runtime as its own where xcl-dev#797's mid-list split resets a spare list or makes a new one (`create_raw_pc_command_list`) and where `title_list`'s Reset calls a list that is not adopted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wondercrash
pushed a commit
to wondercrash/xcl
that referenced
this pull request
Nov 24, 2026
… split xcl-dev#708 predates xcl-dev#795 (GPU-fence bridge) and xcl-dev#797 (mid-list split) and was not rebased. Resolution keeps main's split machinery (xcl-dev#797 + xcl-dev#851) and cpu_writes from xcl-dev#850 (the xcl-dev#708 per-queue workers with xcl-dev#873's diagnostics), and ports xcl-dev#708's core change onto it: - wait_gate.rs (from xcl-dev#708): a queue-side gate the CPU opens once it sees the progress value. - PendingWait::gate: a Wait64 GE, full mask, on a non-sparse value the CPU can read, in a direct/compute title list, that starts its PC segment (split by xcl-dev#797/xcl-dev#851, or nothing recorded before it). - execute_with_waits_on / KickoffX: gated waits arm a wait_gate instead of the xcl-dev#795 GPU-fence bridge; with sparse writes at or after the list in the batch they take the bounded CPU wait (xcl-dev#708's rule). Other waits keep the xcl-dev#795 bridge. Arming failure stops the title (xcl-dev#708). - Dropped from xcl-dev#708: its own title_list piece/split machinery, split_recording, restore_after_reopen, open-query / split-barrier tracking and the Result-returning execute_with_waits. - wait_tests.rs (from xcl-dev#708) adapted to push_segments / execute_with_waits_on.
cmt8
added a commit
to cmt8/xcl
that referenced
this pull request
Nov 24, 2026
…able vkd3d-proton takes a heap, fence, resource, descriptor or query heap, root signature, pipeline state or command signature only with its own vtable - an assert() in each of its methods and wherever one is passed in, which the release builds keep (the process ends with status 3) - and a command allocator only by a run-time check (CreateCommandList / Reset: E_INVALIDARG). Adoption replaced that vtable pointer, so on vkd3d-proton the real backend stopped at the first such object (the test title at its first heap). Under Wine (util::under_wine) the classes whose console slots all sit inside the PC interface - heap, resource, descriptor / query heap, root signature, pipeline state, command signature, command allocator - get XCL's PC slots written into the runtime's own table instead (VirtualProtect, as XAudio2's patch), only up to the interface's method count, and only when the object answered QueryInterface for that interface with itself; orig_fn finds the entries from before by the table. The table is shared by every object of the class (swap-chain buffers too); the overrides already take objects XCL did not create. Console calls past the PC interface on these classes no longer reach a logging stub. Command lists keep their extended table (the console layout is reordered and longer than the PC one): around the runtime's ExecuteCommandLists they carry the runtime's table, which vkd3d-proton reads only during the call. Fences are not covered yet (console ivall#12 is past the end of the PC table). On Windows nothing changes: every new path is behind under_wine(), and orig_fn's lookup has no table on Windows. vkd3d-proton 3.1's tables have exactly the PC interfaces' method counts (heap 10, resource 17, descriptor heap 11, root signature 8, pipeline state 9, query heap 8, command signature 8, allocators 9; read from its source). Wine 11.22, vkd3d-proton 3.1 release DLLs, RX 7900 XTX RADV: bind::create_list_reset_and_clear_state_track_initial_pso_on_d3d12 passes (aborted before); the other seven tests that aborted and the e2e test title now stop at the fence assertion. Not run on Windows. On upstream 1ec4c98 KickoffX also submits the earlier segments of a list ivall#797 split around a mid-list Wait64: those go with the runtime's table as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cmt8
added a commit
to cmt8/xcl
that referenced
this pull request
Nov 24, 2026
… behind ff59ccd wrote XCL's PC slots into vkd3d-proton's own allocator table, which ends after the PC's 9 methods. A console title calls past them (upstream's log names allocator xcl-dev#9, a logging stub answered 0 on Windows): found with a retail title under Wine, whose call landed on the zeros after vkd3d-proton 3.1's table (its slots 9-11 are 0, another table follows) and executed address 0 about 29 s in. The fence's way (07bccd7) instead: under Wine CreateCommandAllocator does not adopt the runtime's allocator; it returns an object of XCL's (alloc_x::wrap) with the console length - the PC methods call the runtime allocator's through its own table (bundle allocators have another), QueryInterface gives the wrapper back for the allocator itself, AddRef / Release are the runtime allocator's count, Release and Reset keep alloc_release / alloc_reset's bookkeeping on the wrapper (list_x::on_allocator_release, console_list::allocator_reset), and xcl-dev#9 on are the same "ID3D12CommandAllocator::#N (not on PC)" stubs as on Windows. Every allocator XCL keeps (list_x, console_list, bind) is the pointer its caller has, the wrapper; only where an allocator goes to the runtime is it unwrapped (alloc_x::for_runtime): the device's CreateCommandList (also console CreateCommandList / CreateCommandListX), a list's Reset on the PC path (cl_reset, also console_list's Reset) and the console's (list_x::reset_x: xcl-dev#10, xcl-dev#139, the DMA list) and KickoffX's Reset. These are the places vkd3d-proton 3.1 takes an allocator back (d3d12_command_list_Reset, d3d12_bundle_Reset, and CreateCommandList through Reset). Allocators are no longer patched in place. The pair is made before CreateCommandAllocator returns, so no caller ever has the runtime's allocator. On Windows nothing changes: CreateCommandAllocator takes the new path only under util::under_wine(), and for_runtime passes the allocator as it is there. Test: alloc_x::tests::a_wrapped_allocator_forwards_to_the_runtime_allocator (no GPU). Wine 11.22, vkd3d-proton 3.1 release DLLs, RX 7900 XTX RADV: it, bind's create_list_reset_and_clear_state_track_initial_pso_on_d3d12, gpu_sparse_vram_descriptors_buffers_and_xmem, title_textures' gpu_mirror_upload_... and placed_title_textures_..., both gpu_compute_e2e tests, list_x's reset_commits_state_..., fence_x's and the in-place test pass, each in its own process, with no "Invalid command allocator." in any log; the whole suite gives the same results as before the change (no pass -> fail; the same four failures) and the e2e test title the same 49 checks passed and one failed (its window is not cloaked under Wine). The retail title was not run again. Not run on Windows. On upstream 1ec4c98 the allocator also goes to the runtime as its own where xcl-dev#797's mid-list split resets a spare list or makes a new one (`create_raw_pc_command_list`) and where `title_list`'s Reset calls a list that is not adopted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cmt8
added a commit
to cmt8/xcl
that referenced
this pull request
Nov 24, 2026
…able vkd3d-proton takes a heap, fence, resource, descriptor or query heap, root signature, pipeline state or command signature only with its own vtable - an assert() in each of its methods and wherever one is passed in, which the release builds keep (the process ends with status 3) - and a command allocator only by a run-time check (CreateCommandList / Reset: E_INVALIDARG). Adoption replaced that vtable pointer, so on vkd3d-proton the real backend stopped at the first such object (the test title at its first heap). Under Wine (util::under_wine) the classes whose console slots all sit inside the PC interface - heap, resource, descriptor / query heap, root signature, pipeline state, command signature, command allocator - get XCL's PC slots written into the runtime's own table instead (VirtualProtect, as XAudio2's patch), only up to the interface's method count, and only when the object answered QueryInterface for that interface with itself; orig_fn finds the entries from before by the table. The table is shared by every object of the class (swap-chain buffers too); the overrides already take objects XCL did not create. Console calls past the PC interface on these classes no longer reach a logging stub. Command lists keep their extended table (the console layout is reordered and longer than the PC one): around the runtime's ExecuteCommandLists they carry the runtime's table, which vkd3d-proton reads only during the call. Fences are not covered yet (console ivall#12 is past the end of the PC table). On Windows nothing changes: every new path is behind under_wine(), and orig_fn's lookup has no table on Windows. vkd3d-proton 3.1's tables have exactly the PC interfaces' method counts (heap 10, resource 17, descriptor heap 11, root signature 8, pipeline state 9, query heap 8, command signature 8, allocators 9; read from its source). Wine 11.22, vkd3d-proton 3.1 release DLLs, RX 7900 XTX RADV: bind::create_list_reset_and_clear_state_track_initial_pso_on_d3d12 passes (aborted before); the other seven tests that aborted and the e2e test title now stop at the fence assertion. Not run on Windows. On upstream 1ec4c98 KickoffX also submits the earlier segments of a list ivall#797 split around a mid-list Wait64: those go with the runtime's table as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cmt8
added a commit
to cmt8/xcl
that referenced
this pull request
Nov 24, 2026
… behind ff59ccd wrote XCL's PC slots into vkd3d-proton's own allocator table, which ends after the PC's 9 methods. A console title calls past them (upstream's log names allocator xcl-dev#9, a logging stub answered 0 on Windows): found with a retail title under Wine, whose call landed on the zeros after vkd3d-proton 3.1's table (its slots 9-11 are 0, another table follows) and executed address 0 about 29 s in. The fence's way (07bccd7) instead: under Wine CreateCommandAllocator does not adopt the runtime's allocator; it returns an object of XCL's (alloc_x::wrap) with the console length - the PC methods call the runtime allocator's through its own table (bundle allocators have another), QueryInterface gives the wrapper back for the allocator itself, AddRef / Release are the runtime allocator's count, Release and Reset keep alloc_release / alloc_reset's bookkeeping on the wrapper (list_x::on_allocator_release, console_list::allocator_reset), and xcl-dev#9 on are the same "ID3D12CommandAllocator::#N (not on PC)" stubs as on Windows. Every allocator XCL keeps (list_x, console_list, bind) is the pointer its caller has, the wrapper; only where an allocator goes to the runtime is it unwrapped (alloc_x::for_runtime): the device's CreateCommandList (also console CreateCommandList / CreateCommandListX), a list's Reset on the PC path (cl_reset, also console_list's Reset) and the console's (list_x::reset_x: xcl-dev#10, xcl-dev#139, the DMA list) and KickoffX's Reset. These are the places vkd3d-proton 3.1 takes an allocator back (d3d12_command_list_Reset, d3d12_bundle_Reset, and CreateCommandList through Reset). Allocators are no longer patched in place. The pair is made before CreateCommandAllocator returns, so no caller ever has the runtime's allocator. On Windows nothing changes: CreateCommandAllocator takes the new path only under util::under_wine(), and for_runtime passes the allocator as it is there. Test: alloc_x::tests::a_wrapped_allocator_forwards_to_the_runtime_allocator (no GPU). Wine 11.22, vkd3d-proton 3.1 release DLLs, RX 7900 XTX RADV: it, bind's create_list_reset_and_clear_state_track_initial_pso_on_d3d12, gpu_sparse_vram_descriptors_buffers_and_xmem, title_textures' gpu_mirror_upload_... and placed_title_textures_..., both gpu_compute_e2e tests, list_x's reset_commits_state_..., fence_x's and the in-place test pass, each in its own process, with no "Invalid command allocator." in any log; the whole suite gives the same results as before the change (no pass -> fail; the same four failures) and the e2e test title the same 49 checks passed and one failed (its window is not cloaked under Wine). The retail title was not run again. Not run on Windows. On upstream 1ec4c98 the allocator also goes to the runtime as its own where xcl-dev#797's mid-list split resets a spare list or makes a new one (`create_raw_pc_command_list`) and where `title_list`'s Reset calls a list that is not adopted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Stacked on #795; only the top commit belongs here.
Split
title_list-backed command lists around mid-listWait64BitValueX/Wait32BitValueXcalls that follow aWrite64BitValueXin the same list, avoiding cross-queue cycles where a consumer queue waits on the prefix write before signaling the value the suffix waits on. Related to #505 (note: open #708 also splits lists at recorded waits; this approach extendstitle_listwithF_PRIMARY/F_BACKINGsegment tracking, reuses closed spare PC lists on the same allocator acrossReset/KickoffX, and integrates directly with #795's exact cycle graph).What is in it
crates/xcl/src/hle/d3d12x/title_list.rs: separateF_PRIMARY(0x2FF0) andF_BACKING(0x2FF8) slots soQueryInterface/AddRef/Releasestay pinned to the primary PC list while recording advances across split segments; expand all segments viapush_segments; reclaim spare closed segments onReset(callinglist_x::reset_xdirectly) andKickoffX(reclaim_for_kickoff).crates/xcl/src/hle/d3d12x/list_x.rs,bind.rs,real.rs: addtry_split_for_wait(opt-out viaXCL_SPLIT_MIDLIST_WAIT=0), carry active D3D12 and UMA bindings (bind::inherit_for_split) across split segments, expand wrapped lists inq_execute_command_lists, and addmid_list_write64_wait64_split_avoids_cycle_and_reuses_sparesverifying 2-frame splitting, spare reuse, and zero CPU cycle breaks.Tested
rustc 1.98.1(x86_64-pc-windows-msvccross-compile), debug.cargo test --workspace --no-fail-fast --target x86_64-pc-windows-msvc -- --test-threads=4 --skip a_freed_block_is_decommitted_before_its_address_is_reused: 706 passed, 4 failed (pre-existing Wine-only failures:hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime,test_title_runs_and_game_folder_is_untouched,disk_free_space_ex_reports_pls_quota,set_predication_buffer_state_and_kickoff), 41 ignored, 1 filtered (a_freed_block_is_decommitted_before_its_address_is_reused).SKIPPEDGPU tests:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64).hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares(2 frames, 2 segments, spare reused, 0 CPU cycle breaks).Regression run
scripts/smoke.ps1runs on a retail title (Linux/Proton environment only).Not tested
scripts/smoke.ps1retail regression run.AI use