perf(gpu): shard HostHeap::mirror across 256 descriptor stripes #16
No reviewers
Labels
No labels
accessibility
bench-bm-v1
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/PastiiJay--klbf-lab!16
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-16"
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?
@Vladimir-Human on GitHub · 2026-11-25 16:32 UTC · original
Vladimir-Human:perf/lockfree-mirror-descriptors→beta· +939 −133 · 1 files · 2 commits · openReplace
HostHeap's single globalmade: Mutex<Vec<u64>>andkept: Mutex<...>with a lock-freeAtomicU64fast-path + 256 cache-line-aligned descriptor stripes and canonical-orderstale != indexinvalidation (crates/victory-gpu/src/descriptor/host.rs), bringing KLBF Lab up to parity withvictory-perf/flamingoon high-draw scenes.What is in it (
crates/victory-gpu/src/descriptor/host.rs)made: Box<[AtomicU64]>):HostHeap::mirrorcheckstag == VIEW_TAG && key != 0 && self.made[index].load(Ordering::Acquire) == key && let Some(view) = view_at(i, generation), publishingkey(Ordering::Release) only aftermake()/null_for()andreplace_kept()complete.texture_views_remadeclearsmade[slot]under its stripe guard while rewriting views so concurrent fast-path readers never observe a half-updated descriptor.kept+ lock-freecopied: shards slow-pathCreate*View(make()) and kept resource slots across 256 cache-line-aligned stripes ((index & 255, index >> 8)), retiring displacedID3D12Resourcehandles viacrate::host::retirestrictly outsidekeptandslot_locks.copiedusesOnceLock<Box<[AtomicU64]>>CAS.stale != indexinvalidation:Spans::clashing_slots+HostHeap::note_buffer_checked(..., held_stripes)pre-checks missing stale stripes underplacedbefore mutating state;HostHeap::mirrormerges missing stripes intoneeded_stripesand acquires them strictly in ascending index order (0..255).mirror_release_acquire_later_and_forget_semantics,concurrent_cache_hit_and_distinct_create_view_storm,concurrent_same_slot_and_stale_invalidations_do_not_deadlock,concurrent_stale_invalidation_and_cbv_overwrite_never_clobbers_live_slot,concurrent_texture_views_remade_and_fast_path_stay_consistent, and 8-thread--releasebenchmarks.Verification (
f5a960c, Windows 11 Build 26300, NVIDIA GeForce RTX 4070 SUPER, Rust 1.98.1)VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked --lib descriptor::host::tests:: -- --test-threads=1: 24 passed, 0 failed, 2 ignored (#[ignore]benches) (0D3D12 debug errors/warnings).cargo clippy --workspace --all-targets --locked -- -D warnings(default &--all-features): 0 warnings incrates/victory-gpu/src/descriptor/host.rs(fails only on pre-existingorigin/klbf-amd/betalints in untouchedsgd5.rs:557,resource.rs:2667,draw.rs:2441,indirect.rs:1574).cargo test --workspace --locked: 585 passed, 1 pre-existing failed, 14 ignored (sole failure is pre-existingorigin/klbf-amd/betaxtaskpolicy::tests::repository_passes_policyon untouchedcrates/victory-shader/src/emit/lower.rs> 512 KiB anddocs/klbf/logo.svg).0ad4037) vs AFTER (f5a960c) 8-thread--releasebenchmark on RTX 4070 SUPER:bench_mirror_fast_path_8_threads[cbv_inline](400k hits): median50.639 -> 0.782 ms(64.8x faster,7.90 -> 511.51 Mops/s)bench_mirror_fast_path_8_threads[mixed_cbv_srv](400k hits): median52.075 -> 13.479 ms(3.86x faster,7.68 -> 29.68 Mops/s)bench_mirror_slow_path_create_views_8_threads(16,384 slots): median12.002 -> 6.569 ms(1.83x faster,1,365 -> 2,494 Kviews/s).Not tested
AI use
gemini-4-hydrogen-xhigh+gemini-4-neon-xhigh).@HandshakeHackin on GitHub · 2026-11-25 16:52 UTC · original
I ran the four new concurrent descriptor tests on Windows with
VICTORY_D3D12_WARP=1and the diagnostics feature. All four passed. In the verification checkout I made the test setup fail if it could not create the host or descriptor heap, so a missing adapter could not silently skip the assertions. This covers the software backend. I did not measure performance.Windows WARP test output
@PastiiJay on GitHub · 2026-11-25 17:02 UTC · original
Thanks a lot @Vladimir-Human! Noted. I'll test it on the RX 9070 XT in the next test build and report back here.
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.