Repository navigation
feat: Implemented zero-allocation memory-mapped HNSW graph - #9
Merged
Merged
Conversation
- Developed a custom HNSW index storing vectors, levels, and neighborhood links in fixed-stride flat arrays using POSIX `mmap` backing (`storage::MmapFile`), avoiding dynamic allocation overhead during construction and query execution. - Added strict padding to `Header` to enforce `alignas(64)` boundaries, ensuring contiguous memory segments are cache line optimized for SIMD instruction dispatching. - Established fine-grained node-level concurrency using off-heap `Spinlock` arrays, enabling wait-free topological insertion without global lock contention or storing locking primitives in the persistent `.bin` file. - Ensured thread-safe search traversals using `std::atomic_ref` and strict memory barriers (`memory_order_acquire`/`memory_order_release`), nullifying the data-race when appending neighbors in concurrent threads. - Added double-checked locking mechanisms when promoting the global graph entry point (`entry_point_`) and maximum tree height (`max_level_`). - Introduced Google Tests validating HNSW constraints, including accuracy (`Recall`), multi-threaded stress-testing inserts, and zero-downtime persistence mapping. - Updated documentation (`TODO.md`, `patterns.md`) specifying Tombstone Roaring Bitmaps for O(1) delete logic as the next priority, fulfilling the LSM-Compaction architectural pattern to mitigate graph fragmentation caused by index holes.
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.
mmapbacking (storage::MmapFile), avoiding dynamic allocation overhead during construction and query execution.Headerto enforcealignas(64)boundaries, ensuring contiguous memory segments are cache line optimized for SIMD instruction dispatching.Spinlockarrays, enabling wait-free topological insertion without global lock contention or storing locking primitives in the persistent.binfile.std::atomic_refand strict memory barriers (memory_order_acquire/memory_order_release), nullifying the data-race when appending neighbors in concurrent threads.entry_point_) and maximum tree height (max_level_).Recall), multi-threaded stress-testing inserts, and zero-downtime persistence mapping.TODO.md,patterns.md) specifying Tombstone Roaring Bitmaps for O(1) delete logic as the next priority, fulfilling the LSM-Compaction architectural pattern to mitigate graph fragmentation caused by index holes.