Commit Graph

17 Commits (1ab077504849026d5cded9c4ccc917d3c4999fd6)

Author SHA1 Message Date
Tarang Jain 134922061c Migrate from RAFT to CUVS (#3549)
Summary:
Remove the dependency on `raft::compiled` and modify GPU implementations to use cuVS backend in place of RAFT.

A deeper insight into the dependency:
FAISS gets the ANN algorithm implementations such as IVF-Flat and IVF-PQ from cuVS. RAFT is meant to be a lightweight C++ header-only template library that cuVS relies on for the more fundamental / low-level utilities. Some examples of these are RAFT's device mdarray and mdspan objects; the RAFT resource object (`raft::resource`) that takes care of the stream ordering of device functions; linear algebra functions such as mapping, reduction, BLAS routines etc. A lot of the cuVS functions take the RAFT mdspan objects as arguments (for example `raft::device_matrix_view`). Therefore FAISS relies on both cuVS and RAFT. FAISS gets RAFT headers through cuVS and uses them to create the function arguments that can be consumed by cuVS. Note that we are not explicitly linking FAISS against `raft::raft` or `raft::compiled`. Only the required headers are included and compiled rather than compiling the whole RAFT shared library. This is the reason we still see mentions of `raft` in FAISS.

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

Reviewed By: ramilbakhshyiev

Differential Revision: D62041013

Pulled By: asadoughi

fbshipit-source-id: 7230dcc06cf47baf95873adc1dec2adca4a8f82a
2024-11-14 11:30:16 -08:00
Michael Norris eff0898a13 Enable linting: lint config changes plus arc lint command (#3966)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3966

This actually enables the linting.

Manual changes:
- tools/arcanist/lint/fbsource-licenselint-config.toml
- tools/arcanist/lint/fbsource-lint-engine.toml

Automated changes:
`arc lint --apply-patches --take LICENSELINT --paths-cmd 'hg files faiss'`

Reviewed By: asadoughi

Differential Revision: D64484165

fbshipit-source-id: 4f2f6e953c94ef6ebfea8a5ae035ccfbea65ed04
2024-10-22 09:46:48 -07:00
Michael Norris fd6d784114 Resolve "incorrect-portions-license" errors: add no license lint to top of GPU files with both licenses (#3965)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3965

End goal: add some lint to prevent files landing without any header. This creates churn for the oncall. Example is the last diff in this stack: D64488600

This is the first diff in enabling linting. I wanted the diff which updates all files to be just the automated command and the .toml config files changes, so this diff is a preparation step.

This particular diff solves: we get errors due to having both NVidia and FB license comment headers in the same files. See the errors in D64429711 under "linter-coverage-verification" signal.

Context on linting: https://fb.workplace.com/groups/lintqa/posts/3762373340693743/?comment_id=3762915930639484&reply_comment_id=3763044163959994

Per OSS, we cannot remove the Nvidia notice: https://fb.workplace.com/groups/osssupport/posts/27179779734977284/?comment_id=27181801724775085&reply_comment_id=27181818148106776

So, we add the lint ignore here.

Reviewed By: asadoughi

Differential Revision: D64481766

fbshipit-source-id: 0468104a095831cac7dd5bf3c519cfb5a2ee1575
2024-10-20 18:07:08 -07:00
Alexandr Guzhva 4d78137565 Place a useful cmake function 'link_to_faiss_lib' into a separate file (#3939)
Summary:
Add `cmake/link_to_faiss_lib.cmake`, which exposes a useful and reusable CMake `link_to_faiss_lib()` function

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

Reviewed By: mnorris11

Differential Revision: D64250261

Pulled By: mengdilin

fbshipit-source-id: bab5b7fab8effb33cb73024eb7eefd2319998e5b
2024-10-14 14:00:13 -07:00
Tarang Jain ab593745cb Update Pinned RAFT version (#3921)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3921

Reviewed By: pankajsingh88

Differential Revision: D64005877

Pulled By: ramilbakhshyiev

fbshipit-source-id: 663c7ab752db04751c7675095d2545adec4be173
2024-10-07 15:23:41 -07:00
Tarang Jain 27b1055cc6 Integrate IVF-PQ from RAFT (#3044)
Summary:
Imports changes from https://github.com/facebookresearch/faiss/issues/3133 and https://github.com/facebookresearch/faiss/issues/3171. So this single PR adds all the changes together.

- [x] Implement RaftIVFPQ class
- [x] Update gtests to test correctness with RAFT enabled
- [x] All googleTests for RAFT enabled IVFPQ pass
- [x] Move some common functions in RaftIVFFlat and RaftIVFPQ to helper: RaftUtils.h
- [x] update Quantizer retroactively after building RAFT index -- both IVFFlat and IVFPQ
- [x] resolve failing LargeBatch (classical GPU)
- [x] add checks for Pascal deprecation
- [x] apply RMM changes from https://github.com/facebookresearch/faiss/issues/3171
- [x] apply robertmaynard's changes from https://github.com/facebookresearch/faiss/issues/3133

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

Reviewed By: junjieqi

Differential Revision: D51074065

Pulled By: algoriddle

fbshipit-source-id: 6871257921bcaff2064a20637e2ed358acbdc363
2024-02-21 06:41:08 -08:00
Gergely Szilvasy 0c07a114ad fix raft contbuild and switch to libraft 23.12 (#3116)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3116

Test Plan: https://app.circleci.com/pipelines/github/facebookresearch/faiss/4839/workflows/cfd84a94-ca60-4128-96e6-db0f5afc69c4

Reviewed By: mdouze

Differential Revision: D50897934

Pulled By: algoriddle

fbshipit-source-id: 1422be39d640a2aec3ab6b4c68d3ef54900b5ba2
2023-11-01 14:37:21 -07:00
Corey J. Nolet edcf7438bb Integrate IVF-Flat from RAFT (#2521)
Summary:
This is a design proposal that demonstrates an approach to enabling optional support for [RAFT](https://github.com/rapidsai/raft) versions of IVF PQ and IVF Flat (and brute force w/ fused k-selection when k <= 64). There are still a few open issues and design discussions needed for the new RAFT index types to support the full range of features of that FAISS' current gpu index types.

Checklist for the integration todos:
- [x] Rebase on current `main` branch
- [X] The raft handle has been plugged directly into the StandardGpuResources
- [X] `FlatIndex` passing Googletests
- [x] Use `CodePacker` to support `copyFrom()` and `copyTo()`
- [X] `IVF-flat passing Googletests
- [ ] Raise appropriate exceptions for operations which are not yet supported by RAFT

Additional features we've discussed:
- [x] Separate IVF lists into individual memory chunks
- [ ] Saving/loading

To build FAISS w/ optional RAFT support:
```
mkdir build
cd build
cmake ../ -DFAISS_ENABLE_RAFT=ON -DFAISS_ENABLE_GPU=ON
make -j
```

For development/testing, we've also supplied a bash script to make things easier: `build.sh`

Below is a benchmark comparing the training of IVF Flat indices for RAFT and FAISS:
![image](https://user-images.githubusercontent.com/1242464/194944737-8b808f11-e28e-4556-82d1-1ea4b0707283.png)

The benchmark was produced using Googlebench in [this](https://github.com/tfeher/raft/tree/raft_faiss_bench) RAFT fork. We're going to provide benchmarks for the queries as well. There are still a couple bottlenecks to be removed in the IVF-Flat training implementation and we'll update the current benchmark when ready.

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

Test Plan: `buck test mode/debuck test mode/dev-nosan //faiss/gpu/test:test_gpu_index_ivfflat`

Reviewed By: algoriddle

Differential Revision: D49118319

Pulled By: mdouze

fbshipit-source-id: 5916108bc27154acf7c92021ba579a6ca85d730b
2023-10-04 23:42:30 -07:00
Gergely Szilvasy da16d9d3ca simplify raft build (#2983)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2983

Reviewed By: mdouze

Differential Revision: D48063550

Pulled By: algoriddle

fbshipit-source-id: c67e13cec97f4de8cc30cae47186593dbe0bdadb
2023-08-04 06:52:07 -07:00
Corey J. Nolet 7bf714928c Adding `libraft` dependency to speed up compile times with `USE_RAFT` (#2958)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2958

Reviewed By: mlomeli1, mdouze

Differential Revision: D47678341

Pulled By: algoriddle

fbshipit-source-id: 2ab2d0e8349498faa0fc59ac9800da29a201c766
2023-07-31 07:37:27 -07:00
Alexandr Guzhva 1fb696838e upgrade raft version to 23.06 (#2847)
Summary:
Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2847

Addresses https://github.com/facebookresearch/faiss/issues/2844

Reviewed By: algoriddle

Differential Revision: D45569204

fbshipit-source-id: 75c00ebb6d835107f8ba029b4e98ae247fff77a6
2023-05-04 10:23:46 -07:00
Corey J. Nolet 4f574d59b0 Integrate RAFT FlatIndex / Distances (#2707)
Summary:
I've broken out the FlatIndex / Distances changes from https://github.com/facebookresearch/faiss/issues/2521 into a separate PR to make things a litle easier to review. This does also include a couple other minor changes to the IVF Flat index which I used to make it easier to dispatch to the RAFT version. I can revert that change too if desired.

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

Reviewed By: wickedfoo

Differential Revision: D44758912

Pulled By: algoriddle

fbshipit-source-id: b2544990b4e941a2558f5004bceec4af4fa1ad09
2023-05-03 13:13:45 -07:00
Lucas Hosseini b7b261cad1 Move from TravisCI to CircleCI (#1315)
Summary:
Depends on https://github.com/facebookresearch/faiss/issues/1313.

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

Reviewed By: mdouze

Differential Revision: D23148557

Pulled By: beauby

fbshipit-source-id: 0a35f17d22aa04db6bd1c16cfc5ff8eee28f1f74
2020-08-15 04:00:51 -07:00
Lucas Hosseini a8e4c5e2d5 Move build to CMake (#1313)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1313

Reviewed By: mdouze

Differential Revision: D22948267

Pulled By: beauby

fbshipit-source-id: ec16fa0342f37672d46fb7886ecc55c7996011c4
2020-08-14 15:03:10 -07:00
Lucas Hosseini ac7005b6ef Remove CMake. (#645) 2018-12-23 18:45:16 +01:00
Adeykin c056f1d320 mkl support in cmake (#123) 2017-05-31 15:41:42 +02:00
Tianwei Shen 80314d9f07 add initial cmake support (#75)
* add initial cmake support

* update cmake, add cmake instructions to INSTALL

* update findopenmp and INSTALL

* change FindOpenBLAS.cmake to cater for macports

- change cblas.h to openblas_config.h since macports does not ship
cblas.h with openblas.

* revise INSTALL for cmake
2017-05-02 11:04:50 +02:00