perf(victory-gpu): use RwLock for early pipeline tracking and avoid Call string formatting #416
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/416"
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 LooperSalty/AnyXboxX. Originally posted by Lewandox on 2026-11-26T18:00:05Z.
Summary
Removes unnecessary heap allocations and mutex contention on the hot pipeline-library lookup/creation path while keeping identical
removal_note()diagnostics on device removal.Changes
USED(wanted_early/note_used) —RwLock+ zero-allocation check:USEDfromMutex<Option<HashSet<String>>>toRwLock<Option<HashSet<String>>>with lazy initialization helperensure_used().wanted_early(key)now takes a shared read lock instead of an exclusive mutex.note_used(key)checks membership and theEARLY_MAXcap under a shared read lock first, returning immediately with zero write lock and zerokey.to_owned()heap allocation once a pipeline key has been seen.Call/CALLS— deferred string formatting & inline pipeline names:LABELasArc<str>instead of cloning a heapStringon everycall().CallName(Inline([u8; 32], u8)/Heap(String)) so 32-byte pipeline hash keys do not allocate on the heap duringcall("load" | "make" | "store", name).format!("{name} {label}")so formatting only happens insideremoval_note()if a device removal actually occurs.Tests:
CallNameinline/heap storage,Callformatting inremoval_note(), andwanted_early/note_usedbehavior.Verification
cargo test -p victory-gpu --lib pipeline::library::tests(default and--features diagnostics)cargo xtask policy