D3D12.X: retain resources when retirement fences fail #3125
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3125"
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 Prime1997 on 2026-11-28T11:51:50Z.
Keep deferred resources and sparse tiles held when queue completion cannot be established. D3D12 reports device removal as
UINT64_MAX; treating that as a normal completed fence can release or reuse GPU resources without proving completion.Related to Decodere’s #2538, reviewed at
2fc8268271f4d025d408527a9b9cfd62730fab1c, which covers target-page retirement. This focused NVIDIA follow-up covers the separatelate_releaseand sparse-buffer paths, directly on NVIDIA54225f5884a94cd23b7aab3f703a7c975070aa77. It does not import the prior integration branch or claim to establish the cause of any device removal.Rebased onto main (2026-11-28).
nvidia-devwas merged intomainby #3203, so this PR now targetsmainand its branch was rebased ontomain765b2c5bfff6754e8c9886a73e188a86aca3c64c: headedfddd5a92d79f7dbf19faa35b74cc778648bdc7(was8a1f1c8a5961573d0e8315feaeed8fa371f9351b).mainhad rewrittenquarantine_tiles_forandretire_free_pools_withinsparse.rs, so the second commit's checks were ported onto that code by hand: the checked mark on the sparse queue goes throughnative_queue_signal, andsync_known_queuesno longer exists. That port needs a review. Inlate_release.rsthe checked mark keepsmain'snative_queue_signal. On the rebased head, on the same RTX 3060 Ti PC, debug profile:cargo check -p xcl --all-targetsexited 0, andcargo test -p xcl --lib -- --test-threads=4 late_release_marks_never_signal_the_removal_sentinel_or_wrap removal_does_not_complete_a_held_batch sparse_retirement_requires_real_completion_on_every_queue quarantine late_release retiregave 52 passed, 0 failed, 0 ignored, no SKIPPED. The whole suite and the paired title runs have not been rerun on this head; every other result below is from the earlier head. The rebase and its conflict resolution were done with Claude Code.What is in it
Tested
8a1f1c8a5961573d0e8315feaeed8fa371f9351b.d54d80e1bc9d070cbec4a619abb5f4b89880b2f5compiled withcargo build --locked --release -p xcl --target-dir <isolated-target>: exit 0, 229.200 seconds. This is compilation of the combined candidate, not a build or runtime validation of this standalone PR. Zero tests executed; no GPU checks or smoke run.git diff --checkonly, at8a1f1c8a5.Regression run
Not run. No smoke blocks or runtime test results are claimed.
Not tested
Build, fixtures, full suite, real-title behavior and device-removal recovery have not been validated at this standalone head. Keep as draft pending validation. Fail-closed retention can keep memory held until teardown after a failed signal; it is not a memory-budget cap.
AI use
Codex (GPT-6) implemented the narrow lifetime checks, inspected local SDK contracts, wrote fixtures and performed independent source review. Original target-page retirement credit belongs to Decodere’s #2538; that separately owned implementation remains unchanged.
Optional contributor/test coordination: https://discord.gg/6B4TykyC4W
Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-28T12:06:48Z.
Failed interactive integration result for
d54d80e1bc9d070cbec4a619abb5f4b89880b2f5, containing this PR's change together with the other memory/removal repairs. This was not a standalone test of8a1f1c8a5961573d0e8315feaeed8fa371f9351band does not establish which change caused or prevented a symptom.0x887a0005(DEVICE_REMOVED); no external stop or automated inputs.0x887a0004(unsupported), so there is no reliable GPU fault location. System commit still had 34,764 MiB headroom at removal; no out-of-memory result was established.The existing CPU-write guard held its write when the producer became Removed and the fence returned UINT64_MAX. The new retirement guards were not independently fault-injected. Fail-closed resource retention is not a device-removal cure or global budget cap.
This run does not justify merge approval or a claim that RAM growth/device removal is fixed. Full standalone validation and matching main/head smoke reports remain outstanding. No builds or synthetic GPU tests ran during gameplay. Logs, hashes, counter samples and source/installed-data preservation checks are retained locally.
AI use: OpenAI Codex (GPT-6) launched the prepared candidate at the user's request, monitored existing logs and read-only counters, and prepared this report; a separate Codex agent reviewed the log evidence.
Optional contributor/test coordination: https://discord.gg/gK3y7WRRY
Imported from ivall/xcl. Originally posted by kole07139 on 2026-11-28T13:12:05Z.
Test report for head
8a1f1c8a. No new failure.removal_does_not_complete_a_held_batch,late_release_marks_never_signal_the_removal_sentinel_or_wrap,sparse_retirement_requires_real_completion_on_every_queue.sparse.rs(both PRs add a test at the same place inmod tests; keeping both builds), and with #3124 in README.md.Tested: NVIDIA GeForce RTX 3070 8 GB (driver 617.42, wave32), Intel i9-9900K, 32 GB RAM, Windows 11 Pro N 26200, rustc 1.99.0, DXC 1.8.2502.11, debug. Each head was tested alone, with its own target directory, on its base
nvidia-dev54225f58. The library tests were run ascargo test -p xcl --lib --no-fail-fast -- --test-threads=4 --skip a_refused_gpu_upload_segment_becomes_custom. That one test is left out because the library test binary stops at its fail-stop (0x7C10003), as throny reported on #3041, with or without this PR; alone it passes. On the base the same command gives 1771 passed, 6 failed, 28 ignored. The 6 failures (placed_title_textures_share_vram_and_preserve_pixels, threestream_recheck_*,d32s8_targets_take_their_own_size_of_video_memory,gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark) are the base's own and are not repeated below.I also merged the four heads #3122–#3125 together on
54225f58(only README.md conflicts, plus the two new tests of #3123 and #3125 at the same place insparse.rs; both kept). On that treecargo test --workspace --no-fail-fast -- --test-threads=4gives: library binary stopped at the same fail-stop; the other test binaries 132 passed, 0 failed, 20 ignored. The library command above: 1779 passed, 9 failed, 28 ignored, that is the base's 6 plus the 3 named below.Not tested: a title run or smoke run of this head, a release build, AMD and Intel GPUs.
AI use: Claude Code (Claude Opus 5.5) ran the merges, builds and tests, and wrote this report.
Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-28T15:05:49Z.
@Prime1997 the whole suite of your head on an RTX 3090 against its base on the same machine: no failure the base doesn't have; its new tests pass:
late_release::tests::late_release_marks_never_signal_the_removal_sentinel_or_wrap,late_release::tests::removal_does_not_complete_a_held_batch,sparse::tests::sparse_retirement_requires_real_completion_on_every_queue.Tested:
8a1f1c8aand its basenvidia-dev54225f58.XCL_*set.cargo test --workspace --no-fail-fast -- --test-threads=4 --skip uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom --skip uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment --skip uma_driver::tests::failed_restore_stops_before_importing_an_unbacked_window(those three end the lib test binary on 621.24, at the base too)title_textures: one0x8007000Ein the full run, passes alone, and threePoisonErrorfrom it; 2vram0x8007000E;e2etest_title_runs_and_game_folder_is_untouched).Not tested: a title run; a release build; AMD / Intel.
AI use: an agent swarm: Claude Fable 5.2, Claude Opus 5.5, GPT-6.2-Sol and Gemini 4 Neon.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-29T03:13:58Z.
Independent Windows check of head
edfddd5a92d79f7dbf19faa35b74cc778648bdc7merged cleanly onto mainfa204595a488c60c6c5f905244f0172072c9c2a9;git diff --checkpassed. RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, debug profile.cargo build --workspace: passed.cargo test --workspace --no-fail-fast -- --test-threads=4: library 2,471 passed, 1 failed, 29 ignored; 26 printedSKIPPEDGPU notices.gpu_two_pass_cache_e2e: 0 passed, 1 failed. The remaining test targets passed. The library failure wasconsole_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk(DXIL not compiled yet). The two-pass test expected its final state count to return to zero but observed one. Both failures reproduced in focused runs on untouched mainfa204595, so these runs do not identify a regression from this PR.One lifetime gap remains in the changed path. If a title queue submits work and its retirement mark fails,
presentretains the queue asRetiring::Failed, butactive_queues_heldexcludes it.late_release::drain_knownonly passes active title queues plus internal queues toHeld::drain. A resource held after that failed retirement can therefore be sealed and released when the internal queues finish, even though the failed title queue has no trustworthy completion mark. The existingfailed_retirement_is_permanently_pinnedtest proves the registry keeps that queue owner, but does not exercise deferred resource release.The bounded fix is to use
queue_completion_snapshot()when sealing: keep the open batch held ifblocked, include installed retirement marks alongside successful active-queue signals, and continue rejecting the removal sentinel when checking marks. A regression should cover a failed retirement followed by a held resource and successful completion of other queues; the resource must remain held. A marked-retirement case should release only after its mark completes.Merge status: not yet. The PR-description check also remains red because this head lacks the required clean-head paired smoke blocks. I did not run a title smoke or a device-removal injection, so neither behavior is claimed here.
AI use: Codex (GPT-6.2 Sol) reviewed the source and ran the local build and tests.
Imported from ivall/xcl. Originally posted by vasanex on 2026-11-29T04:23:27Z.
How this was run: the suite ran once on the 11 of your PRs that build on this base, merged together (#3047 #3048 #3049 #3091 #3092 #3103 #3104 #3105 #3107 #3123 #3125; a local tree, only #3125 needed a resolution in README and the
sparse.rstest module); the base alone gave 2608 passed, 0 failed, 49 ignored with the same 27SKIPPEDlines (21 no wave64, 3 refused per-lane f16/f32 forms, 2 heap windows opt-in, 1 driver cache needs Developer Mode). This PR alone was merged onto the base, built (cargo build --workspace, then release), its modules' lib tests run (debug), and smoke-run once for 60 s (scripts/smoke.ps1, retail title, front end,XCL_PREPARE=0). The smoke numbers are for my local merged tree, not a clean-head block for the description.AI use: Claude Code (Claude Opus 5.5 and Claude Fable 5.2) ran the builds, tests and title runs, reviewed the diff and wrote this; the code points cited were checked against the merged tree.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T22:38:34Z.
merge-check
base:
beeb81be4b(mergeable cleanly on current main)head:
edfddd5a92merge: clean
build: cargo check -p xcl --all-targets -> ok
tests: non-GPU lib tests of touched modules (late_release 5 passed, sparse 19 passed). Full workspace suite and GPU tests not run.
review: none blocking. Device-removal sentinel (u64::MAX) is no longer treated as completion, marks cannot wrap to the sentinel, and sparse retirement takes a checked native signal before initial_quarantine_marks.
performance: one extra queue signal per retirement batch; no overhead seen. Tested in a combined 600 s retail run on main
beeb81be+ 13 PRs (warm cache, defaults) vs baseline: presents/2 s 3.27 vs 3.29, peak commit 35,016 vs 35,767 MB, local video memory 14.19-14.76 vs 14.32-14.95 GB, 0 pipeline waits >= 1 s vs 5, 0 device removals, 0 crashes. Combined result across all 13 PRs, not isolated to this PR.verdict: not yet: full workspace suite not run on its own merge.
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti, driver 32.0.16.1074, AMD Ryzen 9 9950X, Windows 11 Pro 26200 / Claude Code (claude-opus-5-5)
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:44:15Z.
Review: COMMENTED
Critical review of current head
edfddd5a. The patch correctly excludesUINT64_MAXfrom completion and avoids signalling the removal sentinel in both deferred-release and sparse retirement paths. I found no new code blocker in those checks. The key regression to retain is a failed queue Signal followed by later valid work: resources must remain pinned until a fresh, proven mark, without reusing tiles from the failed batch. The new unit tests exercise the sentinel and mark arithmetic; please keep the device-removal/failure integration evidence linked before merge. No local Windows run.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:28:39Z.
Review (head
edfddd5a, diff read, not a merge-check; it conflicts with main andPR descriptionfails, so not built or run):late_release.rsconflicts with main'sd783592c, which split the seal intobegin_seal/end_sealwith the Signals outsideHELD;end_seal(ok=false)already puts a batch back after a failed Signal. Not superseded, butnext_mark/marks_completedneed rewriting there.sparse.rs~5955-5964). Main'sself.signal()ignores a failed Signal and a later successful one passes the value, so tiles are freed late but never early. The PR's extra Signal turns one failure intomarks: None; that batch stays at the front ofquarantinedand blocks every later batch, so freed tiles stop going back into use and video memory keeps growing. The extra Signal, and the comment justifying it ("an earlier unchecked signal cannot authorize reuse"), look unnecessary: an unsignalled value can't complete early.real.rs~12060,present.rs~139), so treatingUINT64_MAXas done only holds memory until the next submit.PR descriptionfails: no xcl-smoke blocks. AI use names Codex (GPT-6) but no model for the Claude Code rebase. The wrap checks innext_markcan't trigger at one fence step per 10 ms, and the README lines describe internals, not user-visible behaviour.Fine: the helper tests, the
blockedbehaviour is unchanged, andsparse.rsmerges cleanly.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
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.