D3D12.X: forget command list before its final release #2852
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2852"
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 guinpereira on 2026-11-26T18:50:00Z.
Fixes #2690.
Forgets list/bind/dred state before the runtime frees the list, closing the address-reuse window.
What is in it
crates/xcl/src/hle/d3d12x/real.rs: forget command list state before final release.Tested
cargo test -p xcl --lib -- --test-threads=4: 1315 passed, 4 failed (GPU OOM in dxil fuzz tests, environment), 27 ignored.cargo build -p xcl: clean.Regression run
Reference run on the author's local main (05adb5a). A run on ivall/xcl main and on this PR's head commit is still pending (cold shader cache crashes the title's startup precompile on this machine).
Not tested
AI use
OpenCode, Beam Free - drafted the change; smoke run and review by the author.
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-26T19:09:43Z.
69ebece8a98ae956556eb02d3721db712501e9b2introduces an unmatchedAddRefon every nonfinalcl_releasecall.In
crates/xcl/src/hle/d3d12x/real.rs, the new code executesadd(this)unconditionally, but only executes the compensatingf(this)insideif last. Starting with two references: AddRef returns 3,lastis false, the sole Release returns 2. The caller's reference was never consumed. Repeated calls remain at two rather than reaching destruction. This needs correction before considering the change a memory-lifetime fix.Minimal local test, inserted in the existing
readback_routing_testsmodule on both PR and parent production code:The mock uses
orig_fn's actual original-vtable prefix layout and calls productioncl_release; it does not substitute release-wrapper logic or require a D3D12 device. It does not physically free its own backing allocation.At minimum, balance the temporary AddRef on every branch, and retain the nonfinal-reference regression. That alone is not proof of a complete #2690 fix: reference-count sampling is not exclusive finalization. The comment says concurrent last-but-one releases fall back to cleanup afterward, but the new code contains no such post-release cleanup. Please also cover concurrent final releases/address reuse with an ownership protocol; do not treat an AddRef return value as synchronization. The existing single-reference DMA-release fixture cannot exercise this ordinary two-reference leak.
No title launch, GPU destruction, driver validation, or measured host-RAM delta. AI-assisted verification/source review (OpenAI GPT-6 Astra).
Matched execution result (Wine 11.0 / Rust 1.98.1, Windows MSVC target):
69ebece8a98ae956556eb02d3721db712501e9b2: 0 passed, 1 failed, observed(return, actual_refs) = (2, 2)instead of(1, 1); cargo exit101.8b957bec6f82495aec940944c6bf47faa02db590: 1 passed, 0 failed, same fixture; cargo exit0.Compiling xclfrom the intended worktree on each leg:25.71s and25.30s. Both tests finished in0.00s. Only the identical local test was added; production unchanged. One test thread,9GiB memory/512MiB swap scope,180s timeout per leg.Command on each checkout:
Local logs:
.compat-xcl/logs/verify-xcl-pr2852-wine-nonfinal-release.logandverify-xcl-pr2843-parent-wine-nonfinal-release.log(the latter checkout is the exact common parent, reused from an earlier verification). This is a demonstrated regression in the wrapper's COM accounting, not just an inferred memory-retention risk.Imported from ivall/xcl. Originally posted by throny on 2026-11-27T02:49:29Z.
Two contributors checked independently and found that this PR makes the same change as #2691 (for #2690): #1607, group D140. They suggest keeping #2691. If you agree, closing this PR or joining the other one would save the maintainers a review. If the two differ in a way the checks missed, a note in #1607 helps.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:03:47Z.
Triage (#1607) – head
69ebeceMain already has this fix:
cl_releaseinreal.rs(commit309e3557, the change from #2691) callsAddRefand checks for== 2, then forgets the list (forget_command_list) before the finalRelease, with the late path kept for racing releases. It also has thelist_release_teststest. This PR makes the same change without the test, and #2690 is closed.Recommendation: close (superseded by main commit
309e3557/ #2691).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 throny on 2026-12-01T13:00:29Z.
Closing as superseded: this change is already on
main(309e3557). main cl_release (real.rs 11500) does the AddRef==2 probe and forget_command_list before the final Release, same as the PR;309e3557is on mainTwo independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed