Skip to content

[upstream #1071] D3D12.X: track split and created lists on alloc_pool's active backing - #83

Closed
ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1071
Closed

ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1071

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 24, 2026

Copy link
Copy Markdown
Owner

When a command allocator is swapped out by alloc_pool while an earlier command list still holds an active recording (or hasn't finished on the GPU), four follow-on list/allocator paths could still touch the stale backing or lose track of live recordings on spares:

  1. Mid-list split segments (list_x::try_split_for_wait): creating a new PC command list segment resolved alloc_pool::current(alloc) for the native CreateCommandList call, but never registered the newly created PC segment with alloc_pool (created_on_backing), leaving the active backing unpinned for that segment.
  2. Release/reset of extra split segments (list_x::clear_segment_state): resetting or freeing extra PC segments did not call alloc_pool::forget_list(list), leaving them holding allocator spares until process shutdown.
  3. Device list creation on an already-swapped allocator (device_x::create_list): called real::dev_create_command_list and list_x::on_create using the raw title alloc instead of resolving pc_alloc = alloc_pool::current(alloc), creating new lists onto a retired busy allocator rather than the active substitute backing.
  4. Adopted PC command list resets (real::cl_reset): ID3D12GraphicsCommandList::Reset bypassed alloc_pool::reset_list, both failing to redirect the title allocator to current(allocator) and failing to move this onto the resolved PC backing in alloc_pool.

What is in it

  • crates/xcl/src/hle/d3d12x/alloc_pool.rs: add created_on_backing(list, title_alloc, pc_alloc, ty) (and gate created_on under #[cfg(test)]), and add tests cl_reset_and_new_list_after_swap_use_active_backing and created_list_after_swap_tracks_active_backing.
  • crates/xcl/src/hle/d3d12x/list_x.rs: add on_create_with_backing(list, alloc, pc_alloc, pso, ty) delegating from on_create; call alloc_pool::forget_list(list) in clear_segment_state; register new split PC segments in try_split_for_wait via alloc_pool::created_on_backing(p as usize, alloc, pc_alloc, ty.0); and add test mid_list_split_tracks_new_segment_in_alloc_pool_and_releases_spare_on_reset.
  • crates/xcl/src/hle/d3d12x/device_x.rs: resolve pc_alloc = alloc_pool::current(alloc) in create_list and pass both alloc and pc_alloc to list_x::on_create_with_backing.
  • crates/xcl/src/hle/d3d12x/real.rs: wrap ID3D12GraphicsCommandList::Reset in cl_reset with alloc_pool::reset_list(this as usize, allocator as usize, -1, ...).

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release:
    • CPU / OS: AMD Ryzen 7 250, Microsoft Windows 11 Pro (build 26300), rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.8.2502.11, debug workspace build + test targets (.\scripts\test.ps1).
    • GPU 1 (wave64 + mesh): AMD Radeon 780M Graphics (driver 32.0.21030.11004).
    • GPU 2 (wave32 + mesh): NVIDIA GeForce RTX 5060 Laptop GPU (driver 610.88 / 32.0.16.1088).
  • XCL_ADAPTER=radeon .\scripts\test.ps1: 740 passed, 0 failed, 41 ignored (0 GPU tests skipped; xcl_testtitle included and passed; exit code 0).
  • XCL_ADAPTER=nvidia .\scripts\test.ps1: 740 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2 (no wave64) — gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware; xcl_testtitle included and passed; exit code 0).

Regression run

  • Opening as a Draft PR because this changes the D3D12.X runtime (crates/xcl/src/hle/d3d12x/) and no retail Xbox title is available locally to produce the required xcl-smoke v1 main vs PR comparison blocks via scripts/smoke.ps1. Requesting a retail-title smoke run on main and this branch before marking ready for review.

Not tested

  • Retail Xbox title run via scripts/smoke.ps1 (no retail game package locally).
  • Retail sample test suites (XCL_SAMPLE_RPF, XCL_SAMPLE_DLLS, XCL_SAMPLE_TTPF, XCL_SAMPLE_BCPACK, XCL_SAMPLE_BK2, XCL_SAMPLE_BVH4, XCL_SAMPLE_AWC, XCL_SAMPLE_XG, XCL_SAMPLE_DXC unset).
  • D3D12 debug layer (d3d12SDKLayers.dll not installed on this machine).

AI use

  • Antigravity (Gemini 4 Neon) diagnosed the gaps, wrote the fix, added the regression tests, ran the dual-GPU workspace test suite, and drafted this PR description under author review.

Mirror of xcl-dev#1071 (auto-synced, do not edit).

@ufoptg

ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Upstream PR xcl-dev#1071 was closed or merged.

@ufoptg ufoptg closed this Nov 25, 2026
@ufoptg
ufoptg deleted the upstream-pr/1071 branch November 25, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants