-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from RAFT to CUVS #3549
base: main
Are you sure you want to change the base?
Conversation
@asadoughi I was able to resolve the seg fault. It was related to some bugs in the cuvs parts of bfKnn. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tarang-jain , as discussed offline I added the changes required to get rid of additional overhead and achieve comparable performance of faiss+cuvs vs plain cuvs.
use cached device properties Co-authored-by: Malte Förster <97973773+mfoerste4@users.noreply.github.com>
…nto cuvs-migrate
@asadoughi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@@ -79,9 +79,9 @@ if(FAISS_ENABLE_GPU) | |||
endif() | |||
endif() | |||
|
|||
if(FAISS_ENABLE_RAFT AND NOT TARGET raft::raft) | |||
find_package(raft COMPONENTS compiled distributed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is RAFT still needed for compilation or we need to install rmm explicitly?
https://github.com/facebookresearch/faiss/actions/runs/10889999572/job/30218385769?pr=3549
The link interface of target "cuvs::cuvs" contains:
rmm::rmm
but the target was not found. Possible reasons include:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asadoughi I tried linking raft::raft
but now I see another failure in ci https://github.com/facebookresearch/faiss/actions/runs/10908718713/job/30275337629?pr=3549
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rmm and raft should ideally be available through cuvs. But I have also tried explicitly linking raft::raft
.
…nto cuvs-migrate
It looks like one test is still failing |
@asadoughi yes I have been looking into it. It is quite strange. The following order of operations gives erroneous results: However, if both the tensors are on the same device (either CPU or GPU), there is no failure and it works fine. |
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 exampleraft::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 againstraft::raft
orraft::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 ofraft
in FAISS.