D3D12.X: quarantine unmapped parked sparse tiles behind GPU fences #2345

Manually merged
github merged 1 commit from gh-pr/2345/head into gh-pr/2345/base 2026-11-26 05:28:23 +00:00
Owner

@⁠fixgep on GitHub · 2026-11-25 16:10 UTC · original
fixgep:fix/sparse-flush-parked-quarantine → main · +272 −11 · 1 files · 1 commits · merged 2026-11-25 18:27 UTC

Quarantine unmapped parked sparse pool tiles behind completion fences for both State.queue and active same-device title command queues before returning them to State.free (XCL-BT-009, Part of #1488). Previously, State::flush_parked unmapped parked tiles on self.queue, signaled self.fence, and immediately pushed unpinned pool tiles to self.free, allowing State::take_tile to pop, remap, and zero/reuse them while prior GPU work or unmapping was still in flight.

What is in it

  • crates/xcl/src/hle/d3d12x/sparse.rs (10e9fb7):
    • add RetiredTiles, State.quarantined, and per-queue fence tracking State.queue_fences
    • track same-device queues in State::note_queue and State::sync_known_queues (fed by before_execute, readback_after_execute, and super::present::known_queues)
    • record (self.fence, self.value) plus per-title-queue fence marks in State::quarantine_tiles during State::flush_parked, drain completed batches to self.free in State::drain_quarantined (take_tile, decommit_range, before_execute), and keep quarantined tiles excluded in State::release_if_unused
    • update a_tile_decommitted_and_committed_again_keeps_its_video_memory for fenced release and add regression tests flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight and flush_parked_quarantines_tiles_until_title_queues_finish

Tested

  • NVIDIA GeForce RTX 3060 (12108 MiB VRAM, driver 32.0.15.9144, 32-lane waves), AMD Ryzen 5 7500F 6-Core Processor, Windows 11 Pro (Build 26200.9974, 25H2), rustc 1.100.0 (0ef1bc386 2026-11-09); DXC dxcompiler 1.9.2602.17 (21d28f72) from Windows SDK 10.0.26100.0 (tests), DXC 1.9.2609.5 (01b62ad4) in target\release (smoke runs); debug tests + release smoke build
  • cargo build --workspace and cargo build --release -p xcl: built with 0 new warnings (only 2 pre-existing fetch_update deprecation warnings in crates/xcl/src/hle/d3d12x/real.rs and crates/xcl/src/hle/xgameruntime/mod.rs)
  • cargo test -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=4: 17 passed, 0 failed, 1 ignored (early_commit_timing)
  • cargo test -p xcl --lib -- --test-threads=4: 1204 passed, 1 failed (gpu::recomp::tests::gpu_clamp_and_omod_per_instruction, confirmed pre-existing failing identically on unmodified main 0829441), 26 ignored (25 SKIPPED GPU checks: 21 no wave64, 3 refused #1426 f16/f32 wave32 per-lane semantics, 1 cannot disable the driver cache (Windows Developer Mode is required))
  • cargo test -p xcl --test '*' -- --test-threads=4: 69 passed, 0 failed, 20 ignored (1 SKIPPED GPU check: heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows)
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1273 passed, 1 failed (gpu::recomp::tests::gpu_clamp_and_omod_per_instruction), 46 ignored (xcl --lib: 1204/1/26, xcl --bin xcl: 0/0/0, xcl --test '*': 69/0/20, xcl-testtitle: 0/0/0, doctests: 0/0/0; 26 SKIPPED GPU checks total as listed above)

Regression run
main:

xcl-smoke v1
commit: 082944135cd2b96288470a595861fa608eee08dc
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 483 (PresentX 484)
presents per 2 s (last 3): 24 23 24
device removals: 0
crashes: 0
peak commit: 14977 MB

PR:

xcl-smoke v1
commit: 10e9fb761fbf19c4b8e0e8fa745835d8127732ee
gpu: NVIDIA GeForce RTX 3060
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1009 (PresentX 1009)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14847 MB

Not tested

  • Native wave64 GPU paths, heap-window fallback, and driver-cache-disabled PSO measurement (26 runtime-skipped checks on RTX 3060 wave32 without Windows Developer Mode) and AMD RDNA hardware
  • XCL_SAMPLE_* tests gated on external game assets (unset)
  • Pre-existing gpu::recomp::tests::gpu_clamp_and_omod_per_instruction failure left untouched outside scope

AI use

  • Antigravity (Gemini 4 Hydrogen) — selected unclaimed issue #1488 (XCL-BT-009), wrote failing-first unit tests and fenced tile quarantine in crates/xcl/src/hle/d3d12x/sparse.rs, ran test suites and 60 s smoke comparisons, and validated the PR description against scripts/pr_check.py (upstream/main).
**@⁠fixgep** on GitHub · 2026-11-25 16:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/2345) `fixgep:fix/sparse-flush-parked-quarantine` → `main` · +272 −11 · 1 files · 1 commits · merged 2026-11-25 18:27 UTC Quarantine unmapped parked sparse pool tiles behind completion fences for both `State.queue` and active same-device title command queues before returning them to `State.free` (`XCL-BT-009`, Part of #1488). Previously, `State::flush_parked` unmapped parked tiles on `self.queue`, signaled `self.fence`, and immediately pushed unpinned pool tiles to `self.free`, allowing `State::take_tile` to pop, remap, and zero/reuse them while prior GPU work or unmapping was still in flight. **What is in it** - `crates/xcl/src/hle/d3d12x/sparse.rs` (`10e9fb7`): - add `RetiredTiles`, `State.quarantined`, and per-queue fence tracking `State.queue_fences` - track same-device queues in `State::note_queue` and `State::sync_known_queues` (fed by `before_execute`, `readback_after_execute`, and `super::present::known_queues`) - record `(self.fence, self.value)` plus per-title-queue fence marks in `State::quarantine_tiles` during `State::flush_parked`, drain completed batches to `self.free` in `State::drain_quarantined` (`take_tile`, `decommit_range`, `before_execute`), and keep quarantined tiles excluded in `State::release_if_unused` - update `a_tile_decommitted_and_committed_again_keeps_its_video_memory` for fenced release and add regression tests `flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight` and `flush_parked_quarantines_tiles_until_title_queues_finish` **Tested** - NVIDIA GeForce RTX 3060 (12108 MiB VRAM, driver `32.0.15.9144`, 32-lane waves), AMD Ryzen 5 7500F 6-Core Processor, Windows 11 Pro (Build `26200.9974`, `25H2`), `rustc 1.100.0 (0ef1bc386 2026-11-09)`; DXC `dxcompiler 1.9.2602.17 (21d28f72)` from Windows SDK `10.0.26100.0` (tests), DXC `1.9.2609.5 (01b62ad4)` in `target\release` (smoke runs); debug tests + release smoke build - `cargo build --workspace` and `cargo build --release -p xcl`: built with 0 new warnings (only 2 pre-existing `fetch_update` deprecation warnings in `crates/xcl/src/hle/d3d12x/real.rs` and `crates/xcl/src/hle/xgameruntime/mod.rs`) - `cargo test -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=4`: 17 passed, 0 failed, 1 ignored (`early_commit_timing`) - `cargo test -p xcl --lib -- --test-threads=4`: 1204 passed, 1 failed (`gpu::recomp::tests::gpu_clamp_and_omod_per_instruction`, confirmed pre-existing failing identically on unmodified `main` `0829441`), 26 ignored (`25` SKIPPED GPU checks: `21` `no wave64`, `3` `refused` `#1426` f16/f32 wave32 per-lane semantics, `1` `cannot disable the driver cache (Windows Developer Mode is required)`) - `cargo test -p xcl --test '*' -- --test-threads=4`: 69 passed, 0 failed, 20 ignored (`1` SKIPPED GPU check: `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows`) - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1273 passed, 1 failed (`gpu::recomp::tests::gpu_clamp_and_omod_per_instruction`), 46 ignored (`xcl --lib`: 1204/1/26, `xcl --bin xcl`: 0/0/0, `xcl --test '*'`: 69/0/20, `xcl-testtitle`: 0/0/0, doctests: 0/0/0; `26` SKIPPED GPU checks total as listed above) **Regression run** main: ``` xcl-smoke v1 commit: 082944135cd2b96288470a595861fa608eee08dc gpu: NVIDIA GeForce RTX 3060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 483 (PresentX 484) presents per 2 s (last 3): 24 23 24 device removals: 0 crashes: 0 peak commit: 14977 MB ``` PR: ``` xcl-smoke v1 commit: 10e9fb761fbf19c4b8e0e8fa745835d8127732ee gpu: NVIDIA GeForce RTX 3060 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1009 (PresentX 1009) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14847 MB ``` **Not tested** - Native wave64 GPU paths, heap-window fallback, and driver-cache-disabled PSO measurement (`26` runtime-skipped checks on RTX 3060 wave32 without Windows Developer Mode) and AMD RDNA hardware - `XCL_SAMPLE_*` tests gated on external game assets (unset) - Pre-existing `gpu::recomp::tests::gpu_clamp_and_omod_per_instruction` failure left untouched outside scope **AI use** - Antigravity (Gemini 4 Hydrogen) — selected unclaimed issue `#1488` (`XCL-BT-009`), wrote failing-first unit tests and fenced tile quarantine in `crates/xcl/src/hle/d3d12x/sparse.rs`, ran test suites and 60 s smoke comparisons, and validated the PR description against `scripts/pr_check.py` (`upstream/main`).
Root cause (XCL-BT-009 in #1488): State::flush_parked queued tile
unmappings on self.queue, signaled self.fence, and immediately pushed
unpinned pool tiles to self.free without waiting for the unmap fence or
in-flight title command queues to complete. A following take_tile could
remap and clear a tile while earlier GPU work or unmap operations still
referenced it.

Fix: track same-device title queues with per-queue fences via
State::note_queue and super::present::known_queues, move unmapped
unpinned tiles into State::quarantined paired with completion marks from
self.fence and every tracked title queue, exclude quarantined tiles in
release_if_unused, and move them to self.free in drain_quarantined only
after all marked fences complete. Add synthetic unit tests covering both
sparse-queue unmap in-flight gating and title-queue in-flight gating.

Part of #1488

Assisted-by: Antigravity (Gemini 4 Hydrogen)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:28:22 +00:00
github manually merged commit 10e9fb761f into gh-pr/2345/base 2026-11-26 05:28:23 +00:00
Author
Owner

@⁠Aniseto on GitHub · 2026-11-25 16:21 UTC · original

Ran the sparse tile quarantine tests at 10e9fb7:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=nvidia cargo test -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=4
17 passed; 0 failed; 1 ignored; 1213 filtered out      (exit 0)

Both new regression tests pass here, along with the existing a_tile_decommitted_and_committed_again_keeps_its_video_memory. The ignored one is early_commit_timing, unchanged from the author's run.

What this adds: the author ran this filter on an Ampere RTX 3060 with DXC 1.9.2602.17 for tests; this is a Blackwell wave32 part with DXC 1.9.2609.5. No test report from another machine exists in the thread yet.

Not tested: the whole workspace suite, a 60 s paired smoke run, native wave64, heap-window fallback, AMD and Intel GPUs, Wine, release profile, title data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-11-25 16:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/2345#issuecomment-7167821772) Ran the sparse tile quarantine tests at `10e9fb7`: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` XCL_ADAPTER=nvidia cargo test -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=4 17 passed; 0 failed; 1 ignored; 1213 filtered out (exit 0) ``` Both new regression tests pass here, along with the existing `a_tile_decommitted_and_committed_again_keeps_its_video_memory`. The ignored one is `early_commit_timing`, unchanged from the author's run. What this adds: the author ran this filter on an Ampere RTX 3060 with DXC 1.9.2602.17 for tests; this is a Blackwell wave32 part with DXC 1.9.2609.5. No test report from another machine exists in the thread yet. Not tested: the whole workspace suite, a 60 s paired smoke run, native wave64, heap-window fallback, AMD and Intel GPUs, Wine, release profile, title data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Author
Owner

@⁠amazedturnip on GitHub · 2026-11-25 16:23 UTC · original

Independent AMD Radeon (native wave64) verification of exact head 10e9fb761fbf19c4b8e0e8fa745835d8127732ee (clean detached worktree, compared against main 3f4495a2b325).

Tested

  • Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc
  • Adapter: AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64) (XCL_ADAPTER=radeon, native wave64)
  • Targeted unit tests (debug): cargo test -p xcl --lib hle::d3d12x::sparse -- --test-threads=2 — 17 passed, 0 failed, 1 ignored (exit 0)

Regression run (scripts/smoke.ps1 -Seconds 60, release build, XCL_ADAPTER=radeon)
main:

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: AMD Radeon(TM) Graphics
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 782 (PresentX 782)
presents per 2 s (last 3): 34 2 2
device removals: 0
crashes: 0
peak commit: 13996 MB

PR:

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: AMD Radeon(TM) Graphics
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 834 (PresentX 835)
presents per 2 s (last 3): 33 35 33
device removals: 0
crashes: 0
peak commit: 14120 MB

Not tested

  • Full workspace test suite and NVIDIA wave32 adapter (verified targeted subsystem tests + 60 s retail smoke on AMD Radeon native wave64 only)

AI use

  • Antigravity CLI orchestrated worktree checkout, local build/test/smoke execution, and summary formatting; all test and smoke outputs above are verbatim from this machine.
**@⁠amazedturnip** on GitHub · 2026-11-25 16:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2345#issuecomment-7167904194) Independent AMD Radeon (native wave64) verification of exact head `10e9fb761fbf19c4b8e0e8fa745835d8127732ee` (clean detached worktree, compared against `main` `3f4495a2b325`). **Tested** - Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc - Adapter: `AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64)` (`XCL_ADAPTER=radeon`, native wave64) - Targeted unit tests (debug): `cargo test -p xcl --lib hle::d3d12x::sparse -- --test-threads=2` — 17 passed, 0 failed, 1 ignored (exit 0) **Regression run** (`scripts/smoke.ps1 -Seconds 60`, release build, `XCL_ADAPTER=radeon`) main: ``` xcl-smoke v1 commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09 gpu: AMD Radeon(TM) Graphics title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 782 (PresentX 782) presents per 2 s (last 3): 34 2 2 device removals: 0 crashes: 0 peak commit: 13996 MB ``` PR: ``` xcl-smoke v1 commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09 gpu: AMD Radeon(TM) Graphics title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 834 (PresentX 835) presents per 2 s (last 3): 33 35 33 device removals: 0 crashes: 0 peak commit: 14120 MB ``` **Not tested** - Full workspace test suite and NVIDIA wave32 adapter (verified targeted subsystem tests + 60 s retail smoke on AMD Radeon native wave64 only) **AI use** - Antigravity CLI orchestrated worktree checkout, local build/test/smoke execution, and summary formatting; all test and smoke outputs above are verbatim from this machine.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-25 16:49 UTC · original

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

No Linux/Wine report in the thread yet; adding one (Aniseto and amazedturnip cover native Windows here).

  • gpu_ suite (--release --locked, --test-threads=2): 144 passed / 3 failed / 1 ignored, identical to this rig's plain origin/main baseline (known set: fuzz seed 1003 of #2115, gpu_nonfused_mad_and_mac_prevent_fma_contraction, gpu_depth_buffer_created_for_unordered_access_is_placed). No delta from the PR.
  • New tests (outside the gpu_ filter), targeted: flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight and flush_parked_quarantines_tiles_until_title_queues_finish: both pass (2 passed; 0 failed).

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-25 16:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2345#issuecomment-7168576037) **Tested**: current PR head merged onto current `origin/main` (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target `x86_64-pc-windows-gnu` run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29). No Linux/Wine report in the thread yet; adding one (Aniseto and amazedturnip cover native Windows here). - `gpu_` suite (`--release --locked`, `--test-threads=2`): 144 passed / 3 failed / 1 ignored, identical to this rig's plain `origin/main` baseline (known set: fuzz seed 1003 of #2115, `gpu_nonfused_mad_and_mac_prevent_fma_contraction`, `gpu_depth_buffer_created_for_unordered_access_is_placed`). No delta from the PR. - New tests (outside the `gpu_` filter), targeted: `flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight` and `flush_parked_quarantines_tiles_until_title_queues_finish`: both pass (`2 passed; 0 failed`). **Not tested**: retail titles (no title data on this lane, counts only). **AI use**: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 18:25 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 18:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/2345#issuecomment-7170889136) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
This discussion has been locked. Commenting is limited to contributors.
No description provided.