GPU: RwLock SHADER_HEAPS, shard HostHeap::kept, and batch dynamic slot release #3832
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3832"
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 CaullenOmdahl on 2026-11-29T12:16:32Z.
Problem
SHADER_HEAPSuses a globalMutex, serializing concurrentmirror,sync_heaps,make_read,read_textures,evict,release_dynamic, andwith_hostcalls across title and recording threads even though the list only mutates on heap creation and drop.HostHeap::keptprotects all1,000,000+title and dynamic slots with a single heap-wideMutex<Vec<Kept>>, andHostHeap::keepunconditionally callscrate::host::retirewhile holding that mutex—even when a rewritten slot still references the exact same hostID3D12Resource.draw::State::dropreleases dynamic descriptor slot runs one entry at a time, re-lockingSHADER_HEAPSandHostHeap::nexton every run.Changes
RwLockSHADER_HEAPS: Take shared read locks for lookup/mirror/sync paths and exclusive write locks only increate_heapandHeap::drop. ConcurrentHostHeap::mirrorcalls across threads remain synchronized per heap byHostHeap::madeand the existing unaligned record recheck afterprepare(&view).HostHeap::kept(1024slots/shard) & outside-lock retirement: SplitHostHeap::keptintoKEPT_PIECEshards, drop the shard lock before callingcrate::host::retire(removingkept -> RETIREDlock nesting), and skip queuing a retire when the new view keeps the identical rawID3D12Resourcepointer.HostHeap::release_batchanddescriptor::release_dynamic_batch, updatingdraw::State::dropto releaseMEMORY_HEAPand title-heap runs under at most one lock acquisition per heap.Note: Composes cleanly without conflicts alongside the descriptor
ViewRegistry/ShapeArenaPR.Ported from
CaullenOmdahl/Boxon.Validation
cargo xtask policycargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warningscargo clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warningscrates/victory-gpu/src/descriptor/host.rscovering cross-shardKEPT_PIECEboundaries, unchanged-resource reference counts on slot rewrites, and batched dynamic slot release.Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-29T12:38:56Z.
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
b69a82faad8ec70719ee188447f9b525668ee617, base/parent63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-gpu --lib -- descriptor::host::tests::release_batch_and_sharded_kept_handle_boundaries_and_same_resource_rewrites --exact --test-threads=1 --quiet→ 1 passed, 0 failed, 232 filtered, exit 0.git grep -Ffor the test name on the base returned no match (test is new on this PR);git diff --check 63bcca4 HEADclean (3 files, +242/-83).CARGO_TARGET_DIR(never shared) withCARGO_BUILD_JOBS=2.victory-gpulib warnings).AI-assisted (Hy4 flash).
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-29T16:41:02Z.
Hardware check on a Radeon 780M (RDNA3, Ryzen 7 8845HS), merged onto main
63bcca4:cargo test --profile diag -p victory-gpu --features diagnostics --libpasses 247/247 twice, and 251/251 twice together with #3831 (they merge clean). Note it conflicts with #3848. No frame-time claim from me: the syntheticworld_frame_preparingbench (#2134) doesn't exercise the descriptor paths this changes.AI-assisted (Claude).
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.