GPU: release replaced title memory layouts off the submitting thread #3144
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3144
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3144"
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?
@Ingenioeren on GitHub · 2026-11-26 10:10 UTC · original
Ingenioeren:fix/3137-layout-drop-off-thread→main· +79 −13 · 3 files · 1 commits · openWhat
Queue the replaced title-memory layout on the existing release thread. The rewrite runs between submissions and updates the page table and its descriptors before handing off the old layout. Copies still used by the new table or by recorded work retain their own references. No extra GPU fence is needed. If the release worker is unavailable, the existing queue helper drops the value inline.
Keep upgraded shadow owners alive until the marks lock is released, including owners of withheld pages and owners rejected by the page bounds check.
Why
Replacing a layout can drop thousands of shadow references on the submitting thread while the heap locks are held. The diagnosis in #3137 also identified that dropping the last shadow reference during marks lookup can re-enter the marks lock and deadlock. The two changes address those paths together.
How tested
cargo test --locked --offline -p victory-gpu mark_lookup_releases_its_last_reference_outside_the_lockonorigin/main(63bcca4) with only the regression test and its test-only hook applied. It failed with a five-second timeout after the weak upgrade became the last strong reference.cargo test --locked --offline -p victory-gpu mark_lookup_releases_its_last_reference_outside_the_lockwith the fix. One passed, covering both the withheld-page and out-of-range mark paths.cargo test --locked --offline -p victory-gpupassed with 232 passed, 0 failed, and 1 ignored (the existing synthetic benchmarkobject::tests::benchmark_private_data_release). There were no doctests.cargo clippy --locked --offline -p victory-gpu --all-targetspassed with no warnings.cargo run --locked --offline -p xtask -- policy --stagedpassed for all 3 staged files.Test limits
No game run, independent performance measurement, or direct test of the layout destructor's thread.
Fixes #3137
AI assistance: prepared with OpenAI Codex under Claude Code's direction, reviewed by Ingenioeren.
@Dukestar69 on GitHub · 2026-11-26 10:29 UTC · original · approved these changes
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-gpu --lib shadow:: -- --test-threads=1: passed.cargo test -p victory-gpu --lib memory:: -- --test-threads=1 --skip lists_share_a_table_and_copies_keep_their_views: 7/7 passed.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20/20 passed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly defers dropping replaced title memory layouts off the submitting thread.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 10:39 UTC · original
@Ingenioeren I checked the destructor thread you listed as untested on exact head
35b9c70608and parent main63bcca43c6.I ran the same fixture on Windows with WARP verified by the DXGI software adapter flag. It rewrote a real D3D12 page table twice, put a thread marker at the end of the old Layout, and waited for its last Arc to drop. The second rewrite published generation 2 on both builds, and the old Arc count reached zero on both.
63bcca435b9c70The assertion for off-thread disposal failed on main and passed here. This establishes the handoff for one synthetic table rewrite. The reporter's timing measurements still need a title run.
My narrower #3145 covers the same mark-owner lifetime change. This PR also carries the layout handoff, so the two patches should be considered together. If you adopt our test approach or carry code from #3145, please retain the Git author when cherry-picking. If it is folded into another commit, please use the trailer below.
Co-authored-by: andrewpozdnakov7-jpg [email protected]
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.