D3D12.X: reuse a retired sparse pool once its unmap fence has completed #930
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!930
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/930/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@DavidM1911 on GitHub · 2026-11-24 08:37 UTC · original
DavidM1911:sparse-reuse-retired→main· +28 −12 · 1 files · 2 commits · closed without mergingFixes #913.
retire_free_poolsparks a fully-free 64 MiB pool heap for at least 2 s, buttake_tileonly ever poppedself.freeor calledCreateHeap— it never looked atretired. An alloc/free cycle inside that window therefore minted a fresh 64 MiB heap every time: the #348 lib test asked a 12 GB card for ~18 GB of pools.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs: the pool-placement tail oftake_tileis factored intoadopt_heap; beforeCreateHeap,take_tilenow adopts the oldest retired heap whose unmap fence value has already completed (GetCompletedValue() >= retired.value). Heaps still inside their fence/age window stay retired, so the decommit-before-reuse ordering from #348 is preserved, andretire_free_poolsstill shrinkspools/freethe same way.Tested
x86_64-pc-windows-msvc, rebased onmain09940bb:cargo test -p xcl --lib sparse: 13 passed, 0 failed, 1 ignoredcargo test -p xcl --lib -- --test-threads=4: 675 passed, 0 failed, 21 ignored (one earlier parallel run hit the knowncoherent_buffer_sanitizes_console_flags_and_stateflake reported in #913; it passes standalone and on rerun)cargo test --workspace -- --test-threads=4: 694 passed, 1 failed (same flake), 25 ignoredscripts/smoke.ps1 -Seconds 60,cargo build --release -p xcl:main
a6f5f7abaseline is stale relative to the rebase; closest fresh main smoke on this machine:this PR's head
bd2e4c6:Not tested
take_tile/retire_free_poolsvs decommit parking); whichever lands second may need a small rebaseAI use
@dcastell1 on GitHub · 2026-11-24 08:56 UTC · original
This patch fails the sparse e2e check on Windows, twice in a row, with the same value:
0xa5000010is the test's own pattern coming back, so a tile that the retired pool hands out again is not zeroed before the next use — the zeroing that the 20-submit upload path relies on is skipped for a reused tile. Without the patch the same two tests pass (713 passed, 0 failed, 41 ignored on this box), so it is this change's reuse path rather than the test.Environment: Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build,
main@beaa245plus this PR applied withpatch -p1(clean, no fuzz). Two full runs, same failure. Tree restored afterwards; no game data.AI-assisted (opencode): applied the patch to a built tree, ran the suite twice, reverted it.
@ettehn on GitHub · 2026-11-24 08:46 UTC · original · edited 2026-11-24 08:58 UTC
Resolved on
e78e2df. Retested on the RTX 5070 Ti Laptop. The clean head passed the full debug library suite (675 passed, 0 failed, 21 ignored). In a second checkout with only the original test probe added, all eight completed-fence retirement/reuse rounds now returned the clearing flag. The same probe failed on round 0 atbd2e4c6.On
bd2e4c6, the first tile returned from a retired heap misses the normal clearing step. Intake_tile, the retired-heap branch returns(self.adopt_heap(heap), false). The caller queues(t, TILE)into_zeroonly when that flag is true. Fence completion establishes that unmapping finished; it does not clear the heap contents. The other tiles from the very same heap get the clearing flag when popped fromself.free.Reproduced on native Windows (RTX 5070 Ti Laptop) with the pool-retirement test from #923 and a D3D12 fence explicitly completed at the pool's retirement value. The fresh heap correctly returned
false; the first reacquisition failed thereusedassertion in round 0. Changing just the retired-heap return to(self.adopt_heap(heap), true)passed all eight retirement/reuse rounds. Thesparsefilter with the probe included finished with 15 passed, 0 failed, 1 ignored. This checks the clearing decision; I haven't measured visible effects in a retail title.12 GB VRAM measurements on clean heads. I ran the debug library suite (
cargo test -p xcl --lib -- --test-threads=4) on both proposed fixes sharing parent09940bb, sampling device-widenvidia-smimemory every 250 ms on the RTX 5070 Ti Laptop (driver 621.24). Order and peaks: #930bd2e4c64,477 MiB; #92371bda932,183 MiB; #923 2,331 MiB; #930 5,388 MiB. Starting samples were 903–982 MiB. All four runs passed (675 tests on #930, 676 on #923, 21 ignored each). The same parent previously peaked at 11,469 and 11,687 MiB on this machine. These #930 measurements used the submitted code before my local clearing-flag change. Two runs per head, library workload only.OpenAI Codex (GPT-6.2 Astra) assisted with verification.
Originally posted by @ettehn in https://github.com/ivall/xcl/issues/930#issuecomment-7126555760
Originally posted by @ettehn in https://github.com/ivall/xcl/issues/930#issuecomment-7126555760
@Lifither on GitHub · 2026-11-24 09:12 UTC · original
RX 590 on native Windows: sparse-upload e2e passes on
e78e2dfTested on clean
main077ce40c3e371cf3df8c57985b1cc6b1db39e75aand clean PR heade78e2df6dcd951d1392f091a0f63c8f8fcf0aaa9, in separate build directories. Radeon RX 590 Series (8135 MiB), driver31.0.21923.1000, Ryzen 5 5600G, Windows 11 build 26300, Rust 1.100.0 MSVC x64, DXC 1.9.2609.5, debug builds. XCL logged the RX 590 in every run.Both builds passed. I alternated the e2e runs three times. Each revision passed 3/3 runs, with one case executed and zero failures, ignored tests or skips per run. The synthetic title ran to completion, rendered and read back its triangle, and passed the 80 MiB / 20-submit sparse-upload check including reused-tile zeroing in all six runs. The stale readback from the RTX 5090 report did not reproduce on this setup.
Not tested: The debug-layer variant, full workspace suite, peak VRAM, the exact repeated pool-retirement stress case in #913, and retail startup or rendering.
AI use: OpenAI Codex (GPT-6, exact variant unavailable) ran the tests, checked the logs, and drafted this report. No XCL code changes.
@dcastell1 on GitHub · 2026-11-24 09:22 UTC · original
Heads-up: my failure above was measured on
main@beaa245with the head the PR had then, so it is not a verdict one78e2df. I am re-running cleanmain@077ce40and this PR ate78e2dfin separate build directories now, with the same e2e check, and will post the pair (main and PR) when it finishes. If the zeroing is fixed on the new head, ignore the earlier comment; if it still shows, you get the same value with the current SHAs.@dcastell1 on GitHub · 2026-11-24 09:23 UTC · original
Retraction on the current pair: the failure does not reproduce, and my earlier comment was against stale SHAs.
On this box, same machine and command, in the same tree:
The sparse e2e check (
reused tile untouched chunk was not zeroed: 0xa5000010) that failed twice onbeaa245with the earlier head now passes, so whatever changed between those heads fixed the zeroing path. No failure to chase here from my side; sorry for the noise.Environment unchanged: Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build,
patch -p1clean. Tree restored afterwards; no game data.AI-assisted (opencode): rebuilt on the new base, ran both pairs, reverted.
@ivall on GitHub · 2026-11-24 09:32 UTC · original
Closing as superseded by #923 (merged in
6bac4b4), which takes a retired pool back the same way and passed the sparse e2e check here. Thanks!Pull request closed