Skip to content

[SVS] Implement memory-mapped I/O for Flat and static Vamana SVS indices#5271

Open
rfsaliev wants to merge 5 commits into
facebookresearch:mainfrom
rfsaliev:rfsaliev/mmap-svs-index
Open

[SVS] Implement memory-mapped I/O for Flat and static Vamana SVS indices#5271
rfsaliev wants to merge 5 commits into
facebookresearch:mainfrom
rfsaliev:rfsaliev/mmap-svs-index

Conversation

@rfsaliev

@rfsaliev rfsaliev commented Jun 3, 2026

Copy link
Copy Markdown

This pull request adds support for memory-mapped I/O (mmap) loading of static SVS (Scalable Vector Search) indices in Faiss, enabling faster and more memory-efficient index loading. The main changes include implementing mmap-based deserialization for static Vamana and Flat indices, updating the index loading logic to use mmap when requested, and adding comprehensive tests for the new functionality.

Memory-mapped index loading support:

  • Added map_to methods to IndexSVSVamana and IndexSVSFlat for loading static indices directly from memory-mapped files, including logic to manage memory mapping ownership and adjust file positions after mapping.

Index and file structure updates:

  • Extended IndexSVSVamana and IndexSVSFlat classes to hold a reference to the mmap owner, ensuring the mapped memory remains valid for the lifetime of the index. Also added forward declarations and includes for mmap-related types.
  • Modified reset methods to release memory mappings when the index is reset, preventing resource leaks.

Testing and interface improvements:

  • Enhanced test utilities and added new tests to verify correct mmap loading for various static Vamana index types, including FP32, FP16, SQI8, LVQ4x4, and LeanVec4x4 in tests/test_svs.cpp

These changes collectively provide robust and efficient support for memory-mapped loading of static SVS indices, improving both performance and usability for large-scale vector search applications.

@meta-cla

meta-cla Bot commented Jun 3, 2026

Copy link
Copy Markdown

Hi @rfsaliev!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla Bot added the CLA Signed label Jun 3, 2026
@meta-cla

meta-cla Bot commented Jun 3, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@rfsaliev rfsaliev force-pushed the rfsaliev/mmap-svs-index branch from 94b5e8d to c557940 Compare June 8, 2026 08:06
@meta-codesync

meta-codesync Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@mnorris11 has imported this pull request. If you are a Meta employee, you can view this in D108313487.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants