Skip to content

Build the quantized indexes from an mmapped codes CSR - #46

Merged
chishui merged 2 commits into
opensearch-project:mainfrom
zirui-song-18:mmap-csr-build-quantized
Sep 3, 2026
Merged

Build the quantized indexes from an mmapped codes CSR#46
chishui merged 2 commits into
opensearch-project:mainfrom
zirui-song-18:mmap-csr-build-quantized

Conversation

@zirui-song-18

Copy link
Copy Markdown
Collaborator

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.

Signed-off-by: Zirui Song <zrsong@amazon.com>
[[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 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
chishui merged commit 4563976 into opensearch-project:main Sep 3, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants