facebookresearch / faiss

A library for efficient similarity search and clustering of dense vectors.
https://faiss.ai
MIT License
29.6k stars 3.49k forks source link

knn_gpu should use raft when raft is compiled in #3382

Open mdouze opened 2 months ago

mdouze commented 2 months ago

by default use_raft is set to false, see

https://github.com/facebookresearch/faiss/blob/main/faiss/python/gpu_wrappers.py#L59

It should be set to use_raft='auto' and decide at runtime using get_compile_options().

https://github.com/facebookresearch/faiss/blob/main/faiss/gpu/GpuIndex.cu#L532

mdouze commented 2 months ago

in fact the GpuDistanceParams.use_raft should be set to true by default when raft is used.

NB that

https://github.com/facebookresearch/faiss/blob/main/contrib/torch_utils.py#L496

does not support RAFT. Needs to be fixed as well.

mdouze commented 2 months ago

There may be a float16 bug. Also make sure there is good test coverage for GPU torch array + raft + float16.