Repository navigation
Conversation
late_release holds the last reference to every resource (and the pipelines and heaps it owns) the title frees, releasing it once each queue's fence passes the batch. On a wedged or removed GPU the fences stop advancing, so nothing is freed and the held set grows without bound until the WDDM kernel pool is exhausted and the device resets (DXGI_ERROR_DEVICE_RESET) - masking the real cause. A sealed batch held past STALL_FORCE (5 s) with no fence progress is now let go without waiting. Safe: a GPU that is not progressing will not touch the memory, and a lost device makes the references moot. Only on a true stall, never on a high count alone - under a lag (fences advancing, just behind) the resources are still in flight and freeing them would be a use-after-free. This turns the kernel-OOM reset into a graceful slowdown and keeps the real fault observable. Found running a 16 GB-console title on an 8 GB GPU: memory exhaustion wedges the GPU, fences stall, and the late_release backlog then OOMs into a reset instead of a clean out-of-memory failure. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Review (head 715f5ac, diff read, not a merge-check; draft, conflicts with main,
Fine: the test fails without the change and skips without a GPU. #3125 is related and goes the other way (keeping resources when retirement fences fail). AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
Thanks ,will check it out
…________________________________
From: Fonias ***@***.***>
Sent: Tuesday, 01 December 2026 10:02:21
To: xcl-dev/xcl ***@***.***>
Cc: Dremaus ***@***.***>; Author ***@***.***>
Subject: Re: [xcl-dev/xcl] D3D12.X: free late_release's held set when GPU fences stall (PR #3365)
[https://avatars.githubusercontent.com/u/107039406?s=20&v=4]Foniass left a comment (xcl-dev/xcl#3365)<#3365 (comment)>
Review (head 715f5ac<715f5ac>, diff read, not a merge-check; draft, conflicts with main, PR description red):
* This can free resources the GPU is still using. The new loop (late_release.rs ~110) lets a sealed batch go once 5 s have passed since it was sealed. It never looks at whether its fences moved. The comment at ~24-29 rules out exactly this: "never on a high count alone: under a lag ... freeing them would be a use-after-free". Two cases reach it:
* a queue that is progressing but more than 5 s behind, plausible on the 8 GB card in the description while it pages VRAM;
* a queue waiting on a fence the title signals later from the CPU.
Then resources are released or recycled (recycle_ready), shared-heap views are nulled and Dead::Unmap tiles leave the shared pages while the queue will still write to them. Recording each batch's completed fence values and treating it as stalled only when none of them changed for 5 s would match the comment.
* The removal case is already covered. On a removed device GetCompletedValue returns UINT64_MAX, so the existing loop frees everything. A real hang ends in a TDR, which is a removal. So the new path only fires while the device is alive, which is when freeing is unsafe.
* The conflict isn't just textual. d783592<d783592> split drain into begin_seal / end_seal / take_gone, and drain is now test-only. A naive rebase leaves the new loop in test code only. It has to go into take_gone, with sealed_at set in end_seal.
* The test only ages the batch artificially. Nothing checks that a lagging but moving queue keeps its batch, which is the case that matters.
Fine: the test fails without the change and skips without a GPU. #3125<#3125> is related and goes the other way (keeping resources when retirement fences fail).
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
—
Reply to this email directly, view it on GitHub<#3365?email_source=notifications&email_token=CR6OPRUZZ5LX5RLYNOYRIG3532CJ3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMZQGYYTCNRVGYZKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-7306116562>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/CR6OPRUZGYZREQDTODLJ6A3532CJ3AVCNFSNUABGKJSXA33TNF2G64TZHMYTINRVHA2TEMBZHE5US43TOVSTWNRWG43TMNBVGE2DLILWAI>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/CR6OPRSEKCMRHFUILNDHDOL532CJ3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMZQGYYTCNRVGYZKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG> and Android<https://github.com/notifications/mobile/android/CR6OPRQ2UOZDPEUBZRZDCTT532CJ3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMZQGYYTCNRVGYZKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
|
No other open PR makes this change. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
When the GPU stalls (a hang or an impending removal), XCL's
late_releasecannot retire the title'sfreed resources — it holds the last reference to each (and to held pipelines/heaps) until the owning
queue's fence passes the batch, and a stalled queue never advances its fence. The held set then grows
without bound until the WDDM kernel pool is exhausted and the device resets
(
DXGI_ERROR_DEVICE_RESET), masking whatever actually wedged the GPU.This frees a sealed batch held past
STALL_FORCE(5 s) with no fence progress, instead of holding itforever. It is gated on a true stall (time since the batch was sealed), never on a high count —
under a mere lag the resources are still in flight, so freeing them would be a use-after-free. The
result: a wedged / memory-undersized host fails gracefully (clean OOM or slowdown) and the real cause
stays observable, instead of a kernel-memory
DEVICE_RESET.Context: diagnosed running a 16 GB-console title on an 8 GB laptop GPU — the title exhausts VRAM +
system RAM and wedges; before this, the
late_releasebacklog turned that shortfall into an0x887A0007reset at ~200 s instead of a clean failure.What is in it
crates/xcl/src/hle/d3d12x/late_release.rs:Batch.sealed_at; inHeld::drain, after thefence-completion pop, a stall-only force-free of the oldest batches past
STALL_FORCE, with aone-time warning. New unit test
a_stalled_batch_is_freed_after_the_timeout(ages a sealed batchpast the timeout without a real 5 s wait).
Tested
cargo test -p xcl --lib late_release:5 passed, 0 failed, 0 ignored, incl. the new
a_stalled_batch_is_freed_after_the_timeout.Hardware: NVIDIA RTX 4060 Laptop GPU, driver 617.14; Windows 11 26200; rustc 1.100.0; debug.
cargo test --workspace --no-fail-fast -- --test-threads=4: the integration and test-titlebinaries pass (139 passed, 0 failed, 20 ignored, 25
SKIPPED— no wave64 / noXCL_SAMPLE_*/no heap windows). The main
xcl --libbinary aborted under full parallel GPU+DXC load with anunrelated
Invalid bitcode signature/ abnormal exit (0x80004005) — a GPU/DXC test, not thisCPU-only
late_releasechange (it reproduces only in the heavy parallel run on a host that had beenVRAM/RAM-exhausted by the GTA6 sessions, never in isolation). A clean full-
--libcount on anunstressed host is still pending.
Regression run
scripts/smoke.ps1). The new code path only triggers on a genuine ≥ 5 s fencestall, so a short smoke run on a healthy title shows no behaviour change.
Not tested
xcl --libcount on an unstressed host; the retail smoke comparison; AMD.AI use
🤖 Generated with Claude Code