D3D12.X: remove tracked textures atomically on final Release #801
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!801
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-801"
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?
@wayward-tail on GitHub · 2026-11-24 05:37 UTC · original
wayward-tail:pr/tracked-texture-release→main· +75 −2 · 3 files · 1 commits · draftA tracked resource could be destroyed by its final COM Release before it was removed from the texture table. A concurrent refresh could then AddRef the stale pointer. Hold TEXTURES across the real Release and remove the entry before unlocking when its refcount reaches zero.
What is in it
Tested
cb08f9e464d09060850734e9b0962b80d31b2740; Windows 11 Home build 26200, AMD Ryzen 7 8845HS, NVIDIA RTX 4060 Laptop GPU (driver 32.0.15.9282), Rust 1.100.0 MSVC, DXC 1.9.2609.5. Tests debug; title smoke release with symbols.XCL_ADAPTER=rtx 4060.cargo build --workspaceandcargo build --release -p xcl: succeeded.cargo test --workspace --no-fail-fast -- --test-threads=4: 701 passed, 1 failed, 41 ignored. The two wave64 skips below are included in Cargo's passed count.64b3f35: 700 passed, 1 failed, 41 ignored.gpu_clamp_and_omod_per_instructionfails atv_pk_add_i16 clampon unmodified main on this GPU.Regression run
Main:
This branch:
Not tested
XCL_SAMPLE_*game-data variables: unset, so those bodies were not exercised.AI use
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@futurepro62 on GitHub · 2026-11-24 07:06 UTC · original
Full-suite run, since this PR has no test report yet. Tested exact head
cb08f9e(on its base64b3f35).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 702 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.release_if_tracked_removes_atomically_under_textures_lock.Not tested
AI use
@iggyvilla on GitHub · 2026-11-24 07:34 UTC · original
Code read of head
cb08f9e(static read only; nothing built or run). The race is real:refresh_onceclones tracked resources underTEXTURES, and removing the entry in the same critical section as the finalReleasecloses the window betweenRelease() == 0andforget(). I looked for a self-deadlock (aReleaseof an XCL-held clone whileTEXTURESis held) and did not find one: every clone made under the lock (title_textures.rs:298clone_resources) is returned out of the lock before it is dropped.One concern: cost on the hot path.
res_release(real.rs:1547) is the patchedReleaseof every resource XCL hands out, buffers included. It now callsrelease_if_tracked, which takes the globalTEXTURESmutex first (title_textures.rs:506) to find out whether the resource is tracked, and for a tracked one runs the driver'sReleaseunder that lock (:510). Before, the fast path was a plainf(this). So everyReleasein the title (per-frame buffers, XCL's own clone drops after an upload) now contends withrefresh,submittedandnote_transitions, which hold the same mutex. I did not measure it, so it may be nothing; can you say what the 60 s smoke shows for frames and forrefreshtime againstmain? If it matters, a check that does not take the lock for untracked resources (a marker on the object, or an atomic count of tracked textures as a first gate) would leave the lock to the ones that need it.The test proves
Releaseruns underTEXTURES; it does not run a second thread doing whatrefreshdoes (lock,clone) during the final release, so it would still pass if the removal moved back outside the lock.AI use: Claude Code, Claude Sonnet 5.5, read the diff and the code around it at the head named above and drafted this comment; I checked each line reference.
@throny on GitHub · 2026-11-24 20:29 UTC · original
Two contributors checked independently and found that #1404 #1527 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.
@DavidM1911 on GitHub · 2026-11-25 10:58 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a 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.