Repository navigation
D3D12.X: wait for title queues before unmapping texture pages - #594
Abdellah-Khanani wants to merge 1 commit into
Conversation
A mapping queue unmap could overtake draws already submitted on the title queues. Give each title queue a reusable fence and order the unmap after a marker on every known queue; keep the mapping when a marker cannot be established. Add an RX 5700 XT regression test that holds a submitted resource barrier behind a fence. Co-Authored-By: GPT-6 <noreply@openai.com>
|
Tested
Not tested
AI use
|
…-watch merge Integrates upstream PRs xcl-dev#594, xcl-dev#640, and xcl-dev#551: - Order reserved-texture tile unmaps behind known title queues with GPU fences before releasing tiles back to pools (xcl-dev#594). - Add opt-in XCL_PAGE_BUDGET_MB to evict LRU CPU-filled title textures when texture page pools hit the cap, remapping and re-uploading on use (xcl-dev#640), preventing unbounded VRAM growth during world streaming. - Merge write-watch scan gaps up to 64 MiB and clip regions with binary search to cut GetWriteWatch overhead during streaming (xcl-dev#551).
…-watch merge Integrates upstream PRs xcl-dev#594, xcl-dev#640, and xcl-dev#551: - Order reserved-texture tile unmaps behind known title queues with GPU fences before releasing tiles back to pools (xcl-dev#594). - Add opt-in XCL_PAGE_BUDGET_MB to evict LRU CPU-filled title textures when texture page pools hit the cap, remapping and re-uploading on use (xcl-dev#640), preventing unbounded VRAM growth during world streaming. - Merge write-watch scan gaps up to 64 MiB and clip regions with binary search to cut GetWriteWatch overhead during streaming (xcl-dev#551).
|
A possible GPU deadlock in
Now One way out: don't wait on the GPU. Record each title queue's marker value at supersede time, then do the NULL mapping later from the CPU, once every marker's The liveness of AI-assisted (Claude Code), read-only review. |
…-watch merge Integrates upstream PRs xcl-dev#594, xcl-dev#640, and xcl-dev#551: - Order reserved-texture tile unmaps behind known title queues with GPU fences before releasing tiles back to pools (xcl-dev#594). - Add opt-in XCL_PAGE_BUDGET_MB to evict LRU CPU-filled title textures when texture page pools hit the cap, remapping and re-uploading on use (xcl-dev#640), preventing unbounded VRAM growth during world streaming. - Merge write-watch scan gaps up to 64 MiB and clip regions with binary search to cut GetWriteWatch overhead during streaming (xcl-dev#551).
…-watch merge Integrates upstream PRs ivall#594, ivall#640, and ivall#551: - Order reserved-texture tile unmaps behind known title queues with GPU fences before releasing tiles back to pools (ivall#594). - Add opt-in XCL_PAGE_BUDGET_MB to evict LRU CPU-filled title textures when texture page pools hit the cap, remapping and re-uploading on use (ivall#640), preventing unbounded VRAM growth during world streaming. - Merge write-watch scan gaps up to 64 MiB and clip regions with binary search to cut GetWriteWatch overhead during streaming (ivall#551).
…-watch merge Integrates upstream PRs ivall#594, ivall#640, and ivall#551: - Order reserved-texture tile unmaps behind known title queues with GPU fences before releasing tiles back to pools (ivall#594). - Add opt-in XCL_PAGE_BUDGET_MB to evict LRU CPU-filled title textures when texture page pools hit the cap, remapping and re-uploading on use (ivall#640), preventing unbounded VRAM growth during world streaming. - Merge write-watch scan gaps up to 64 MiB and clip regions with binary search to cut GetWriteWatch overhead during streaming (ivall#551).
|
Run data that fits the cycle @upipibi describes. I don't have a trace that proves this cycle is the cause. Tested
Not tested
The new test itself does what it should here: it passes with the wait, and it fails without it. Claude Code (Claude Opus 5.5) ran the tests and wrote this comment; I checked it. |
|
Run data and thread dumps confirming the cycle @upipibi described, plus a variant that avoids it. Setup: Linux, RTX 5080 (NVIDIA 620.73.04), proton-cachyos-slr Wine, vkd3d-proton master What happened with this PR merged: in the world, one frame every ~6 s. The fence bridge's 5 s watchdog released a Thread dumps (
A variant without the cycle: keep the markers, but make the CPU hold the unmap instead of the mapping queue. After: 0 watchdog releases at the same point of the next run, and frames no longer stall in step with them. Not tested: Windows, AMD. AI use: Claude Code (Claude Opus 5.5) diagnosed this, wrote the local change and this text; the user approved posting it. |
…ps (ivall#594) Re-apply XCL_PAGE_BUDGET_MB LRU texture eviction (ivall#640) and fenced unmaps (ivall#594) on top of upstream/main (930e8b4) + ivall#1182/ivall#1142/ivall#800, using real::create_raw_fence for vram queue fences under Wine. Assisted-by: Antigravity (Google DeepMind)
Empirical test report (3bb3c2f)Hardware / environment Commit Commands and results
xcl-00e28da3621caf64.exe --exact --test-threads=1 "${prefix}tile_ranges_per_heap" "${prefix}owned_pages_never_alias_disjoint_ranges" "${prefix}an_arena_is_shared_at_its_addresses_and_otherwise_its_placements_size" "${prefix}an_arena_no_resource_uses_goes_after_two_seconds" "${prefix}streamed_targets_stay_bounded"
xcl-00e28da3621caf64.exe --exact --test-threads=1 "${prefix}superseded_texture_unmap_waits_for_title_queue_work"
xcl-00e28da3621caf64.exe --exact --test-threads=1 --format terse "${prefix}superseded_texture_unmap_waits_for_title_queue_work"
Observed behavior Both GPU attempts reported Not tested GPU unmap ordering, the full GPU workspace suite, and game smoke runs. AI use Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr594-focused.log and published. |
|
Targeted GPU check on RTX 5070 / Windows 10. Unchanged
On the same adapter, I separately observed AI-assisted (Codex) for running the existing test and preparing this comment. Synthetic data only. |
|
@Abdellah-Khanani @upipibi @Ali-AbdulHadii #2270 implements the CPU-held variant discussed here, on current The new reason for it: a synthetic probe on #2057 that flips a reserved texture's tiles to NULL while copies to it run gives AI use: Claude Code (Claude Opus 5.5) wrote this comment. |
Fixes #475. Order unmapping of a superseded title texture after work already submitted on the title's command queues, so its pages are not removed while GPU work may still sample it.
What is in it
crates/xcl/src/hle/d3d12x/vram.rs: signal reusable per-queue fences and make the mapping queue wait on them before unmapping. If a fence cannot be established, keep the resource mapped.Tested
cargo test -p xcl --lib superseded_texture_unmap_waits_for_title_queue_work -- --nocapture: 1 passed.cargo test --workspace --no-fail-fast -- --test-threads=4: 640 passed, 1 failed, 21 ignored. The failure isgpu_nonfused_mad_and_mac_prevent_fma_contraction(Recompiler: v_fma_f32 is not fused on AMD's RDNA1 driver (mad() left unfused) #472), also reproduced onmain.gpu_geometry_mode_es_gs_stripandgpu_mesh_mode_two_passes(no mesh shaders).Regression run
Main:
This PR:
Not tested
Reviewed by
AI use