GPU: release mark owners outside the marks lock #3143
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3145"
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 Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T10:15:01Z.
Refs #3137.
copy_back_marksupgrades a weak shadow reference while holding the marks registry. When the mark falls outside the copy, dropping that temporaryArccan runShadow::dropunder the same lock. The path for held-back pages also processes them under the registry lock.Snapshot strong references and their offsets under the lock. Validate the offsets, release rejected references, and process both marked and held-back pages after releasing the lock.
The same isolated Windows/WARP fixture on
63bcca4lost the rejected owner before iteration. With this change it carries one reference out of the lookup, rejects the out-of-range page, and releases the owner. Its valid-page control resolves to the same address.shadowtests passed. The full app-local WARP GPU suite passed 247 tests with one ignored.cargo xtask policychecked 191 files.The fixture checks mark ownership. The layout-rewrite performance measurement in #3137 remains a separate experiment.
AI-assisted. Synthetic data only.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T10:28:35Z.
Review: APPROVED
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-gpu --lib shadow:: -- --test-threads=1: 11/11 passed (includinga_rejected_mark_keeps_its_copy_until_after_the_lookup).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 drops mark owners outside the marks lock to avoid lock-ordering/reentrancy hazards.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T23:02:12Z.
Windows 11,
63bcca4+ this PR, Radeon RX 7900 XTX:cargo test -p victory-gpu --lib: 232 passed / 0 failed / 1 ignored (unpatched63bcca4here: 231).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.a_rejected_mark_keeps_its_copy_until_after_the_lookuppasses, as do the shadow/withheld tests it touches. Synthetic only. AI-assisted.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T23:50:25Z.
Review: APPROVED
Looks good — cleanly fixes a real
MARKS->Shadow::drop->MARKSself-deadlock on both rejected mark indices and theheldloop.Checked
crates/victory-gpu/src/shadow.rs:927-930andshadow.rs:948-969, as well as every othermarks()lock site inshadow.rs(254,269,700,912):registrylock,marked_pagesonly upgradesWeak<Shadow>handles intoownersand releases theMutexGuardbefore filtering out-of-range offsets or yielding items to the caller.heldowners dropped during iteration (as well ascrate::memory::drop_withheld) now run strictly outside theMARKSlock, allowingShadow::dropto reclaim its mark bits without deadlocking.+ use<>tomarked_pages's return type would let callers pass temporary slice literals without an extra binding, though current callers passing&held/&markedare unaffected.)Verification (
8ddfe76f):cargo xtask policyandcargo clippy -p victory-gpu(default and--features diagnostics,--tests -- -D warnings): passed.shadow::tests::(10/10, includinga_rejected_mark_keeps_its_copy_until_after_the_lookup): passed on both hardware GPU and WARP (--features diagnostics,VICTORY_D3D12_DEBUG=1).MARKSregression and stress probe dropping the last externalArc<Shadow>on both a rejected out-of-range mark and aheldmark (plus an 8-thread x 25-iteration concurrent create/lookup/drop stress loop): passed on both hardware GPU and WARP with zero deadlocks and clean mark owner reclamation.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.