Add primary-only LeanVec storage kinds to C++ runtime#338
Open
ibhati wants to merge 1 commit into
Open
Conversation
Add two new StorageKind enum values for primary-only LeanVec: LeanVecLVQ4PrimaryOnly and LeanVecLVQ8PrimaryOnly. These select the new LeanDataset<UsingLVQ<N>, void, ...> partial specialization which omits the secondary (reranking) tier for ~50% memory savings at the cost of reranking accuracy. Vamana-only (IVF support out of scope). - api_defs.h: extend StorageKind enum - svs_runtime_utils.h: extend is_leanvec_storage(), add LeanDatasetPrimaryOnlyType alias, StorageType specializations, new dispatch cases in SVS_DISPATCH_STORAGE_KIND - vamana_index_impl.h, dynamic_vamana_index_leanvec_impl.h: new switch cases in dispatch_leanvec_storage_kind - runtime_test.cpp: write/read round-trip tests for both new kinds
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.
Summary
Adds the public C++ runtime surface for primary-only LeanVec. This is the public-side counterpart to the private re-architecture; see the private PR for the design discussion and rationale.
Changes
StorageKindenum: two new variantsLeanVecLVQ4PrimaryOnlyandLeanVecLVQ8PrimaryOnly.is_leanvec_storage(): updated to recognize them.LeanDatasetTypealias +StorageTypespecializations: produceLeanDataset<UsingLVQ<N>, void, ...>for the new kinds (mapping to the private partial specialization).StorageFactoryspecializations: build/load the primary-only LeanDataset (no secondary tier).SVS_DISPATCH_STORAGE_KINDmacro: add both new cases to the dispatch.Architectural alignment
The private side now uses a partial specialization
LeanDataset<T1, void, ...>(no runtime flag, no secondary member, no secondary methods) — mirroring how LVQ has separate one-level vs two-level classes. The public side exposes this through newStorageKindenum values, which is the same way LVQ4/LVQ8 variants are already exposed.Diff
+100 / −1 across 5 files. All additive at the public surface: no existing enum values changed, no existing API signatures changed.