Build the quantized indexes from an mmapped codes CSR - #46
Merged
chishui merged 2 commits intoSep 3, 2026
Merged
Conversation
Signed-off-by: Zirui Song <zrsong@amazon.com>
zirui-song-18
requested review from
chishui,
model-collapse and
yuye-aws
as code owners
September 3, 2026 08:10
chishui
reviewed
Sep 3, 2026
| [[nodiscard]] size_t code_element_size() const override; | ||
| // The value width read_csr(kMmap) borrows a native CSR at: this index's | ||
| // code width, so a codes CSR is borrowed in place rather than a float one. | ||
| [[nodiscard]] size_t mmap_element_size() const override { |
Collaborator
There was a problem hiding this comment.
you can just use code_element_size, no need to create another, if you need a parent class level function which can be used for both non-sq index and sq index, let's just promote code_element_size
Collaborator
Author
There was a problem hiding this comment.
Good call — promoted code_element_size() up to MmapIndex (default U32) and dropped the parallel mmap_element_size().
Signed-off-by: Zirui Song <zrsong@amazon.com>
chishui
approved these changes
Sep 3, 2026
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.
Description
read_mcsr borrows values at the index's own width via a new mmap_element_size() hook (default float), and native_file_size gains an element_size argument. SeismicScalarQuantizedIndex and DiskSeismicScalarQuantizedIndex now borrow a pre-quantized codes CSR instead of rejecting mmap, so all four index types share one CSR-ingest contract. read_csr_and_ids therefore works with a quantized delegate too.
Issues Resolved
List any issues this PR will resolve, e.g. Closes [...].
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.