D3D12.X: fence sparse tile reuse after the last placed-buffer pin #2531

Open
github-bot wants to merge 1 commit from github-bot/gh-2531 into main AGit
Owner

@⁠razormontana on GitHub · 2026-11-25 21:47 UTC · original
razormontana:d3d12x/retire-sparse-tiles-after-final-pin → main · +120 −46 · 2 files · 1 commits · open

D3D12.X: fence sparse tile reuse after the last placed-buffer pin

When a sparse window unmaps a tile still pinned by a placed buffer, the last unpin can put the tile back in the pool before outstanding queue work completes. Defer that return to the existing sparse tile quarantine and take fence marks after the last pin drops. Part of #2457 (item 1), #1773 and #1833.

What is in it

  • sparse.rs queues unused tiles at the last unpin. Allocation and submission fence the queued tiles on the sparse and title queues. Pool reuse and retirement continue to use the free list.
  • A CPU regression checks both mock queue completion orders and exactly-once return. The README documents when a pinned sparse tile returns to the pool.

Tested

  • Windows 11 Pro 22631, Intel Core i7-10700K, GeForce RTX 3070 8 GB (driver 617.42), Rust 1.100.0 MSVC and Windows SDK DXC.
  • Clean 6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44. cargo test -p xcl --lib -j 2 hle::d3d12x::sparse::tests::unpinned_sparse_tiles_wait_for_every_queue_before_reuse -- --exact passed 1 test with 0 failures, ignored tests or GPU skips.
  • A standalone, CPU-only control using the previous immediate free-list return failed the assertion that the last unpin keeps the tile unavailable.
  • cargo build --offline --locked --workspace and cargo build --offline --locked --release --workspace succeeded. The debug cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output run with XCL_ADAPTER=3070 reported 1,424 passed, 0 failed and 46 ignored across 37 targets. The pass count includes 26 SKIPPED notices (21 native-wave64 checks, 3 unsupported per-lane forms, 1 reserved cube with mips and 1 heap-window check).

Regression run

Both clean release builds ran scripts/smoke.ps1 -Game <folder> -Seconds 60 on the same retail title in the Series S profile on the RTX 3070. They used XCL_DIRECT_DXIL=1, networking off and identical starting copies of XCL's warmed cache. NVIDIA's driver cache settings were left at their defaults.

Main

xcl-smoke v1
commit: 6d12f58a229bc73889878a448c64dc3af25eeba0
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 651 (PresentX 651)
presents per 2 s (last 3): 8 0 15
device removals: 0
crashes: 0
peak commit: 14469 MB

Candidate

xcl-smoke v1
commit: 6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 808 (PresentX 808)
presents per 2 s (last 3): 0 18 23
device removals: 0
crashes: 0
peak commit: 14692 MB

Not tested

  • The focused regression uses simulated fence completion. The retail smoke checks startup but does not establish that the last-pin retirement case occurred. AMD and Intel GPU coverage is pending.

AI use

  • OpenAI Codex (GPT-6.2 Sol) traced the sparse tile lifetime, implemented the fix, wrote and ran the focused regression, independently reviewed the diff and evidence, and drafted this description. The lead agent ran the workspace suite and retail smoke using OpenAI Codex (GPT-6.2).
**@⁠razormontana** on GitHub · 2026-11-25 21:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/2531) `razormontana:d3d12x/retire-sparse-tiles-after-final-pin` → `main` · +120 −46 · 2 files · 1 commits · open # D3D12.X: fence sparse tile reuse after the last placed-buffer pin When a sparse window unmaps a tile still pinned by a placed buffer, the last unpin can put the tile back in the pool before outstanding queue work completes. Defer that return to the existing sparse tile quarantine and take fence marks after the last pin drops. Part of #2457 (item 1), #1773 and #1833. **What is in it** - `sparse.rs` queues unused tiles at the last unpin. Allocation and submission fence the queued tiles on the sparse and title queues. Pool reuse and retirement continue to use the free list. - A CPU regression checks both mock queue completion orders and exactly-once return. The README documents when a pinned sparse tile returns to the pool. **Tested** - Windows 11 Pro 22631, Intel Core i7-10700K, GeForce RTX 3070 8 GB (driver 617.42), Rust 1.100.0 MSVC and Windows SDK DXC. - Clean `6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44`. `cargo test -p xcl --lib -j 2 hle::d3d12x::sparse::tests::unpinned_sparse_tiles_wait_for_every_queue_before_reuse -- --exact` passed 1 test with 0 failures, ignored tests or GPU skips. - A standalone, CPU-only control using the previous immediate free-list return failed the assertion that the last unpin keeps the tile unavailable. - `cargo build --offline --locked --workspace` and `cargo build --offline --locked --release --workspace` succeeded. The debug `cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output` run with `XCL_ADAPTER=3070` reported 1,424 passed, 0 failed and 46 ignored across 37 targets. The pass count includes 26 `SKIPPED` notices (21 native-wave64 checks, 3 unsupported per-lane forms, 1 reserved cube with mips and 1 heap-window check). **Regression run** Both clean release builds ran `scripts/smoke.ps1 -Game <folder> -Seconds 60` on the same retail title in the Series S profile on the RTX 3070. They used `XCL_DIRECT_DXIL=1`, networking off and identical starting copies of XCL's warmed cache. NVIDIA's driver cache settings were left at their defaults. Main ``` xcl-smoke v1 commit: 6d12f58a229bc73889878a448c64dc3af25eeba0 gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 651 (PresentX 651) presents per 2 s (last 3): 8 0 15 device removals: 0 crashes: 0 peak commit: 14469 MB ``` Candidate ``` xcl-smoke v1 commit: 6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44 gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 808 (PresentX 808) presents per 2 s (last 3): 0 18 23 device removals: 0 crashes: 0 peak commit: 14692 MB ``` **Not tested** - The focused regression uses simulated fence completion. The retail smoke checks startup but does not establish that the last-pin retirement case occurred. AMD and Intel GPU coverage is pending. **AI use** - OpenAI Codex (GPT-6.2 Sol) traced the sparse tile lifetime, implemented the fix, wrote and ran the focused regression, independently reviewed the diff and evidence, and drafted this description. The lead agent ran the workspace suite and retail smoke using OpenAI Codex (GPT-6.2).
A decommitted sparse tile can stay pinned after the window unmap is queued. Queue its eventual last unpin for the existing fence retirement path before the tile can enter the free list. Mark the sparse queue and title queues from an allocation or submission, outside the Release callback.

Part of #2457 (item 1) and #1773.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:33:05 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 22:08 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 22:08 UTC · [original](https://github.com/xcl-dev/xcl/pull/2531#issuecomment-7175986861) 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!
Author
Owner

@⁠xpatfussy69x on GitHub · 2026-11-25 22:40 UTC · original

Test run on exact head 6d7f8b9 (6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44, on its base 6d12f58), clean tree.

Tested

  • NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.2124, 32-lane waves only), AMD Ryzen 5 7500F, Windows 11, Rust 1.100.0; debug build for the tests, release for the smoke runs
  • cargo test --workspace -- --test-threads=4: 1424 passed, 0 failed, 46 ignored
  • SKIPPED (25): 21 × no wave64; 1 × no heap windows; 3 × per-lane form refused V_MUL_F16 / V_PK_MUL_F16 / V_CVT_F16_F32 (on main too)
  • cargo test -p xcl --lib unpinned_sparse_tiles: 1 passed, 0 failed
  • This PR's new tests in the workspace run:
    • unpinned_sparse_tiles_wait_for_every_queue_before_reuse: ok
  • Merges with #2528 (item 2 of #2457, also in sparse.rs) without conflicts (git merge-tree); the two were not run together

Regression run (60 s, default settings, a retail title)

main:

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 60
exit: 0x0
frames shown: 1091 (PresentX 1091)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14814 MB

this PR:

xcl-smoke v1
commit: 6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44
gpu: NVIDIA GeForce RTX 3060
title: c3f791f3
seconds: 60
exit: 0x0
frames shown: 1140 (PresentX 1140)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14787 MB

No crash or device removal; frames 104 % of main's, peak commit 100 %.

Not tested

  • Whether a placed buffer unpins a parked tile while a queue still uses it in this run: a regression check only
  • The PR merged into current main (tested on its own base; it merges into e1d84b7 without conflicts)
  • AMD / native wave64

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and both smoke runs on the machine above and wrote this report.
**@⁠xpatfussy69x** on GitHub · 2026-11-25 22:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/2531#issuecomment-7176661063) Test run on exact head `6d7f8b9` (`6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44`, on its base `6d12f58`), clean tree. **Tested** - NVIDIA GeForce RTX 3060 12 GB (driver 32.0.16.2124, 32-lane waves only), AMD Ryzen 5 7500F, Windows 11, Rust 1.100.0; debug build for the tests, release for the smoke runs - `cargo test --workspace -- --test-threads=4`: 1424 passed, 0 failed, 46 ignored - SKIPPED (25): 21 × no wave64; 1 × no heap windows; 3 × per-lane form refused `V_MUL_F16` / `V_PK_MUL_F16` / `V_CVT_F16_F32` (on `main` too) - `cargo test -p xcl --lib unpinned_sparse_tiles`: 1 passed, 0 failed - This PR's new tests in the workspace run: - `unpinned_sparse_tiles_wait_for_every_queue_before_reuse`: ok - Merges with #2528 (item 2 of #2457, also in `sparse.rs`) without conflicts (`git merge-tree`); the two were not run together **Regression run** (60 s, default settings, a retail title) main: ``` xcl-smoke v1 commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea gpu: NVIDIA GeForce RTX 3060 title: c3f791f3 seconds: 60 exit: 0x0 frames shown: 1091 (PresentX 1091) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14814 MB ``` this PR: ``` xcl-smoke v1 commit: 6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44 gpu: NVIDIA GeForce RTX 3060 title: c3f791f3 seconds: 60 exit: 0x0 frames shown: 1140 (PresentX 1140) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14787 MB ``` No crash or device removal; frames 104 % of `main`'s, peak commit 100 %. **Not tested** - Whether a placed buffer unpins a parked tile while a queue still uses it in this run: a regression check only - The PR merged into current `main` (tested on its own base; it merges into `e1d84b7` without conflicts) - AMD / native wave64 **AI use** - Claude Code (Claude Opus 5.5) ran the tests and both smoke runs on the machine above and wrote this report.
Author
Owner

@⁠emirduran707 on GitHub · 2026-11-25 22:52 UTC · original

Independent AMD RDNA4 (native wave64) verification of exact PR head 6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44 on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver 32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC 1.9.2602.17).

Tested

  • cargo build --workspace (debug): passed (0 errors).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1422 passed, 2 failed, 46 ignored (8 SKIPPED: 6 per-lane DXIL forms refused by host adapter/driver, 1 heap_window_out_of_memory_falls_back_to_the_switch_form no heap windows, 1 pso_measurement_compiles_an_exact_synthetic_record Windows Developer Mode off).
    • The new test hle::d3d12x::sparse::tests::unpinned_sparse_tiles_wait_for_every_queue_before_reuse passed.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and fuzz_validate_and_gpu_3) are pre-existing on unmodified main on this RX 9060 XT / driver 32.0.31044.16.
  • cargo build --release -p xcl + 60 s retail-title smoke test (scripts/smoke.ps1, offline):
xcl-smoke v1
commit: 6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1600 (PresentX 1600)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13934 MB

(Compare against main 68a284a on this machine: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • NVIDIA / Intel GPUs, Linux / Wine.

AI use

  • Verification run and report prepared with Antigravity (Gemini 4 Neon); all build, test, and smoke results are from live runs on this machine.
**@⁠emirduran707** on GitHub · 2026-11-25 22:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2531#issuecomment-7176879243) Independent AMD RDNA4 (native wave64) verification of exact PR head `6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44` on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver `32.0.31044.16`, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC `1.9.2602.17`). **Tested** - `cargo build --workspace` (debug): passed (`0` errors). - `cargo test --workspace --no-fail-fast -- --test-threads=4`: `1422 passed, 2 failed, 46 ignored` (`8 SKIPPED`: 6 per-lane DXIL forms refused by host adapter/driver, 1 `heap_window_out_of_memory_falls_back_to_the_switch_form` no heap windows, 1 `pso_measurement_compiles_an_exact_synthetic_record` Windows Developer Mode off). - The new test `hle::d3d12x::sparse::tests::unpinned_sparse_tiles_wait_for_every_queue_before_reuse` passed. - The 2 failures (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` and `fuzz_validate_and_gpu_3`) are pre-existing on unmodified `main` on this RX 9060 XT / driver `32.0.31044.16`. - `cargo build --release -p xcl` + 60 s retail-title smoke test (`scripts/smoke.ps1`, offline): ``` xcl-smoke v1 commit: 6d7f8b9269a1a83f0b1e23805fd3388cdc0c2c44 gpu: AMD Radeon RX 9060 XT title: 21222967 seconds: 60 exit: 0x0 frames shown: 1600 (PresentX 1600) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13934 MB ``` (Compare against `main` `68a284a` on this machine: `1573 frames, 14420 MB peak, 0 device removals, 0 crashes`.) **Not tested** - NVIDIA / Intel GPUs, Linux / Wine. **AI use** - Verification run and report prepared with Antigravity (Gemini 4 Neon); all build, test, and smoke results are from live runs on this machine.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-25 23:07 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).

gpu_ suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of unpinned_sparse_tiles_wait_for_every_queue_before_reuse: passed. Sparse tiling on RADV executes for real on this lane.

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 23:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/2531#issuecomment-7177182699) **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). `gpu_` suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR. Targeted run of `unpinned_sparse_tiles_wait_for_every_queue_before_reuse`: passed. Sparse tiling on RADV executes for real on this lane. **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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2531/head:github-bot/gh-2531'
git switch 'github-bot/gh-2531'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2531'
git switch 'github-bot/gh-2531'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2531'
git switch 'github-bot/gh-2531'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2531'
git switch 'main'
git merge --squash 'github-bot/gh-2531'
git switch 'main'
git merge --ff-only 'github-bot/gh-2531'
git switch 'main'
git merge 'github-bot/gh-2531'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.