D3D12.X: cover tile mappings whose Signal failed #3566
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3566"
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 lucsoft on 2026-12-01T09:30:49Z.
vram's tile-mapping queue raised its value and then signalled it, ignoring the result. When that Signal failed, the value was one no Signal would ever reach: every queue's next submit waited for it (
before_execute), and a retired texture's NULL unmap counted as done although nothing marked it. This makes the value move only when the Signal was queued, and gives every mapping whose Signal failed a later one before anything counts on it. It is split out of #3553 (asked for in its review): it applies on every platform, while #3553 is Wine-on-AMD only.Related: #3553 builds on this (its spares and new placements count on a Signal reaching their mappings). #3010 (draft) changes the same Signal lines to signal once before the next title work; with
signal_nowthat single Signal would get this failure handling too.What is in it (
vram.rs, plus the callers ofbefore_execute)Pages::signal_nowadvancesvalueonly after the Signal was queued and reports a failure;mapandunmap_rangego through it. A mapping or unmapping whose Signal failed leaves the pagesunmarked.Pages::markgives the value that covers every mapping queued so far:value, or a new Signal when one isunmarked.before_executecalls it afterrelease_held_unmaps(which can queue a NULL unmap of its own) and has the title's queue wait for that value.recycle_readyqueues a retired texture with that mark, orUNMARKEDwhen no Signal can be queued;drain_recycledgives such textures a later mark before they can return to the pool.before_executereturns false: the submission is not made and the title stops with that cause (PreparationOutcome::MappingUnmarked: "could not queue a Signal or Wait for texture page mappings"), following the existing fail-closed rule inprepare_title_submission, instead of going out with mappings nothing covers. The GPU content probe returns an error.before_execute, and the title's work waits for it; with no Signal at allbefore_executereturns false; a held unmap that becomes releasable insidebefore_executewith its NULL mapping's Signal failing gets a later mark, and the work waits for it; a retired texture whose unmap's Signal and the retry fail stays out of the pool until a later mark completes. Signal failures are injected through a test-only counter (FAIL_SIGNALS). The same test injects a failed consumer Wait and verifies that the next attempt still waits for the replacement mark.Tested
hle::d3d12x::vram::tests::run on this head under Wine: ok. 71 passed; 0 failed; 1 ignored; 0 measured; 2702 filtered out; finished in 2.58sf5a57437: 2,906 passed, 0 failed, 51 ignored in the four-thread workspace suite. Test reportRegression run
Both runs below were made with
-Title <game name>; after the runs that flag was dropped from our wrapper, and thetitle:line of both blocks now showssmoke.ps1's default label instead (f651e787, the hash of the game folder's name). Nothing else in the blocks was changed; the runs are the same.main:
PR:
The PR's kernel log recorded 0 page faults, 0 ring timeouts, 0 ring resets, 0 coredumps, 0 bus losses.
The 180 s standalone RADV run of this head lost the device at about 158 s after three kernel page faults and a gfx ring timeout. The preceding head showed the same failure pattern in two runs. The follow-up above covers startup. The full #3553 stack completed 180 s on the same host without a page fault.
Not tested
AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:39:05Z.
Review (head
69700342, diff read, not a merge-check; draft,PR descriptionred: the smoke block isTODO-SMOKE):title_textures.rs~2066. This PR returnsMappingUnmarkedthere; #3553 returnsRetryRequired, which ends the title with the misleading "still failed after bounded retries" message I noted on #3553. Thevram.rshunks are the same code and auto-merge. Landing this first and rebasing #3553 onto it, without #3553's copy, keeps the better stop reason.stop_if_device_removed()inprepare_title_submission. Only injected failures were tested, as the description says.list_x.rs~3622 can't run, becausesparse::before_executenever returnsMappingUnmarked; it only makes the match complete. As on main,mapped_after_waitnever callsvram::before_execute.FAIL_SIGNALS, which skips the native Signal; they don't exercise a real driver failure. That is the right injection point for this bug.Fine:
signal_now,vram.rs~1961), so no queue waits for a value nothing will signal. That was the hang on main.mark()runs afterrelease_held_unmaps, so a queued NULL unmap is covered too.#3010 rewrites the same Signal lines, so the two will conflict.
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by lucsoft on 2026-12-01T09:50:34Z.
Thanks. Since your review: the smoke block is in (
69700342, 2289 frames, clean) and it is out of draft. #3553 is now stacked on this PR (db57f30con69700342) without its own copy, so it getsMappingUnmarkedand the right stop message. Thelist_xarm is there only to make the match complete;mapped_after_waitstill never callsvram::before_execute. I left it rather than push a new head for a line that cannot run.Imported from ivall/xcl. Originally posted by mokkamokacaffe on 2026-12-01T09:54:11Z.
Native Windows / NVIDIA verification for #3566
Tested PR head
69700342ee0b67429a4dbdb771cffa5d708bfde6and used its exact upstream parent86e86fcb33f94fa5d0c809d9b50af7b84bf49ccefor the smoke comparison. The PR head still matched after testing.Windows 11 24H2 build 26100.9711, Intel Core i9-14900KF, NVIDIA GeForce RTX 4080 SUPER, driver 621.40, Rust 1.100.0 (x86_64-pc-windows-msvc). Workspace tests used the debug profile. Both smokes used release builds.
Tested
uma_drivertests, the placed-texture pixel preservation test, all threestream_recheck_*tests, and the root-signature serialization test flagged in the Wine report passed on this machine.Commands from the PR worktree:
Regression run
Each clean worktree used its own
cargo build --release -p xclbinary andscripts/smoke.ps1. The parent ran first. Both runs used the same local title for 180 seconds with networking and preparation disabled, the same DXC and Agility SDK, and separate empty XCL data and shader cache directories. The PR showed 102.1% of the parent's frames and 99.7% of its peak commit, meeting the repository's 80% frame minimum and 125% memory ceiling.Main (exact parent)
PR head
Not tested
A spontaneous mapping-queue Signal failure on the NVIDIA driver remains unverified. The focused tests injected failures. The smoke pair checks ordinary execution; it does not establish a performance improvement.
AI use
OpenAI Codex ran the local builds, tests, and smokes, checked the logs, and prepared this report.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:17:50Z.
Triage (#1607) – head
6970034#3553 contains this PR's commit (
6970034) and is stacked on it; this is the split-out base requested in #3553's review, not a duplicate. #3010 changes the same Signal lines to signal once per title submission, which is a different change.No problems found in the diff. vram.rs:Pages::signal_now advances
valueonly after a Signal is queued;markandmark_pending_recyclescover unmarked mappings before before_execute or the reserved pool depend on them; and every non-test caller of vram::before_execute now handles the false return (title_textures.rs refresh_parts, submit_on, probe_gpu_content).Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T13:45:46Z.
merge-check
base:
b2b1f109d2head:
69700342eemerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> did not finish: the lib test binary hung in this PR's own test
hle::d3d12x::vram::tests::mappings_whose_signal_failed_get_a_later_mark_before_use, from about 2 min in, and three othervramtests (reservable_agrees_with_the_driver,superseded_texture_waits_for_every_title_queue,tracked_srv_global_cleanup_hooks_are_gated_and_exact, which pass on main) never finished either, most likely stuck behind it on the shared test lock. After 17 minutes I stopped the process; it couldn't exit, which is what a GPU queue stuck on a fence nothing signals looks like. No counts.review: read the whole diff earlier on this head (my review comment has the details); the code findings there stand and none was blocking. What blocks is the test above. With
FAIL_SIGNALSthe native Signal is skipped, so a queue made to wait for that value waits for good unless the test opens it; on this machine (Windows, NVIDIA) nothing did. #3553's later commit addedopen_at_the_latest, a 10 s watchdog that opens such a test fence ("a test that holds a shared device's mapping queue can fail but never hang the test process"), to its copy of these tests; this head doesn't have it. With it, a test that goes wrong fails instead of taking the suite and the GPU process down.performance: not measured (the run stopped at the hung test).
verdict: not yet:
mappings_whose_signal_failed_get_a_later_mark_before_usehangs the lib test binary on Windows / NVIDIA, leaving a process that can't exit; bring #3553'sopen_at_the_latestwatchdog (andVRAM_TEST_LOCKuse) into this PR's tests, then rerun the suite on Windowshardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-01T20:01:46Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 2665If
before_executefails insidesubmit_onhere, the Err branch (~2919) treats it as an ordinary upload failure and queues a 100 ms retry.refresh_partsstill returns Ready, so the title's ExecuteCommandLists go out against level tiles thatmap_levels_with_texels_injust mapped, with no Signal covering them and no queue Wait on them. That's the case the PR says should end the title withMappingUnmarked.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-01T20:01:46Z.
Review: COMMENTED
Review of
69700342: 2 finding(s). 1 are inline. These are on lines outside the diff:crates/xcl/src/hle/d3d12x/vram.rs:2866: This is older code, but the same class of bug the PR fixes on the Signal side:reserve_page_waitsetswaited[queue] = valuebeforenative_queue_wait, and that result is thrown away withlet _. If the Wait fails (e.g. E_OUTOFMEMORY), every laterbefore_executeon that queue seeswaited >= valueand skips the wait, so title work can run before mappings up to N are done.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T20:32:08Z.
Test report (not a merge-check:
PR descriptionred: its smoke block is for an older head)base:
6bfb5c5153head:
f5a574372amerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2906 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: follow-up on
f5a57437(rebased and amended from69700342, the head of my merge-check above). Only test-side changes: a newGatetest guard invram.rs(~5726-5794),reserved_resource_with_private_data_is_excluded_from_recyclenow takesVRAM_TEST_LOCK(~5577), and a#[cfg(test)]RECYCLE_DRAIN_TEST_LOCK(~900) is taken indrain_recycled(~915) and around the test's park /recycle_ready/ "no mark yet" step (~5925); the list_x.rs, real.rs, sparse.rs and title_textures.rs hunks and the runtime parts ofvram.rsare the same as in69700342. The hang blocker is fixed: all three gates areGatelocals, so unwinding drops them before_vram_guardis released;Dropsignals the gate wheneveropen()hasn't finished,open()takescancelonly after its Signal succeeded, a failed queue Wait inGate::newpanics with the gate already built, and a panic insidewithreleasesPAGESbefore the gates drop. Each watchdog holds only its own gate's fence and leaves when the sender drops, so it can't open the next test's gate; another test's work waiting behind a gate is limited by the 10 s watchdog, and the test then fails instead of hanging (the run below confirms it: the suite finished, and both of the PR's tests passed).RECYCLE_DRAIN_TEST_LOCKcan't deadlock:drain_recycledtakes it beforePAGES, the test takes it beforePARKING/PAGES, its two callers inlate_release.rs(~306, ~363) hold no lock, and nothing reversesVRAM_TEST_LOCK-> drain lock. Earlier points: (1) still onlyFAIL_SIGNALSfailures are tested; (2) still open:sparse::before_executehas no path returningMappingUnmarked, so the arm atlist_x.rs~3622 can't run; (3) resolved, #3553 is now on top off5a57437. New, none blocking: (4)vram.rs~5933: the test now callsmark_pending_recycles()itself while holding the lock, so the nextdrain_recycled()finds the recycle already marked and the retry insidedrain_recycled(~918) is no longer tested; dropping the lock after the "no mark yet" assert and leaving the retry todrain_recycledwould test it. (5) ~5687: the private-data test'sSetEventOnCompletion(mark, NULL)blocks for good ifitem.markisUNMARKED(u64::MAX, introduced here), which only happens after a real Signal failure. (6) ~5967: a panic in the gated test leaves itsPagesinPAGES(only the last line removes it), so later tests can fail one after another, though they no longer hang. (7) The commit message has a doubled blank line before the new paragraph. Fine: the gate'sARMED/OPENED/RESCUEDstate machine and its ordering, the gate fence created on the original (unhooked)CreateFenceslot, andgit diff --checkis clean.performance: 60 s smoke of a retail title, main
6bfb5c51vs this merge (01196f9a): 1646 -> 1672 frames shown (101 %; last presents per 2 s: 60 60 61), peak commit 18685 -> 18636 MB, 0 device removals, 0 crashes.assessment: merges, builds and passes the whole suite on current main, and the test that hung on
69700342now finishes and passes (mappings_whose_signal_failed_get_a_later_mark_before_use ... ok), so the blocker from my merge-check is gone; the smoke run is clean. What remains for a merge-check is the description's smoke block on this head (f5a57437); the new points (4)-(7) are not blockinghardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T22:28:22Z.
merge-check
base:
f07e426dadhead:
94b0d76108merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2906 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: follow-up on
94b0d761(+84/-35 sincef5a57437, the head of my test report above). The commit closes two gapsf5a57437left. A failed consumer Wait was still ignored (already so on main:let _ = native_queue_wait), andreserve_page_waitrecorded the queue as having waited before the Wait was queued, so after a failed Wait every later submit skipped it and could read tiles that weren't mapped; nowvram::before_execute(vram.rs~2866) queues the Wait under the consumer queue'squeue_submitlease, recordswaitedonly after it succeeds, and returns false when it fails. Andsubmit_on'sbefore_executefailure, only a warning with a retry before, now becomesUploadError::MappingUnmarked(title_textures.rs~2677 / ~2932), passed up throughupload_allandrefresh_partssoprepare_title_submissionstops the title; underXCL_TEXTURE_LEVEL_PAGES=1there's one morebefore_executeafter lazy levels are mapped (~2943). On the hang class: the only Wait value is stillpages.mark()onpages.fence, whichf5a57437limits to values whose Signal was queued, so nothing waits for a value nobody signals. Lock order: per-queueserial-> lease(Q) was already there throughnative_queue_wait, and the new step only adds lease(Q) ->PAGES;PAGESis held across a queue call only insignal_nowon the mapping queue, never abefore_executequeue, so no deadlock with the tile-mapping queue was found. Default-path cost: two extraPAGESlock acquisitions on submits that need a mapping Wait, no new CPU or GPU wait. Findings: (a) thetitle_texturespropagation has no test: the changed vram test (~5881,FAIL_MAPPING_WAIT) fails without the vram half, but nothing drivessubmit_on->upload_all->refresh_partstoMappingUnmarked, or the lazy-level recheck. (b) The test's "the next submission retries the Wait" step can't happen at run time, since a false frombefore_executestops the title; it only checks thewaitedcache, so it shouldn't be presented as a retry. (c) On the own-upload-queue branch (title compute / copy queue, ~2900), a failed Signal or Wait puts the textures onRETRYand then stops the title anyway, so thatRETRYpush is dead there. (d) Thealready_waitedrecheck inside the lease (~2870) and its comment about a racing submit describe a race that can't happen, sincebefore_executeholds the queue'sseriallock throughout (harmless). (e) Scope: the Wait half fixes a bug main already had, not a failed Signal; it's small and the same class, so acceptable as its own commit, but the subject doesn't say a failed Wait now stops the title. Earlier points: (1) now one injected Wait failure is tested too, still no real driver failure; (2) unchanged, the arm atlist_x.rs~3622 is still dead; (4)-(6) unchanged. Fine: no new wait on a value nothing signals, no lock-order cycle, the description covers the change, and its smoke block names this head.performance: 60 s smoke of a retail title, main
f07e426dvs this merge (4a4d8f5f): 1672 -> 1653 frames shown (98 %; last presents per 2 s: 60 60 61), peak commit 17352 -> 18273 MB, 0 device removals, 0 crashes. The suite counts are from the first run of this merge (same head and base), whose smoke run hit a smoke-script startup error unrelated to the PR (the same build ran the title normally by hand); the smoke above is from the second run, whose lib test binary was lost to this machine's known intermittentuma_drivercoherent-window abort.verdict: safe to merge: the hang is gone (both of the PR's tests pass, the suite finishes), the new commit adds no wait on a value nothing signals and no lock-order cycle, and the smoke run is clean; the open points (tests for the
title_texturespropagation, the deadRETRYpush andlist_x.rsarm, wording) don't blockhardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T08:46:51Z.
merge-check
base:
1c8b551475head:
94b0d76108merge: clean trial merge into
1c8b551475e1e7bfe48f94448492a4c3544a2e0f(trial-merge commite06129ff9149e71b6591e9b5c770906adfc9a358;git diff --checkclean).build:
cargo build --workspace-> ok;cargo build --release -p xcl-> ok.tests:
cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture(43 targets) -> 2911 passed, 0 failed, 51 ignored (+2 new tests vsmain1c8b5514; all 43 targets green includinggpu_two_pass_cache_e2e). All new and updatedhle::d3d12x::vram::testspassed with 0 skips on RTX 4060:a_failed_signal_leaves_the_value_a_signal_reached,mappings_whose_signal_failed_get_a_later_mark_before_use,title_queue_mapping_wait_reservation_is_monotonic_and_per_queue, andreserved_resource_with_private_data_is_excluded_from_recycle. 28SKIPPEDlines — all hardware/environment-expected on RTX 4060 (22no wave64, 2no d3d12SDKLayers.dll, 1no D3D12 debug layer, 2no heap windows, 1cannot disable the driver cache (Windows Developer Mode required)).review: read the full merged diff (5 files:
crates/xcl/src/hle/d3d12x/list_x.rs,real.rs,sparse.rs,title_textures.rs,vram.rs, +440/-42). Scope is clean and well-synchronized:Pages::signal_nowonly advancesself.valueand clearsself.unmarkedwhennative_queue_signalsucceeds,Pages::markretries signaling if any mapping remained unmarked, andbefore_executeserializes the consumer queue'snative_queue_waitand monotonicpages.waitedupdate insidequeue_submit::with(queue_key, ...)(re-checkingalready_waitedunderPAGESlock so a failed Wait is never cached and racing submits cannot regresswaited).PreparationOutcome::MappingUnmarkedpropagates cleanly throughtitle_textures.rs(refresh_parts,upload_allincluding post-lazy-level preparation,submit_on,probe_gpu_content) to stop unsafe title submissions (list_x.rs,real.rs), andPendingRecycleusesUNMARKEDwith retry indrain_recycledso un-signaled retired textures never re-enterreserved_pool. The new GPU tests properly serialize underVRAM_TEST_LOCK/RECYCLE_DRAIN_TEST_LOCKand guard the mapping queue gate with an unwind/watchdogDrop. No UB, lock-ordering, or correctness issues found.performance: Tier 2 60 s retail smoke (
title: 29640639) shows no regression vsmain1c8b5514baseline (1462frames,presents per 2 s (last 3): 48 53 59,peak commit: 16043 MB):1626frames (+11.2%),presents per 2 s (last 3): 60 60 60,peak commit: 14830 MB(-7.6%), 0 device removals, 0 crashes.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
Imported from ivall/xcl. Originally posted by lucsoft on 2026-12-02T10:32:15Z.
@throny looks like the tag "needs-pr-check" is stale. ci is passing. i have two tests. i think this is mergable 🚀 same with 3553
Imported from ivall/xcl. Originally posted by throny on 2026-12-02T10:38:29Z.
@lucsoft you're right: the latest
PR descriptionrun is green, theneeds-pr-checklabel was left from the earlier red one; removed. Two safe merge checks on this head (Foniass, Decodere). Running the trial suite on currentmainnow; if it's clean I'll merge, and #3553 (stacked on it) can then get its second check.AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by throny on 2026-12-02T10:44:54Z.
@lucsoft the trial on current
main1c8b5514is clean (2911 passed, 0 failed, 51 ignored, RTX 4080), but GitHub blocks the merge for one reason only: the branch rule needs every review conversation resolved, and @bmjask's thread ontitle_textures.rs:2677(a failedbefore_executeinsidesubmit_onbeing treated as an ordinary upload failure whilerefresh_partsstill returns Ready) has no answer yet. Once that is answered or fixed and resolved, I'll merge at the checked head.AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by lucsoft on 2026-12-02T10:47:53Z.
Code review location:
crates/xcl/src/hle/d3d12x/title_textures.rs; line 2665@throny This is fixed in the tested head
94b0d761. Whenbefore_executefails insidesubmit_on, it returnsUploadError::MappingUnmarked. That propagates throughrefresh_partsasPreparationOutcome::MappingUnmarkedand stops the title submission beforeExecuteCommandLists.