gpu/descriptor: lock-free ShapeArena and fast-hashed Views registry #245
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/245"
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 TaynanGT/Vice-Tay. Originally posted by mint17 on 2026-11-27T11:55:15Z.
Eliminates global
VIEWSRwLockread contention on placed-view decodes (view_at(PLACED)) andBTreeMap/SipHash overhead on view and shape lookups incrates/victory-gpu/src/descriptor.rs(zero merge conflict with #234).Changes
ShapeArenaCore(2048 × 2048 = 4,194,304shapes): Stores append-only placed-viewShapeentries in heap-allocated[UnsafeCell<MaybeUninit<Shape>>; 2048]slabs with a cache-line-isolatedAtomicU32watermark and direct raw-pointerUnsafeCell::raw_getslot reads/writes.view_at(PLACED)now performs zero locks and zero atomic writes.ShapeKeyhashing: Replaces SipHash-1-3 +BTreeMap<u64, u32>with a fast field-level word hash (ShapeKey+IdentityHash) and a coldshape_collisionsoverflow map (zero heap bytes unless a 64-bit collision occurs, zero 116-byteShapekey duplication).Viewsmaps: ReplacesBTreeMapinindexandby_resourcewithHashMapbacked by a word-chunked cross-platformViewHash, pre-hashesShapeKeyoutsideVIEWS.statelock, and removes the redundantcontains_keylookup inentry_kept.Benchmarks (
cargo test --release --locked -p victory-gpu views_registry_bench -- --ignored --nocapture)RwLock<Vec<Shape>>+ SipHash +BTreeMap)ViewRegistry)view_at(PLACED)view_at(PLACED)(7R + 1W)known_shapehit (65K shapes)entry_ofhit (32K views)Verification
cargo test --locked -p victory-gpu descriptor:: -- --test-threads=1(68 passed, 0 failed — includes 50,000-opBTreeMaporacle parity test, forced-collision & capacity-ceiling test across 4 slabs, hash avalanche test, and 8-thread concurrent stress test indescriptor/views_tests.rs).cargo test --locked -p victory-gpu --all-features descriptor::tests -- --test-threads=1(14 passed, 0 failed).cargo clippy -p victory-gpu --all-targets --locked -- -D warnings(default +--all-features) andcargo test --locked -p xtaskpassed.Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T11:58:17Z.
@mint17 The 8-thread benchmark isolates contention in placed-view lookups. The first correctness gate for the arena is publication: a reader observing the new watermark must also see the initialised slab and shape. I’ll check that invariant at the slab boundary and keep the benchmark numbers scoped to registry operations.
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:15:12Z.
mainhas moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the currentmainand open a new PR; I'll review it there.Pull request closed