Skip to content

MB-65243: Merge facebookresearch/faiss@v1.11.0 into blevesearch/faiss@bleve#52

Merged
abhinavdangeti merged 73 commits intoblevefrom
main_1.11.0
May 20, 2025
Merged

MB-65243: Merge facebookresearch/faiss@v1.11.0 into blevesearch/faiss@bleve#52
abhinavdangeti merged 73 commits intoblevefrom
main_1.11.0

Conversation

@abhinavdangeti
Copy link
Member

@abhinavdangeti abhinavdangeti commented May 19, 2025

Merge results:

|\
* ca874b6eb Abhinav Dangeti | Fix type mismatches within unit test: TEST(TestHamming, test_hamming_knn)
* e255b9b16 Abhinav Dangeti | Adapt signature change of `get_InvertedListScanner` in faiss/IndexIVFPQ.cpp
* 90fe29ba1 Abhinav Dangeti | Remove redundant cmake install over target `faiss_c`
*   0882dd3d5 Abhi Dangeti | Merge branch 'bleve' into main_1.11.0
|\
| * 0be294abd Deepkaran Salooja | Implement compute_distance_to_codes_for_list and compute_distance_table for IndexIVFPQ (#50)
| * 352484e0f Rahul Rampure | MB-65473: Batch converter for vector to cluster IDs (#49)
| * 14a4a60e9 Rahul Rampure | MB-65473: Refactor and Optimize Pre-Filtered Vector Search (#48)
| *   b4cc942e1 Abhi Dangeti | MB-65243: Merge 'facebookresearch/faiss@v1.10.0' into 'blevesearch/faiss@bleve' (#46)
| |\
| | * 8d33b5ce1 Abhinav Dangeti | MB-65243: Merge 'facebookresearch/faiss@v1.10.0' into 'blevesearch/faiss@bleve'
| |/|
| * | 8eecdb636 Rahul Rampure | MB-63643: Fix missing num_threads clauses (#44)
| * | 224acefbf Deepkaran Salooja | MB-61093 Fix memory leak for SQDistanceComputer (#43)
| * | 3001b518c Deepkaran Salooja | MB-61093 Add method to compute distance from codes for IVF index (#41)
| * | b747c55a9 Aditi Ahuja | MB-62230 - Updated closest_centroids API to include params (#38)
| * | 26d9b359c Aditi Ahuja | MB-62230 - Extended c_api to search only specified clusters with params. (#35)
| * | f077bf939 Abhi Dangeti | Build libfaiss with AVX2 support when requested, rather than libfaiss (#37)
| * |   5ab1ce067 Abhi Dangeti | MB-62577: Merge 'facebookresearch/faiss@v1.8.0' into blevesearch/faiss@bleve
| |\ \
| | * | 3306e5853 Abhinav Dangeti | MB-62577: Merge 'facebookresearch/faiss@v1.8.0' into blevesearch/faiss@bleve
| |/| |
| * | | d9db66a38 Rahul Rampure | MB-62221: API to free a buffer allocated in C runtime (#30)
| * | | a2f4183b1 Rahul Rampure | MB-62221: Fix buffer overflow (#29)
| * | | 797745744 Rahul Rampure | MB-61930: Add a num_threads clause to every openMP pragma. (#25)
| * | | a30eaa215 Rahul Rampure | MB-61930: Optimize Thread Management in High Throughput Scenarios (#24)
| * | | 2ce38831d Thejas-bhat | MB-59575: Revert memcpy optimizations for flat indexes (#23)
| * | | 7c3c7d1c0 Thejas-bhat | MB-59575: Refactor member variables alignment of IndexFlatCodes (#22)
| * | | 17c3992fa Thejas-bhat | MB-59575: Reducing copy overhead of already memory mapped content (#17)
| * | | 38f6b60c3 Chris Hillery | Fix build on Windows (#21)
| * | | 414398432 SaptarshiSen-CB | MB-61609: Fix zero sa_code_size (#19)
| * | | 7b119f4b9 Rahul Rampure | MB-60739: Fix integer overflow (#15)
| * | | 685168365 Rahul Rampure | MB-60657: Fix integer overflow (#14)
| * | | 8672bf302 Thejas-bhat | Size API to get the index's size (#13)
| * | | b34ccf66f Aditi Ahuja | MB-60202 - IDMap2 Selector (#12)
| * | | a623ec6bd Thejas-bhat | Introducing a new reader to read index using a pointer (#8)
| * | | 4dd26f8ce Chris Hillery | Add INSTALL() directive for faiss_c (#7)
| * | | 14fd16a11 Chris Hillery | Suppress (thousands of) warnings when building with GCC (#6)
| * | | 44febf0c0 Abhi Dangeti | Address incorrect import within c_api/IndexIVF_c_ex.cpp (#5)
| * | | 1b295e483 Abhi Dangeti | Add build instructions for IndexIVF_c_ex.cpp and Index_c_ex.cpp (#4)
| * | | 334021a52 Abhi Dangeti | additional index APIs (#3)
| * | | f0bbc0657 Abhi Dangeti | Introducing index IO operations over char buffer (#2)
* | | | ea1cdf0fb Michael Norris | Increment next release, v1.11.0 (#4308)
* | | | 70c45378e simshi | fix: algorithm of spreading vectors over shards (#4299)
* | | | d4fa40165 Michael Norris | Add RaBitQ to the swigfaiss so we can access its properties correctly in python (#4304)
* | | | c75f166e2 Satyendra Mishra | Add date and time to the codec file path so that the file doesn't get overridden with each run (#4303)
* | | | a3cd63fb6 Aditya Vidyadhar Kamath | Skip mmap test case in AIX. (#4275)
* | | | e36897fe7 Michael Norris | Fix overflow of int32 in IndexNSG (#4297)
* | | | 117aafd90 Michael Simpson | Fix Type Error in Conditional Logic (#4294)
* | | | 928333c6a Jim Meyering | faiss/gpu/GpuAutoTune.cpp: fix llvm-19-exposed -Wunused-but-set-variable warnings
* | | | bb04bf6fa Bhavik Sheth | Add missing header in faiss/CMakeLists.txt (#4285)
* | | | d9cfd0021 Satyendra Mishra | Implement is_spherical and normalize_L2 booleans as part of the training APIs (#4279)
* | | | 915f719d8 Michael Norris | Fix nightly by pinning conda-build to prevent regression in 25.3.2 (#4287)
* | | | de5e85ef0 generatedunixname89002005287564 | Fix CQS signal. Id] 88153895 -- readability-redundant-string-init in fbcode/faiss (#4283)
* | | | 7eac0346f Satyendra Mishra | Add normalize_l2 boolean to distributed training API
* | | | 0dfb599ea Jaap Aarts | Handle insufficient driver gracefully (#4271)
* | | | d4e236b50 Alexandr Guzhva | relax input params for IndexIVFRaBitQ::get_InvertedListScanner() (#4270)
* | | | df9e2c48d Alexandr Guzhva | Fix a placeholder for 'unimplemented' in mapped_io.cpp (#4268)
* | | | 0d3aff906 wwq | fix bug: IVFPQ of raft/cuvs does not require redundant check (#4241)
* | | | a4401c13d Kaival Parikh | Allow using custom index readers and writers (#4180)
* | | | 636d95e8a Tarang Jain | Upgrade to libcuvs=25.04 (#4164)
* | | | 7f523f084 Junjie Qi | ignore regex (#4264)
* | | | ccc2b33c8 Alexandr Guzhva | fix a serialization problem in RaBitQ (#4261)
* | | | 13255a8bf Kaival Parikh | Publish the C API to Conda (#4186)
* | | | 3a49130ce Alexandr Guzhva | RaBitQ implementation (#4235)
* | | | c2fc54908 Satyendra Mishra | Pass row filters to Hive Reader to filter rows (#4256)
* | | | 6116d36af Mayank Bhatia | Grammar fix in FlatIndexHNSW (#4253)
* | | | 1debb7d81 Matthijs Douze | re-land mmap diff (#4250)
* | | | 0f2035cc8 Richard Barnes | Fix CUDA kernel index data type in faiss/gpu/impl/DistanceUtils.cuh +10 (#4246)
* | | | 1dcbb4af3 Alexandr Guzhva | fix `IVFPQFastScan::RangeSearch()` on the `ARM` architecture (#4247)
* | | | 8bce244f1 Mengdi Lin | fix integer overflow issue when calculating imbalance_factor (#4245)
* | | | 5adab67ef Rohil Shah | Fix bug with metric_arg in IndexHNSW (#4239)
* | | | f2f7a66b5 Mengdi Lin | Back out "test merge with internal repo" (#4244)
* | | | caa5f2465 Junjie Qi | test merge with internal repo (#4242)
* | | | 9e808d4ea Richard Barnes | Remove unused exception parameter from faiss/impl/ResultHandler.h (#4243)
* | | | fec7ce96f Gustav von Zitzewitz | SearchParameters support for IndexBinaryFlat (#4055)
* | | | df6a8f6b4 George Wang | Address compile errors and warnings (#4238)
* | | | 15491a1e4 Saumya Agarwal | Revert D69972250: Memory-mapping and Zero-copy deserializers
* | | | fbc7db2cc Saumya Agarwal | Revert D69984379: mem mapping and zero-copy python fixes
* | | | 631b0fde4 Matthijs Douze | mem mapping and zero-copy python fixes (#4212)
* | | | 55a3c2aff Alexandr Guzhva | Memory-mapping and Zero-copy deserializers (#4199)
* | | | 653be5938 Richard Barnes | Use `nullptr` in faiss/gpu/StandardGpuResources.cpp (#4232)
* | | | 3d96ad56a Lucian Grijincu | faiss: fix non-templated hammings function (#4195)
* | | | 4cd2f6e00 Junjie Qi | Support non-partition col and map in the embedding reader (#4229)
* | | | a22ec32dd Junjie Qi | Support cosine distance for training vectors (#4227)
* | | | c10917419 Richard Barnes | Fix LLVM-19 compilation issue in faiss/AutoTune.cpp (#4220)
* | | | 615c17ea2 Shuyao Qi | Add missing #include in code_distance-sve.h (#4219)
* | | | eab52af8e Tom Jackson | Fix cloning and reverse index factory for NSG indices (#4151)
* | | | 1a295cd54 George Wang | Remove python_abi to fix nightly (#4217)
* | | | 4cea80b41 Shuyao Qi | Make static method in header inline (#4214)
* | | | 835b3ea1b Michael Norris | Fix IVF quantizer centroid sharding so IDs are generated (#4197)
* | | | 65222b3ed Michael Norris | Pin lief to fix nightly (#4211)
* | | | 7cb455645 lkuffo | Fix Sapphire Rapids never loading in Python bindings (#4209)
* | | | 20c7ca35b Michael Norris | Upgrade openblas to 0.3.29 for ARM architectures (#4203)
* | | | 55d022fbb George Wang | Attempt to nightly fix (#4204)
* | | | 00ce0e218 Navneet Verma | Add the support for IndexIDMap with Cagra index (#4188)
* | | | 1fe8b8b5f Nicolas De Carli | Remove unused variable (#4205)
* | | | 6b652892f Divye Gala | Pass `store_dataset` argument along to cuVS CAGRA (#4173)
* | | | d72d0cab6 Michael Norris | Fix nightly by installing earlier version of lief (#4198)
* | | | 657c56360 Bhavik Sheth | Add bounds checking to hnsw nb_neighbors (#4185)
* | | | f0e383298 George Wang | Check for not completed
* | | | aff6bfcd8 Michael Norris | Add sharding convenience function for IVF indexes (#4150)
* | | | 1d8f3931a Kaival Parikh | Handle plain SearchParameters in HNSW searches (#4167)
* | | | c6adc013d Michael Norris | Update INSTALL.md to remove some raft references, add missing dependency (#4176)
* | | | 95955d850 Kota Yamaguchi | Fix install error when building avx512_spr variant (#4170)
* | | | d7201557f Amir Sadoughi | Update README.md (#4169)
* | | | 9896beb9f simshi | fix: gpu tests link failure with static lib (#4137)
* | | | 6c046992a Mulugeta Mammo | Fix the order of parameters in bench_scalar_quantizer_distance. (#4159)
* | | | 3ec2fbdf0 Tarang Jain | Update CAGRA docs (#4152)
* | | | 6718dae1b Kaival Parikh | Expose IDSelectorBitmap in the C_API (#4158)
* | | | 9bc4b6783 Jesper Stemann Andersen | Added support for building for MinGW, in addition to MSVC (#4145)
| |_|/
|/| |

stemann and others added 30 commits February 3, 2025 09:01
…search#4145)

Summary:
This PR enables building with GCC for Windows using MinGW, using a completely standard cmake procedure, e.g.,
```
cmake -B build -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} -DCMAKE_BUILD_TYPE=Release -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON -DFAISS_ENABLE_C_API=ON
```

as detailed in the build recipe for the Julia ecosystem at https://github.com/JuliaPackaging/Yggdrasil/blob/334df79335424690bdbb9bdc432bc65affa92c8e/F/Faiss/common.jl#L8-L64

Pull Request resolved: facebookresearch#4145

Reviewed By: asadoughi

Differential Revision: D68918508

Pulled By: mengdilin

fbshipit-source-id: 1f663cf52bf2c59e874111af84b5df4ededbba91
Summary: Pull Request resolved: facebookresearch#4158

Reviewed By: mnorris11

Differential Revision: D68901764

Pulled By: asadoughi

fbshipit-source-id: 5b5abf207947a62592ea48c32870e7060956a335
Summary:
Update CAGRA train and add docs to reflect current capabilities.

Pull Request resolved: facebookresearch#4152

Reviewed By: mnorris11

Differential Revision: D68901974

Pulled By: asadoughi

fbshipit-source-id: 2667466286a48f7ed76017388f8bbd880025afdd
…bookresearch#4159)

Summary:
I believe the order of the parameters was not intended to be that way. This PR fixes it.

Pull Request resolved: facebookresearch#4159

Reviewed By: mengdilin

Differential Revision: D69073195

Pulled By: junjieqi

fbshipit-source-id: bfb62aa7536deeda73bee32f2de3cd7a8142bb13
Summary:
# The bug
build gpu test with static lib failed undefined reference from gpu source code to cpu source, e.g.
`GpuAutoTune.cpp:(.text+0x3bc): undefined reference to 'typeinfo for faiss::Index'`

# build config:
`cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=ON -DFAISS_ENABLE_GPU=ON`
the link command would be like: `c++ -o faiss/gpu/test/TestCodePacking faiss/libfaiss.a -Wl,--push-state,--whole-archive  faiss/gpu/libfaiss_gpu.a  -Wl,--pop-state ...`
key point is linking to faiss_gpu after faiss which is a classic link order issue of "undefined reference"

# my fix:
make faiss_gpu an `OBJECT` library.

# Bouns
TestXXX files get small because '--whole-archive' propagated to test link command.

Pull Request resolved: facebookresearch#4137

Reviewed By: asadoughi

Differential Revision: D68639371

Pulled By: gtwang01

fbshipit-source-id: 1d482b4311f8e52de0d709b03348eae72c64c544
Summary:
Pull Request resolved: facebookresearch#4169

Point users to Github discussions page instead of Facebook group for release updates, Q&A, etc.

Reviewed By: mnorris11

Differential Revision: D69140649

fbshipit-source-id: 56c7ed54411063789ed56ffc6aa23ff6cc696ef3
…4170)

Summary:
Changes:
- Fix incorrect build target when `FAISS_OPT_LEVEL=avx512_spr`.

Resolves facebookresearch#4160

Pull Request resolved: facebookresearch#4170

Reviewed By: asadoughi

Differential Revision: D69165687

Pulled By: mnorris11

fbshipit-source-id: 696aee1d8110785abef974453287280cb24b86ca
…ncy (facebookresearch#4176)

Summary:
Pull Request resolved: facebookresearch#4176

For issue: facebookresearch#4175

Reproduce on CI by:

1. Update build-pull-request.yml and action.yml to only run `conda install -c pytorch -c nvidia -c rapidsai -c conda-forge faiss-gpu-cuvs`, and also start a tmate session.

2. Log into the host

3. `cd` to ~/miniconda3/bin. Try to import faiss. It fails

```
runner@fv-az802-878:~/miniconda3/bin$ ./python
Python 3.12.8 | packaged by conda-forge | (main, Dec  5 2024, 14:24:40) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import faiss
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/runner/miniconda3/lib/python3.12/site-packages/faiss/__init__.py", line 17, in <module>
    from .loader import *
  File "/home/runner/miniconda3/lib/python3.12/site-packages/faiss/loader.py", line 149, in <module>
    from .swigfaiss import *
  File "/home/runner/miniconda3/lib/python3.12/site-packages/faiss/swigfaiss.py", line 13, in <module>
    from . import _swigfaiss
ImportError: libnvJitLink.so.12: cannot open shared object file: No such file or directory
>>>
```

Reviewed By: asadoughi

Differential Revision: D69278685

fbshipit-source-id: 44c476c9ab3de5a43edb6da45cbb32a80df90160
Summary:
Add ability to search HNSW indexes using a plain [`SearchParameters`](https://github.com/facebookresearch/faiss/blob/6c046992a71e672df504a0101cddf6f2f2e90601/faiss/Index.h#L64-L69) object (i.e. only an [`IDSelector`](https://github.com/facebookresearch/faiss/blob/6c046992a71e672df504a0101cddf6f2f2e90601/faiss/Index.h#L66))

Issue: Currently if a plain `SearchParameters` is used to query an HNSW index, [an error is thrown](https://github.com/facebookresearch/faiss/blob/6c046992a71e672df504a0101cddf6f2f2e90601/faiss/IndexHNSW.cpp#L251) -- when the user's intent was only to filter some documents, and rely on index settings for remaining parameters (like `efSearch`, `check_relative_distance`, `search_bounded_queue`)

Motivation: Faiss provides an amazing [index factory](https://github.com/facebookresearch/faiss/wiki/The-index-factory) and [parameter setter](https://github.com/facebookresearch/faiss/wiki/Index-IO,-cloning-and-hyper-parameter-tuning) to abstract away internals of the index type and settings used, like:
```cpp
Index* index = index_factory(256, "HNSW32");
ParameterSpace().set_index_parameters(index, "efConstruction=200,efSearch=150");
```

Now if a user wants to perform a filtered search on this _opaque_ index using:
```cpp
SearchParameters parameters;
parameters.sel = new IDSelectorRange(10, 20);
index->search(nq, xq, k, d, id, &parameters);
```

they are met with an error:
```
faiss/IndexHNSW.cpp:251: Error: '!(params)' failed: params type invalid
```

An easy way to reproduce this issue is to replace `Flat` -> `HNSW` [here](https://github.com/facebookresearch/faiss/blob/6c046992a71e672df504a0101cddf6f2f2e90601/c_api/example_c.c#L60) and run `example_c` like:
```
make -C build example_c
./build/c_api/example_c
```

This PR allows passing a plain `SearchParameters` to HNSW indexes, and use index settings as a fallback

Pull Request resolved: facebookresearch#4167

Reviewed By: asadoughi

Differential Revision: D69312175

Pulled By: mnorris11

fbshipit-source-id: 63cc1deb6cb6116850cb3f8f7866eaa3a911ee48
)

Summary:
Pull Request resolved: facebookresearch#4150

Creates a sharding convenience function for IVF indexes.
- The __**centroids on the quantizer**__ are sharded based on the given sharding function. (not the data, as data sharding by ids is already implemented by copy_subuset_to, https://github.com/facebookresearch/faiss/blob/main/faiss/IndexIVF.h#L408)
- The output is written to files based on the template filename generator param.
- The default sharding function is simply the ith vector mod the total shard count.

This would called by Laser here: https://www.internalfb.com/code/fbsource/[ce1f2e028e79]/fbcode/fblearner/flow/projects/laser/laser_sim_search/knn_trainer.py?lines=295-296. This convenience function will do the file writing, and return the created file names.

There's a few key required changes in FAISS:
1. Allow `std::vector<std::string>` to be used. Updates swigfaiss.swig and array_conversions.py to accommodate. These have to be numpy dtype of `object` instead of the more correct `unicode`, because unicode dtype is fixed length. I couldn't figure out how to create a numpy array with each of the output file names where they have different dtypes. (Say the file names are like file1, file11, file111. The dtype would need to be U5, U6, U7 respectively, as the dtype for unicode contains the length). I tried structured arrays : this does not work either, as numpy makes it into a matrix instead: the `file1 file11 file111` example with explicit setting of U5, U6, U7 turns into `[[file1 file1 file1], [file1 file11 file11], [file1 file11 file111]]`, which we do not want. If someone knows the right syntax, please yell at me
2. Create Python callbacks for sharding and template filename: `PyCallbackFilenameTemplateGenerator` and `PyCallbackShardingFunction`. Users of this function would inherit from the FilenameTemplateGenerator or ShardingFunction in C++ to pass to `shard_ivf_index_centroids`. See the other examples in python_callbacks.cpp. This is required because Python functions cannot be passed through SWIG to C++ (i.e. no std::function or function pointers), so we have to use this approach. This approach allows it to be called from both C++ and Python. test_sharding.py shows the Python calling, test_utils.cpp shows the C++ calling.

Reviewed By: asadoughi

Differential Revision: D68534991

fbshipit-source-id: b857e20c6cc4249a2ab7792db4c93dd4fb8403fd
Summary:
Check for not completed rather than just in_progress, as runs can be queued, waiting, etc.
Fix due to failed nightly not retrying because retry build found it was "queued" instead of "in_progress"

Failed nightly: https://github.com/facebookresearch/faiss/actions/runs/13301645334/attempts/1
Retry that didn't trigger: https://github.com/facebookresearch/faiss/actions/runs/13301647044/job/37144032841

Reviewed By: mengdilin

Differential Revision: D69610422

fbshipit-source-id: a7a9b998bba160e8d1ba13c7ae2426d99125a7e8
Summary:
Pull Request resolved: facebookresearch#4185

Based on this users comment it seems like we should do bound checking: facebookresearch#4177

Reviewed By: mnorris11

Differential Revision: D69497295

fbshipit-source-id: 97025cf29c464afb0f85aa98f4b303489b7fc989
)

Summary:
Pull Request resolved: facebookresearch#4198

1. pins lief due to `AttributeError: type object 'CLASS' has no attribute 'CLASS64'` (just set it to last passing nightly version)
2. pins mkl in gpu builds due to it trying to pull in 2024.2.2 which conflicts with 2023 in the libfaiss.

Added nightlies to make sure they pass https://github.com/facebookresearch/faiss/actions/runs/13422430425/job/37498020894. Not all passed: I'm not sure the `build-pull-request / Linux x86_64 GPU w/ cuVS nightlies (CUDA 12.4.0)` nightly is actually broken, but this unblocks the PR builds for now.

Reviewed By: junjieqi

Differential Revision: D69860604

fbshipit-source-id: 2da623c71b03c22d581b78655253a863fbafd3ed
)

Summary:
This is required to enable lazy setting of a device copy of the training dataset to a cuVS CAGRA index.

Pull Request resolved: facebookresearch#4173

Reviewed By: mnorris11

Differential Revision: D69795662

Pulled By: gtwang01

fbshipit-source-id: 68cda198ed7983800b64d3e5fac1b77ff55ecd12
Summary:
Pull Request resolved: facebookresearch#4205

Removing unused variable.

This piece of code began to be compiled after armv9a has been set as default compilation profile

Reviewed By: andrewjcg

Differential Revision: D69946389

fbshipit-source-id: f2b5e57585506eb7cecbf76bf71bc6a2b5cc7133
Summary:
## Description
Add the support for adding vectors with ids when IndexIDMap is used with Cagra Index.

Resolves issue: facebookresearch#4107

Pull Request resolved: facebookresearch#4188

Reviewed By: mnorris11

Differential Revision: D69812544

Pulled By: gtwang01

fbshipit-source-id: 3c12c930e5d10ce214b12e68dacd63a644011b79
Summary:
Pull Request resolved: facebookresearch#4204

Fix for S492386

I found a slight difference between failing nightly: https://github.com/facebookresearch/faiss/actions/runs/13429138293/job/37523589618
And last succeeding nightly: https://github.com/facebookresearch/faiss/actions/runs/13301645334/job/37182266030

The mkl package in the last succeeding nightly is 2023.0.0, and it is 2023.2.0 in the failing nightly. Since mkl was recently causing trouble, I pin mkl to 2023.0.0 in this diff to match the las succeeding nightly.

Reviewed By: mnorris11

Differential Revision: D69937976

fbshipit-source-id: 0c4aba4322e26aa6a03bf3ea1dbee6ed7049092c
Summary:
Pull Request resolved: facebookresearch#4203

Related to issue: facebookresearch#4202

Reviewed By: mengdilin

Differential Revision: D69933126

fbshipit-source-id: cafc5f34d0f91450c5067827756b1297684b0ce3
…h#4209)

Summary:
If both `avx512` and `avx512_spr` are compiled, Sapphire Rapids capabilities are never loaded when using the Python bindings, as the `avx512` import always overrides the `avx512_spr` one.

This very small PR solves the issue.

Pull Request resolved: facebookresearch#4209

Reviewed By: mengdilin

Differential Revision: D70015045

Pulled By: gtwang01

fbshipit-source-id: d3553a6c9048a534c0901ee29e7e2354de96e79f
Summary: Pull Request resolved: facebookresearch#4211

Reviewed By: gtwang01

Differential Revision: D70102429

fbshipit-source-id: 68e265699448a825b82467064ca95742bd4e49c3
…earch#4197)

Summary:
Pull Request resolved: facebookresearch#4197

Ivan and I discussed 2 problems:
1. We may want to try to offload/shard PQ or SQ table data if there is a big enough win (pending)
2. IDs seem to be random after sharding.

This diff solves 2.

Root cause is that we add to quantizer without IDs.

Instead, we wrap in IndexIDMap2 (which provides reconstruction, whereas IndexIDMap does not).

Laser's quantizers are Flat and HNSW, so we can wrap like this.

Reviewed By: ivansopin

Differential Revision: D69832788

fbshipit-source-id: 331b6d1cf52666f5dac61e2b52302d46b0a83708
Summary:
Pull Request resolved: facebookresearch#4214

Got build failure with flags `[-Werror,-Wunneeded-internal-declaration]`
```
faiss/impl/code_distance/code_distance-sve.h:199:13
error: 'static' function 'distance_four_codes_sve_for_small_m' declared in header file should be declared 'static inline' [-Werror,-Wunneeded-internal-declaration]
```

Reviewed By: vit-ka

Differential Revision: D70279069

fbshipit-source-id: 28b5cc8394a9a508e25f72777f74de685d242dc4
Summary:
Pull Request resolved: facebookresearch#4217

liblief seemed to be causing issues in nightly: https://github.com/facebookresearch/faiss/actions/runs/13560151536/job/37908376889
Removing the pin while pinning conda-build resolves the issue.

Reviewed By: mnorris11

Differential Revision: D70344910

fbshipit-source-id: c19bfcf187714fbe36e549bfb007eb9787a011b6
…ch#4151)

Summary: Pull Request resolved: facebookresearch#4151

Reviewed By: junjieqi, asadoughi

Differential Revision: D68784260

fbshipit-source-id: a715b02fd18a59c393be3ccc9aa1a7be8b196cc8
Summary:
Pull Request resolved: facebookresearch#4219

`code_distance-sve.h` references `PQDecoder8` but doesn't include the header. The issue is revealed by D68784260 which removed some includes from a header that indirectly included `ProductQuantizer.h`

```
headers/faiss/impl/code_distance/code_distance-sve.h:74:45: error: unknown type name 'PQDecoder8'; did you mean 'PQDecoderT'?
       74 | std::enable_if_t<std::is_same_v<PQDecoderT, PQDecoder8>, float> inline distance_single_code_sve(
          |                                             ^~~~~~~~~~
          |                                             PQDecoderT
```

Reviewed By: ddrcoder

Differential Revision: D70433576

fbshipit-source-id: 12945b16003a3d6a995b18ffe9798179ecf826f4
…#4220)

Summary:
Pull Request resolved: facebookresearch#4220

LLVM-19 is incoming. This fixes an issue preventing it. Delays to previous platform upgrades cost $3M/week.

Reviewed By: dtolnay

Differential Revision: D70449926

fbshipit-source-id: 20e0882b9363670d6c010e1c7870cb04155a3a9d
Summary:
Pull Request resolved: facebookresearch#4227

same as title

Differential Revision: D70724590

fbshipit-source-id: 943648d9002b38ba967c254c8c7014fdc7ab3de8
…search#4229)

Summary:
Pull Request resolved: facebookresearch#4229

same as title

Differential Revision: D70728870

fbshipit-source-id: aeb817d80b20e5671c81ba88cdd05797cb070d23
Summary:
Pull Request resolved: facebookresearch#4195

Non-templated `hammings` call produced incorrect values.

`hammings` is called from `hamming_distance_table`, which in turn is unused so no impact.
https://www.internalfb.com/code/fbsource/[85684614381d9bdfaaa0bb4a42e244296e350848]/fbcode/faiss/IndexPQ.cpp?lines=439-446

Reviewed By: gtwang01

Differential Revision: D69613329

fbshipit-source-id: 5d02a99b04492a61ebf0134f0c1719eac86fbb4f
…#4232)

Summary:
Pull Request resolved: facebookresearch#4232

`nullptr` is preferable to `0` or `NULL`. Let's use it everywhere so we can enable `-Wzero-as-null-pointer-constant`.

 - If you approve of this diff, please use the "Accept & Ship" button :-)

Reviewed By: dtolnay

Differential Revision: D70818157

fbshipit-source-id: a46d64b6d80844f5246f7df236eb6ec54ce2886f
Michael Norris and others added 4 commits April 23, 2025 06:45
… in python (facebookresearch#4304)

Summary:
Pull Request resolved: facebookresearch#4304

can't use properly in notebooks without this: `index.code_size` will fail

Reviewed By: junjieqi

Differential Revision: D73482034

fbshipit-source-id: e523e4d44ea8fa7255c81bc2c23ad9e7ec3eec96
Summary:
facebookresearch#3374 has a typo, my local repo has the correct fixing (find it when sync from recent v1.10), the intended fixing is:

for example, if we have `n = 10`, and `nshards = 8`

- the original buggy code
  ```c++
  size_t shard_size = (n + nshards - 1) / nshards;
  // i.e.  shard_size = (10 + 8 - 1) / 8 = 2
  size_t i0 = idx * shard_size;
  // all i0: [0, 2, 4, 6, 8, 10, 12, 14], wrong!!! 14>n
  size_t ni = std::min(shard_size, n - i0);
  // all ni: [2, 2, 2, 2, 2, 0, -2, -4], wrong!!!
  ```

- should be:
  ```c++
  size_t base_shard_size = n / nshards;
  // i.e.  shard_size = 10 / 8 = 1
  size_t i0 = idx * base_shard_size + std::min(size_t(idx), n % nshards);
  // all i0: [0, 2, 4, 5, 6, 7, 8, 9]
  size_t ni = base_shard_size;
  if (idx < n % nshards) {
      ++ni;
  }
  // all ni: [2, 2, 1, 1, 1, 1, 1, 1]
  ```

Pull Request resolved: facebookresearch#4299

Reviewed By: junjieqi

Differential Revision: D73199869

Pulled By: mnorris11

fbshipit-source-id: 81cbb8284818212781978412262e91d7747f9b97
Summary:
Pull Request resolved: facebookresearch#4308

Increment to next release of Faiss, v1.11.0

Differential Revision: D73595484

fbshipit-source-id: bc065fa84ccdfbab8e6518e71d1ce8d7d8bd5bde
@abhinavdangeti abhinavdangeti changed the title Merge facebookresearch/faiss's v1.11.0 into fork's bleve branch Merge facebookresearch/faiss@v1.11.0 into blevesearch/faiss@bleve May 19, 2025
@abhinavdangeti
Copy link
Member Author

@deepkaran @ceejatec should we consider this to bump up the faiss version we use in morpheus to the latest v1.11.0?

@abhinavdangeti abhinavdangeti changed the title Merge facebookresearch/faiss@v1.11.0 into blevesearch/faiss@bleve MB-65243: Merge facebookresearch/faiss@v1.11.0 into blevesearch/faiss@bleve May 19, 2025
@abhinavdangeti abhinavdangeti added the uptake New release available at source label May 19, 2025
@ceejatec
Copy link

Should we merge this first to the toy git branch and update the cbdeps/faiss/toy.xml manifest to say VERSION=1.11.0 so we can test the changes?

@abhinavdangeti
Copy link
Member Author

@ceejatec Good idea. I've just overwritten the toy branch with this pull request.

@ceejatec
Copy link

@abhinavdangeti Please don't do that without also updating the manifest repository, otherwise the build versions won't match reality. I've pushed a change to the manifest repo now, so a new 1.11.0 build should come up soon.

@deepkaran
Copy link
Collaborator

Hey @abhinavdangeti , quick question - any particular features/fixes that come with this upgrade or is it a general upgrade to latest version?

@metonymic-smokey
Copy link

@deepkaran it brings in some utilities for binary vector indexes, which we want to experiment with.

@abhinavdangeti
Copy link
Member Author

abhinavdangeti commented May 20, 2025

@deepkaran For morpheus it's just a general upgrade to the latest version; For .next as you're aware @metonymic-smokey has been putting together supporting code to use binary indexes for which there've been some changes made upstream that we can leverage (specifically - SearchParameters).

@deepkaran
Copy link
Collaborator

@abhinavdangeti @metonymic-smokey thanks for the information. Sounds good.

@abhinavdangeti
Copy link
Member Author

abhinavdangeti commented May 20, 2025

@deepkaran @ceejatec I've run some limited testing with the toybuild and things seem ok - so if this commit looks ok to you, we can merge away.

@ceejatec
Copy link

I've proposed the corresponding manifest version update: https://review.couchbase.org/c/manifest/+/228059

Please merge both changes at the same time; thanks.

@abhinavdangeti abhinavdangeti merged commit b3d4e00 into bleve May 20, 2025
@abhinavdangeti abhinavdangeti deleted the main_1.11.0 branch May 20, 2025 21:36
@deepkaran
Copy link
Collaborator

Looks good from my side.

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

Labels

uptake New release available at source

Projects

None yet

Development

Successfully merging this pull request may close these issues.