Commit Graph

12 Commits (21dfdbaaa0e30f2e16ad98ae4f94c2952e7178ce)

Author SHA1 Message Date
Xiao Fu 5e452ed52a Cleaning up more unnecessary print (#3455)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3455

Code quality control by reducing the number of prints

Reviewed By: junjieqi

Differential Revision: D57502194

fbshipit-source-id: a6cd65ed4cc49590ce73d2978d41b640b5259c17
2024-05-17 16:59:36 -07:00
Matthijs Douze 40e8643336 selector parameter for FastScan (#3362)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3362

Add test to Alex' PR

Reviewed By: junjieqi

Differential Revision: D56003946

fbshipit-source-id: 5a8a881d450bc97ae0777d73ce0ce8607ec6b686
2024-04-11 14:23:46 -07:00
Gergely Szilvasy 2817344f6f fix ACCESS VIOLATION error when searching using IDSelectorArray
Summary:
Fixes #3156

Metamate says: "This diff fixes an ACCESS VIOLATION error that occurs when searching using IDSelectorArray. The code changes include adding a new parameter to the knn_inner_products_by_idx and knn_L2sqr_by_idx functions in the distances.cpp file, as well as modifying the test_search_params.py file to test the bounds of the IDSelectorArray."

Reviewed By: mdouze

Differential Revision: D53185461

fbshipit-source-id: c7ec4783f77455684c078bba3aace160078f6c27
2024-01-29 23:08:45 -08:00
Gergely Szilvasy 90654d6011 benchmark core faiss prereqs
Summary:
1. Support `search_preassigned` in IVFFastScan
2. `try_extract_index_ivf` to search recursively and support `IndexRefine`
3. `get_InvertedListScanner` to fail where not available
4. Workaround an OpenMP issue with `IndexIVFSpectralHash`

Reviewed By: mdouze

Differential Revision: D51427241

fbshipit-source-id: 365e3f11d24e80f101f986fc358c28dcc00805fa
2023-11-28 11:50:03 -08:00
Matthijs Douze 69cb877683 Fix memory leak for ParameterSpace objects (#3007)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3007

There is a complicated interaction between SWIG and the python wrappers where the ownership of ParameterSpace arguments was stolen from Python.
This diff adds a test, fixes that behavior and fixes the referenced_objects construction

Reviewed By: mlomeli1

Differential Revision: D48404252

fbshipit-source-id: 8afa9e6c15d11451c27864223e33ed1187817224
2023-08-17 12:51:29 -07:00
Matthijs Douze b9ea339617 support range search from GPU (#2860)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2860

Optimized range search function where the GPU computes by default and falls back on gpu for queries where there are too many results.

Parallelize the CPU to GPU cloning, it seems to work.

Support range_search_preassigned in Python

Fix long-standing issue with SWIG exposed functions that did not release the GIL (in particular the MapLong2Long).

Adds a MapInt64ToInt64 that is more efficient than MapLong2Long.

Reviewed By: algoriddle

Differential Revision: D45672301

fbshipit-source-id: 2e77397c40083818584dbafa5427149359a2abfd
2023-05-16 00:27:53 -07:00
Matthijs Douze 3219e3d12e Support Selector for IDMap (#2848)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2848

Add selector support for IDMap wrapped indices.
Caveat: this requires to wrap the IDSelector with another selector. Since the params are const, the const is casted away.

This is a problem if the same params are used from multiple execution threads with different selectors. However, this seems rare enough to take the risk.

Reviewed By: alexanderguzhva

Differential Revision: D45598823

fbshipit-source-id: ec23465c13f1f8273a6a46f9aa869ccae2cdb79c
2023-05-08 15:06:22 -07:00
Kaelen Haag 1ee15ef3c3 Proposal IDSelectorCombination (#2742)
Summary:
Adds support for an IDSelector that takes in two IDSelectors and can perform a boolean operation on their is_member outcomes.

Current implementation is pretty naive and doesn't try to do any optimizations on the types of IDSelectors combined.

Also test cases are definitely lacking but can add more once approach is agreed upon.

Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2742

Reviewed By: algoriddle

Differential Revision: D43904855

Pulled By: mdouze

fbshipit-source-id: bbe687800a19b418ca30c9257fb0334c64ab5f52
2023-03-08 08:48:54 -08:00
Matthijs Douze 75bd1fcacc Scan exactly max_codes elements (#2647)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2647

The `max_codes` search parameter for IVF indexes limits the number of distance computations that are performed.
Previously, the number of distance computations could exceed max_codes because inverted lists were scanned completely.
This diff changed this to scan the beginning of the last inverted list to reach `max_codes` exactly.

Reviewed By: alexanderguzhva

Differential Revision: D42367593

fbshipit-source-id: 67c88b93a407ab271397e913c5fa17104f4274c3
2023-01-09 00:11:07 -08:00
Matthijs Douze af25054e2d support IDSelector in more classes (#2509)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2509

Adds support for:
- IDSelector for Flat and SQ
- search_type in SearchParametersPQ
- IDSelectors implemented in Python (slow but good for testing)

Start optimization of IDSelectorRange and IDSelectorArray for IndexFlat and IDSelectorRange for IndexIVF

Reviewed By: alexanderguzhva

Differential Revision: D40037795

fbshipit-source-id: 61e01acb43c6aa39fea2c3b67a8bba9072383b74
2022-10-06 23:03:23 -07:00
Matthijs Douze df9c49c335 fix windows compilation and test (#2505)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2505

the SearchParameters made the swig wrapper too long. This diff attempts to work around.

Reviewed By: alexanderguzhva

Differential Revision: D39998713

fbshipit-source-id: 6938b5ca1c64bdc748899407909f7e59f62c0de3
2022-10-03 01:42:16 -07:00
Matthijs Douze dd814b5f14 IVF filtering based on IDSelector (no init split) (#2483)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2483

This diff changes the following:
1. all search functions now take a `SearchParameters` argument that overrides the internal search parameters
2. the default implementation for most classes throws when the params argument is non-nullptr / non-None
3. the IndexIVF and IndexHNSW classes have functioning SearchPArameters
4. the SearchParameters includes an IDSelector that can search only in a subset of the index based on a defined subset of ids

There is also some refactoring: the IDSelector was moved to its own .h/.cpp and python/__init__.py is spit in parts.

The diff is quite bulky because the search function prototypes need to be changed in all index classes.

Things to fix in subsequent diffs:

- support SearchParameters for more index types (Flat variants)

- better sub-object ownership for SearchParams (with std::unique_ptr?)

- special handling of IDSelectorRange to make it faster

Reviewed By: alexanderguzhva

Differential Revision: D39852589

fbshipit-source-id: 4988bdb5b9bee1207cd327d3f80bf5e0e2467fe1
2022-09-30 06:40:03 -07:00