GPU: bound shadow buffer lookup by maximum registered size instead of 64 entries #2556
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2556"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by fuzeofficlal on 2026-11-29T14:18:31Z.
Problem
BUFFERSreverse scans incrates/victory-gpu/src/shadow.rs(lookup,peek,peek_overlapping,extent,in_buffer, andin_place_let_go) stopped after a fixed.take(64)/.take(256)entry cap. When a title registers more than 64 smaller inner buffers inside a larger covering heap/buffer, lookups past those inner buffers missed the covering outer buffer and fell through to loose windows or returnedNone.Fix
BUFFERS(RwLock<Buffers>) to track live registration counts per buffer size insizes: BTreeMap<u64, usize>, keepingmax_size()exact in O(log n) across inserts, in-place size replacements, and removals..take(64)/.take(256)caps inlookup(both read and write paths),peek,peek_overlapping,extent,in_buffer, andin_place_let_gowith a reverse range bounded bymax_size()(lowest = end.saturating_sub(max_size)).extentandnearfrom write-lockingbuffers()to sharedbuffers_read().shadow::buffer_lookup_testscovering lookup (find,extent,in_buffer,peek,peek_overlapping) past 128 inner buffers,max_size()bounding and tightening on unregister, equal-size counts, in-place replacements, and descending removals to empty.Verification
cargo test --locked -p victory-gpu --lib shadow::buffer_lookup_tests -- --test-threads=1— passed on RTX 5090 and WARP (VICTORY_D3D12_WARP=1).cargo clippy --locked -p victory-gpu --tests— 0 new warnings inshadow.rs.cargo run --quiet --locked -p xtask -- policy --staged— passed.