D3D12.X: remove tracked textures before final COM release #1527
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1527
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1527"
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?
@OtavioTadeu on GitHub · 2026-11-24 17:17 UTC · original
OtavioTadeu:fix/d3d12x-tracked-release-1359→main· +244 −27 · 2 files · 1 commits · openSynchronizes
real::res_releasewithtitle_textures::TEXTURESso tracked resources are removed before their COM refcount can drop to 0 (underXCL_LATE_RELEASE=0or a concurrent refcount-2 race), preventingrefresh_onceandclone_resourcesfrom callingAddRefon freed memory. Fixes #1359.What is in it
crates/xcl/src/hle/d3d12x/title_textures.rs: addTRACKED_COUNT,ReleaseOutcome,release_tracked, and unit + concurrent refcount-2 race testscrates/xcl/src/hle/d3d12x/real.rs: routeres_releasethroughtitle_textures::release_trackedbefore final release and cleanupTested
stable-x86_64-pc-windows-msvc), debug buildcargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored (SKIPPED GPU tests:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask[no wave64],gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware[no wave64],heap_window_out_of_memory_falls_back_to_the_switch_form[no heap windows])cargo test -p xcl --lib title_textures: 14 passed, 0 failedcargo test -p xcl --lib d3d12x: 144 passed, 0 failed, 1 ignoredRegression run
scripts/smoke.ps1 -Game retail_title -Seconds 60(mainbaseline vs PR head on NVIDIA GeForce GTX 1660 SUPER):Not tested
AI use
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@upipibi on GitHub · 2026-11-24 17:47 UTC · original
Duplicate note: #1404 (opened earlier, not a draft, 3 comments) also fixes #1359 in
real::res_release. The approaches differ:real.rs. It callstitle_textures::forgetfrom the reference countReleasereturns, and around an extraAddRef.title_textures::release_tracked(+202 intitle_textures.rs), with unit tests and a concurrent refcount-2 race test.Both edit
res_release, so only one can land. Comparison only: I haven't run either.AI use: Claude Code (Claude Opus 5.5) compared the diffs and wrote this.
@Belox17 on GitHub · 2026-11-24 18:48 UTC · original
Test report for
0789e88b/7c748c8bon NVIDIA (RTX 3060 Ti): the whole suite passes, but the new test is flaky and takes two other tests down with itTested
0789e88bas is, clean tree. The current head7c748c8bis the same patch rebased onto9e3831e(git range-diff); its tree is identical to my merge of0789e88binto9e3831e, and the test is unchanged.cargo test --workspace -- --test-threads=4: 771 passed, 0 failed, 41 ignored (baseb7aa9f3: 770). Merged into9e3831e: 777 passed, 0 failed, 41 ignored.cargo test -p xcl --lib tracked_release_removes_entry, alone, 20 runs: 13 passed, 7 failed, alwaysobject not freed on iteration N(title_textures.rs:2181; N = 2, 14, 70, 85, 115, 208, 460).cargo test -p xcl --lib title_textures -- --test-threads=4, 10 runs: 5 passed, 5 failed. Each failed run has 3 failures: this test, plusplaced_title_textures_share_vram_and_preserve_pixelsandtransitions_apply_when_their_list_is_submittedwithPoisonError, because the panic happens whileTEST_LOCKis held.Likely cause, from reading the test (I did not instrument it): the
readerthread AddRefs every tracked key under theTEXTURESlock and releases it later throughrelease_tracked. When the reader holds the last reference in an iteration, the finalmock_releaseruns on the reader thread, possibly aftert2.join(), soobj.freedcan still be false at the assertion. Waiting until the reader has dropped its references to the current object (or keeping the reader away from the object under test) before asserting would make the check deterministic.Not tested
res_releasewith a title (late release on andXCL_LATE_RELEASE=0); AMD; any retail title (no smoke run).AI use: Claude Code (Claude Opus 5.5) ran the commands and wrote this report; I checked it before posting.
@DavidM1911 on GitHub · 2026-11-24 18:58 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.Thanks!
@throny on GitHub · 2026-11-24 20:29 UTC · original
Two contributors checked independently and found that #801 #1404 solves the same problem (for #1359) in a different way: #1607, group D38. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
@JJAutoCompare on GitHub · 2026-11-25 05:20 UTC · original
Empirical test report (
25fe0672)PR #1527, tested at
25fe06723d867defb80671d309a002f30a17475f.Hardware / environment
rustc 1.100.0 (0ef1bc386 2026-11-09)dxcompiler.dll: 1.9(5512-01b62ad4)(1.9.2609.5) - 1.9.2609.5 (01b62ad47)Commands and results
cargo test --workspace --no-runexited 0. This compiled the workspace test binaries.cargo test -p xcl --lib tracked_release_removes_entry_before_final_drop_and_survives_refcount_2_raceran outsideInvoke-ArcTest.ps1withXCL_ADAPTER=NONE_CPU_ONLYandRUST_TEST_NOCAPTURE=1. It exited 0 with 1 passed, 0 failed, 0 ignored, 0 skipped, and 748 filtered out.Observed behavior
The mock COM fixture confirmed that the single-reference resource left the texture table while the final reference was still held. Its concurrent case ran 500 iterations with two releasing threads and a reader that attempted to retain the resource under the table lock. Every iteration reached mock destruction, removed the table entry, and completed without the mock recording an AddRef after destruction.
Not tested
The full GPU workspace suite and game smoke runs were omitted. This fixture exercises the release helper with mock reference counts. It provides no coverage of the real D3D12 release hook, GPU queue behavior, or a title running with
XCL_LATE_RELEASE=0.AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1527-focused.logand published.@ettehn on GitHub · 2026-11-25 07:01 UTC · original
I repeated the mock COM test after the earlier flaky result. I applied the
25fe067diff by itself tomainat568e7dband verified that the added and removed lines match the upstream diff.On Windows 11 25H2 (
26200.9974), Ryzen 9 8945HX, Rust 1.97.1 MSVC (debug), I rancargo test --locked --offline -j 2 -p xcl --lib hle::d3d12x::title_textures::tests::tracked_release_removes_entry_before_final_drop_and_survives_refcount_2_race -- --exact --test-threads=1withXCL_ADAPTER=NONE_CPU_ONLY. 20 of 20 invocations passed, with 500 concurrent iterations per invocation and zero failures or ignored tests. I tested the updated fixture on this machine. This run did not exercise the actual D3D12 release hook, the GPU, or a retail title.Verification assisted by OpenAI Codex (GPT-6).
@DavidM1911 on GitHub · 2026-11-26 05:40 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.