D3D12.X: keep allocator recordings held on device removal #2831

Open
rafelis1997 wants to merge 1 commit from upstream-pr/2831 into main
rafelis1997 commented 2026-11-26 16:24:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by rafelis1997 on 2026-11-26T16:24:19Z.


Part of #2688 (WS2). Reproduction and discussion.

ID3D12Fence::GetCompletedValue() returns UINT64_MAX on device removal. The allocator used a numeric comparison to retire a backing and the inverse comparison to decide whether a list was still in flight. The removal sentinel satisfied both tests for successful completion. This changes reuse eligibility after removal. The original cause of device removal remains under investigation. D3D12 fence contract

What is in it

  • Add one completion predicate in alloc_pool.rs. Use it for both backing retirement and the list's in-flight check. Keep the bounded queue-wait path's immediate exit on a removed device.
  • Extend the existing fake COM fence regression to cover valid completion, removal, releasing the last list, and immediate return from the wait.
  • Base nvidia-dev at af2cecc40886a8682ecf3267f5328c6dc4b66ad7; head 965806a09804384324dc6cec463afa51c00b0822. The related mesh reclaim path is still in #2815. Its author can use the same predicate there.

Tested

  • Windows 11 Pro build 26200, Ryzen 7 5700X3D, RTX 5070 Ti 16 GB, NVIDIA driver 616.92. The regression is CPU-only. Used rustc 1.100.0 --test --edition 2021 in debug mode, compiling the real allocator module with a synthetic COM fence and shims for surrounding runtime dependencies.
  • Ran released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing with the head's assertions against both implementations. Base: 0 passed, 1 failed at device removal must not make the list reusable. Head: 1 passed, 0 failed, 0 ignored, 7 filtered out.
  • git show --check HEAD passed.

Regression run

Paired clean-tree game smoke runs are pending. The reported retail trace in the linked issue comment came from a separate experimental tree.

Not tested

The full Windows workspace suite and the two clean-tree GPU smokes are pending for this commit. This draft makes no FPS, VRAM savings, or device-loss prevention claim. The integrated synthetic test can be run with cargo test -p xcl --lib released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing.

AI use

OpenAI Codex (GPT-6) investigated the issue, wrote the patch and regression, ran the isolated test, and prepared the PR description.

<!-- greyfinch-sync:ivall/xcl:issue:5513619519 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2831). Originally posted by [rafelis1997](https://github.com/rafelis1997) on 2026-11-26T16:24:19Z. --- Part of #2688 (WS2). [Reproduction and discussion](https://github.com/xcl-dev/xcl/issues/2688#issuecomment-7197455387). `ID3D12Fence::GetCompletedValue()` returns `UINT64_MAX` on device removal. The allocator used a numeric comparison to retire a backing and the inverse comparison to decide whether a list was still in flight. The removal sentinel satisfied both tests for successful completion. This changes reuse eligibility after removal. The original cause of device removal remains under investigation. [D3D12 fence contract](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12fence-getcompletedvalue) **What is in it** - Add one completion predicate in `alloc_pool.rs`. Use it for both backing retirement and the list's in-flight check. Keep the bounded queue-wait path's immediate exit on a removed device. - Extend the existing fake COM fence regression to cover valid completion, removal, releasing the last list, and immediate return from the wait. - Base `nvidia-dev` at `af2cecc40886a8682ecf3267f5328c6dc4b66ad7`; head `965806a09804384324dc6cec463afa51c00b0822`. The related mesh reclaim path is still in [#2815](https://github.com/xcl-dev/xcl/pull/2815). Its author can use the same predicate there. **Tested** - Windows 11 Pro build 26200, Ryzen 7 5700X3D, RTX 5070 Ti 16 GB, NVIDIA driver 616.92. The regression is CPU-only. Used `rustc 1.100.0 --test --edition 2021` in debug mode, compiling the real allocator module with a synthetic COM fence and shims for surrounding runtime dependencies. - Ran `released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing` with the head's assertions against both implementations. Base: 0 passed, 1 failed at `device removal must not make the list reusable`. Head: 1 passed, 0 failed, 0 ignored, 7 filtered out. - `git show --check HEAD` passed. **Regression run** Paired clean-tree game smoke runs are pending. The reported retail trace in the linked issue comment came from a separate experimental tree. **Not tested** The full Windows workspace suite and the two clean-tree GPU smokes are pending for this commit. This draft makes no FPS, VRAM savings, or device-loss prevention claim. The integrated synthetic test can be run with `cargo test -p xcl --lib released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing`. **AI use** OpenAI Codex (GPT-6) investigated the issue, wrote the patch and regression, ran the isolated test, and prepared the PR description.
andrewDoing commented 2026-11-28 01:50:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T01:50:32Z.


I ran the requested Windows workspace validation on RTX 5070 / NVIDIA 616.92, comparing exact parent af2cecc40886a8682ecf3267f5328c6dc4b66ad7 and head 965806a09804384324dc6cec463afa51c00b0822 in separate builds and sequential suite runs.

Revision Passed Failed Ignored Printed GPU skip notices
Parent 1,741 9 48 27
PR head 1,741 9 48 27

Both workspace builds succeeded. The same nine test instances failed on both revisions; four shader-fuzz failures used the same seeds and returned E_OUTOFMEMORY on both, consistent with #1905. The focused integrated allocator-retirement regression passed, and all eight allocator-pool tests passed on the PR head. Both full suites exited 101, so this is not a clean workspace pass.

The removal regression uses a synthetic fence. I did not induce actual device loss or run a retail title.

AI use: OpenAI Codex with GPT-6.2 Astra ran and compared the checks; Codex reviewed and prepared this report.

<!-- greyfinch-sync:ivall/xcl:comment:7231953488 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2831#issuecomment-7231953488). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-28T01:50:32Z. --- I ran the requested Windows workspace validation on RTX 5070 / NVIDIA 616.92, comparing exact parent `af2cecc40886a8682ecf3267f5328c6dc4b66ad7` and head `965806a09804384324dc6cec463afa51c00b0822` in separate builds and sequential suite runs. | Revision | Passed | Failed | Ignored | Printed GPU skip notices | | --- | ---: | ---: | ---: | ---: | | Parent | 1,741 | 9 | 48 | 27 | | PR head | 1,741 | 9 | 48 | 27 | Both workspace builds succeeded. The same nine test instances failed on both revisions; four shader-fuzz failures used the same seeds and returned `E_OUTOFMEMORY` on both, consistent with #1905. The focused integrated allocator-retirement regression passed, and all eight allocator-pool tests passed on the PR head. Both full suites exited 101, so this is not a clean workspace pass. The removal regression uses a synthetic fence. I did not induce actual device loss or run a retail title. AI use: OpenAI Codex with GPT-6.2 Astra ran and compared the checks; Codex reviewed and prepared this report.
Foniass commented 2026-12-01 09:01:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:01:39Z.


Triage (#1607) – head 965806a

No open or merged PR makes the same change. #3125 applies the same rule (a UINT64_MAX fence does not retire anything) to late_release and the sparse paths, in other files.
Main has since rewritten alloc_pool.rs (Backing::free / in_flight with submit_pins, SubmissionReceipt). SubmissionReceipt::is_complete there says explicitly that device loss may retire resources, which is the opposite of this PR. A rebase needs to settle which rule applies and cover Backing::free, Backing::in_flight and the list-level in_flight on the new code. Conflicts with main.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7306109202 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2831#issuecomment-7306109202). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:01:39Z. --- **Triage (#1607)** – head 965806a No open or merged PR makes the same change. #3125 applies the same rule (a `UINT64_MAX` fence does not retire anything) to `late_release` and the sparse paths, in other files. Main has since rewritten `alloc_pool.rs` (`Backing::free` / `in_flight` with `submit_pins`, `SubmissionReceipt`). `SubmissionReceipt::is_complete` there says explicitly that device loss may retire resources, which is the opposite of this PR. A rebase needs to settle which rule applies and cover `Backing::free`, `Backing::in_flight` and the list-level `in_flight` on the new code. Conflicts with main. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2831:upstream-pr/2831'
git switch 'upstream-pr/2831'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2831'
git switch 'upstream-pr/2831'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2831'
git switch 'upstream-pr/2831'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2831'
git switch 'main'
git merge --squash 'upstream-pr/2831'
git switch 'main'
git merge --ff-only 'upstream-pr/2831'
git switch 'main'
git merge 'upstream-pr/2831'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2831
No description provided.