Repository navigation
perf(gpu): stripe HostHeap slot locks and scope bindless heap sweeps to bound heaps - #404
Open
gdemontalivet wants to merge 1 commit into
Open
gdemontalivet wants to merge 1 commit into
gdemontalivet wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Building on #279's fast-skip bitset and forget-epoch cache in
sync_slots_bytes, two sources of descriptor-heap lock contention and redundant submission work remain onHostHeap:HostHeap::mirrorandHostHeap::keptglobal mutexes: Even whenready[index]matches on themirrorfast path,needs_remakelocks the heap-widekept: Mutex<Paged<Held>>on every draw-bound texture view, and slow-path descriptor updates serialize all recording threads on the singlemadeandkeptmutexes while callinghost::retireunder the lock. Candidate checks insync_slots_bytes,evict,unmade_placed, andstamp_readlikewise acquire those heap-wide locks.SHADER_HEAPS—even copy/upload-only submissions or heaps not bound by any submitted command list—andrun_deferredre-sweeps the sameViewedheap when multiple command lists in a batch reference it without an intervening title write.Changes
mirrorcache hits and candidate checks: StoreHostHeap::madeasBox<[AtomicU64]>and track each title slot's raw resource pointer inkept_raw: Box<[AtomicUsize]>, somirrorcache hits,needs_remake,unmade_placed,stamp_read, andsync_slots_bytescandidate comparisons take zero mutexes.StripeLocks for slow-path updates andPaged<Held>: Shard slow-path slot updates and sparsePaged<Held>storage across 256 64-byte-aligned stripes, and retire displacedID3D12Resourceobjects outside all heap locks.view_addresses: Exposeview_addresses_resourcesodraw.rsretains the upload buffer vialist.keep(buffer)until command-list reset.sync_heaps_for&Batch::swept_heaps): Record shader-visible heaps bound on eachHostList(note_bound_heap) and sync only heaps bound or referenced by the submitted lists, preserving dirty ranges on unbound heaps until a submission binds them. DeduplicateStep::Heapsweeps inhost::executeand acrossBatchuntil a title write invalidatesswept_heaps.Synthetic Benchmarks (CrossOver Preview + D3DMetal on M5 Max)
concurrent_striped_mirror_and_fast_path_benchmark(8 threads, 4,096 slots):270–411 Kviews/sconcurrent stripedCreate*Viewupdates and7.8–10.7 Mops/slock-freemirrorcache hits, with zero D3D12 debug or device-removal messages.submissions_only_sync_bound_heaps: verifies unbound placed heaps are skipped during unrelated submissions while retaining their dirty page marks until bound.Live M5 Max Verification (Combined Build on CrossOver Preview + D3DMetal)
CrossOver Preview+ D3DMetal,wave32=true), the runtime reached and sustained the 3D world through+8, +24, +48, +90at1.5–1.8 FPS(549.7–672.1 ms/frameon1,021–1,258 draws/frame,1.275 FPSoverall across+8..+90) with02.48 sallocation stalls,7.2–9.0 ms/frameGUARDSlock hold time (down from4,887 ms/framebefore unlockingGUARDS),149–154 MB/framebuffer copy volume,0DirectStorage decompression or access-violation failures, and38/38over-32 KiB aligned mesh/pixel pairs linked with0host mesh refusals.Verification
victory-gpusuite passed (including perf(gpu): fast-skip empty and unchanged slots in descriptor heap sync #279'ssync_slots_skips_empty_and_clears_after_forgetand perf(gpu): cache render targets, bound pipelines, and unaligned CBV scratch per list #268's bind-cache paths).cargo xtask policy,git diff --check, andcargo clippy(-- -D warnings, with and without--features diagnostics) passed. All test inputs are synthetic.