D3D12.X: retain reserved backing through the final tile mapping #3734
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3734"
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?
Imported from ivall/xcl. Originally posted by jeroenhaentjens on 2026-12-02T21:36:13Z.
What & Why
Part 4 of the review split of Draft #3682. Keep the tiles and heaps of every mapped reserved texture alive through active and retiring submit queues and the separate tile-mapping queue's final NULL mapping. This applies with XCL_LATE_RELEASE=0 as well. A texture that cannot return to the pool still receives a final NULL mapping and fence before native release.
What is in it
Tested
ec06277bd3. Intel Core i7-9750H, NVIDIA Quadro RTX 3000 (driver 597.06 / 32.0.15.9706), Windows 11 25H2 build 26200.9974, Rust MSVC 1.100.0 and DXC 1.9.2609.5.Regression run
Baseline (main)
PR head
Not tested
AMD, Linux, and scenes with sustained bursts of mapped texture release. The GPU regression covers the ordering directly.
AI use
OpenAI Codex (GPT-6, specific revision unavailable) assisted with the implementation, tests and PR update.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T21:43:53Z.
Review of
d9ca1779(code reading only, not a merge-check) · 4 mediumIn short: This PR keeps a released reserved texture's tiles, and so their pool heaps, until the title's queues are done with it and the NULL tile mapping has completed. It also changes
late_releaseto wait for the marks of retiring queues, ignore the device-removedu64::MAXvalue, and hold back parked backing while a queue on the same device has no retirement mark. It is #3682'sfd938727with the texture-budget gates removed, and it builds againstmainon its own. The mechanism holds up, and the GPU test would fail without it. It is now on by default, though; a failed queue retirement keeps backing forever, and the new sealing rules are untested.Medium
A failed queue retirement holds reserved backing forever.
queue_completion_snapshot_for_release(present.rs~496) reports aRetiring::Failedqueue as unmarked. AFailedentry never leaves the registry (sweepremoves onlyRetiring::Mark), and nothing retries its mark.Dead::blocked_backing(late_release.rs~40, ~132) holds back every mapped reserved texture released later on that device, with its tiles and heaps, for the rest of the run.Held::is_emptythen never becomes true, so every pinnedholdwaits its fullIDLE_WAIT.Fix: retry the retirement mark, as #3682's later commits do, or put a bound on the hold.
The default path changes, where in #3682 this was behind the budget.
real.rs~2518,vram.rs~3136). Each release of one that does not go back to the pool (render targets, depth, textures with private data) now queues a NULLUpdateTileMappingsand aSignalon the mapping queue. Before, its tiles went idle at release.XCL_LATE_RELEASE=0, mapped reserved textures are now held and recycled through the reserved pool, becauseforget_pagesgetsheld = true.The new sealing rules have no tests.
unmarked_retirement_does_not_hold_unrelated_releases(late_release.rs~501) only shows that entries that are not parked pass.open, keeps its order, and goes once the mark is installed.retiringmark: every test passes&[]forretiring.Two changes in one PR, over the size target. The
late_release/present.rsrework (retiring marks in the batch,open_prefixrevisions, unmarked-device blocking, theu64::MAXcheck intake_gone) stands apart from keeping the tile backing through the NULL mapping. Together they are about 540 changed lines. Theu64::MAXhandling also overlaps #3125. Splitting the queue-snapshot part out would make each half reviewable on its own.Checked and fine
mainalone: no texture-budget symbol from #3682 is used. Compared withfd938727, thetexture_budget_enabled()gates and the L0 test setup are gone, and a simpler unmarked-device rule stands in for #3682's later failed-retirement handling. If both stay open, #3682 will need reworking onto this one.unmap_rangesignals afterUpdateTileMappings,recycle_readytakespages.mark()after it, and tiles are released only incollect_releasedonce that value has completed.make_spareskeepbacking: None.open[..count]cannot go out of bounds: onlybegin_sealand a failedend_sealremove fromopen, and both bumpopen_revision.HELDthenPARKING, with no reverse path.PAGESkeys andGetDeviceboth give the raw pointer of the hooked device, soblocked_backingcompares like with like.XCL_LATE_RELEASE=0, skips without tiled-resources tier 2, and onmainwould fail at the tile-users assertion. README updated.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by jeroenhaentjens on 2026-12-02T22:28:27Z.
@Foniass I isolated the failed-signal spare test in a WARP process and verified it three times. Failed retirement markers now retry per queue. The new tests cover waiting on an installed marker and keeping parked backing in order until the recovered marker completes. The description includes the scope with XCL_LATE_RELEASE=0 and the updated 60-second head run.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T22:33:57Z.
Follow-up review of
ec06277b, sinced9ca1779(code reading only, not a merge-check) · 1 mediumIn short: Since
d9ca1779a failed queue retirement is retried: the retirement worker re-signals the queue every 250 ms and turns the failed entry into a mark. New tests cover retiring marks and parked backing on an unmarked device. The spare test that failed CI now runs in its own WARP process. The description now says the change also applies withXCL_LATE_RELEASE=0. Three of the four earlier points are fixed and nothing new turned up. The PR is still two changes in one.Medium
Two changes in one PR, over the size target (still open).
open_prefix/open_revisionand unmarked-device blocking (late_release.rs~40-160);queue_completion_snapshot_for_releaseand the retry worker (present.rs~505-700).vram.rs,real.rs).u64::MAXhandling andchecked_add(1).filter(|&next| next != u64::MAX)inlate_release.rsstill repeat #3125.Fix: make the queue-completion part its own PR and stack this one on it.
Checked and fine
retry_failed_retirements(present.rs~645) re-signals eachRetiring::Failedqueue outside the registry lock, andrecover_retiring(~424) turns it intoRetiring::Mark.sweepcan then remove it,Dead::blocked_backinglets go, andHeld::is_emptycan become true. A queue on a removed device is skipped.XCL_LATE_RELEASE=0, and that a texture that cannot return to the pool still gets a final NULL mapping and fence. Scenes with bursts of releases are under Not tested.release_waits_for_a_retiring_queue_mark(late_release.rs~520): a batch waits for aretiringmark.parked_backing_waits_in_order_for_the_recovered_queue_mark(~536): parked backing on an unmarked device stays inopen, in order, while other entries go, and goes once the mark completes.failed_retirement_stays_pinned_until_its_recovered_mark: the registry goes from failed to marked to swept.spares_without_their_signal_are_releasedruns in a child process on WARP. Ond9ca1779it saw another test's mapping value on a reused device and poisonedPAGESfor two later tests.retire_released_queuenow uses the sameretirement_device/signal_retirementhelpers as the retry.queue_completion_snapshot_for_releasedoes not wait onPreparing, so a release during a retirement cannot block on its own queue.open. Blocked entries go back to the front in order.HELDthenPARKING.drain_recycledreads fence values outsidePAGESand checks that the fence is still the same one.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-03T13:41:14Z.
merge-check
base:
a815de932chead:
ec06277bd3merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3023 passed, 0 failed, 56 ignored (two runs, same counts); SKIPPED: 25 in the first run (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same list as on main
395405e4, and 26 in the second (onepso_asynctest found no room for a build ahead, "short of commit"); failing: none. Thevram,late_releaseandpresenttests at 8 threads: 23 of 23 runs pass.review: read the whole diff (5 files, +555 -167). No blocking finding.
if held && was_mappedinforget_pagesdisabled), it fails with "the native release must retain the tile user" (left 0, right 1). On the PR it passes with 0 debug-layer messages.So a large burst keeps its tiles for up to about half a second longer, and steady churn needs no more memory. With
XCL_LATE_RELEASE=0the releases themselves are faster than on main (106–172 ms against 318–361 ms), because the thread does the work now.3) Low: when the new GPU test fails, its process may not end. With the change of point 1, 2 of my 4 runs never exited after the failure (one thread left, not killable). The parent waits with
Command::output()and no time limit, socargo testwould hang there instead of reporting the failure. I did not find the cause. The passing test never did this.4) With
XCL_LATE_RELEASE=0set for the test run,a_pipeline_xcl_lets_go_is_released_by_the_threadfails on every run. It fails on main too, so it is not from this PR.5) For the maintainer: Foniass' point that this is two changes (queue completion, then the backing) is still open. I checked them together and did not test them apart.
6) Not tested: a retail title, AMD, a queue whose retirement signal really fails (only the unit tests cover the retry).
performance: measured in point 2 for bursts of releases. I ran no smoke comparison (no retail title here); the author's has 1539 frames against 1520 and 13945 MB against 13865 MB.
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.