-
Notifications
You must be signed in to change notification settings - Fork 21
Provide GPU-accelerated vector indexes with RAFT #413
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
Draft
wphicks
wants to merge
30
commits into
RedisAI:main
Choose a base branch
from
wphicks:fea-raft_integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
b68d63e
Begin refactoring RAFT CMake configuration
wphicks 10093d3
Correct RAFT CMake configuration
wphicks 77a4971
Conditionally link to RAFT
wphicks a1aa366
Add configuration structs for RAFT indexes
wphicks bcef4c1
Add IVF index headers
wphicks 2ebcf93
Provide initial update of tiered RAFT index
wphicks 44d6b15
Update style
wphicks 418ecaa
Merge branch 'main' into fea-raft_integration
wphicks 1ed0cc9
Merge branch 'main' into fea-raft_integration
lowener 4d66fe8
Rename ivf, add factory
lowener dbe8bea
Fix add and searches
lowener 1d62824
Add size computation of tiered index
lowener 32ce6cc
Update tiered index
lowener f3cd7b1
Add CUDA_ARCHITECTURE for half type
lowener 28765de
Add Tiered index update and test
lowener 54b895c
Separate cuda code and flat/pq
lowener 1f99e55
Rework IVF, add stream manager, interface, benchmark
lowener 6bab5e3
Update Tiered vector ingestion
lowener d072d3a
Update Tiered index. Add vector deletion code
lowener cfa190b
Add search bitset filter
lowener 1726318
Add USE_CUDA guardrails for compilation
lowener 8ba3767
Fix style
lowener 2071218
Remaining USE_CUDA guards
lowener b735b20
Fix thread pool benchmark
lowener 0790982
USE_CUDA fix
lowener 4c90248
Fix compilation
lowener 7805aa1
Add ivfpq bench
lowener f8c02ef
Add test for Cosine and IP
lowener 45c510c
Update src/VecSim/algorithms/raft_ivf/ivf_tiered.h
lowener 21a7d20
Separate index Size
lowener File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
if(USE_CUDA) | ||
# Set which version of RAPIDS to use | ||
set(RAPIDS_VERSION 23.12) | ||
# Set which version of RAFT to use (defined separately for testing | ||
# minimal dependency changes if necessary) | ||
set(RAFT_VERSION "${RAPIDS_VERSION}") | ||
set(RAFT_FORK "rapidsai") | ||
set(RAFT_PINNED_TAG "branch-${RAPIDS_VERSION}") | ||
|
||
# Download CMake file for bootstrapping RAPIDS-CMake, a utility that | ||
# simplifies handling of complex RAPIDS dependencies | ||
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/RAPIDS.cmake) | ||
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION}/RAPIDS.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/RAPIDS.cmake) | ||
endif() | ||
include(${CMAKE_CURRENT_BINARY_DIR}/RAPIDS.cmake) | ||
|
||
# General tool for orchestrating RAPIDS dependencies | ||
include(rapids-cmake) | ||
# CPM helper functions with dependency tracking | ||
include(rapids-cpm) | ||
rapids_cpm_init() | ||
# Common CMake CUDA logic | ||
include(rapids-cuda) | ||
# Include required dependencies in Project-Config.cmake modules | ||
# include(rapids-export) TODO(wphicks) | ||
# Functions to find system dependencies with dependency tracking | ||
include(rapids-find) | ||
|
||
# Correctly handle supported CUDA architectures | ||
# (From rapids-cuda) | ||
rapids_cuda_init_architectures(VectorSimilarity) | ||
|
||
# Find system CUDA toolkit | ||
rapids_find_package(CUDAToolkit REQUIRED) | ||
|
||
set(RAFT_VERSION "${RAPIDS_VERSION}") | ||
set(RAFT_FORK "rapidsai") | ||
set(RAFT_PINNED_TAG "branch-${RAPIDS_VERSION}") | ||
|
||
function(find_and_configure_raft) | ||
set(oneValueArgs VERSION FORK PINNED_TAG COMPILE_LIBRARY) | ||
cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" | ||
"${multiValueArgs}" ${ARGN} ) | ||
|
||
set(RAFT_COMPONENTS "") | ||
if(PKG_COMPILE_LIBRARY) | ||
string(APPEND RAFT_COMPONENTS " compiled") | ||
endif() | ||
# Invoke CPM find_package() | ||
# (From rapids-cpm) | ||
rapids_cpm_find(raft ${PKG_VERSION} | ||
GLOBAL_TARGETS raft::raft | ||
BUILD_EXPORT_SET VectorSimilarity-exports | ||
INSTALL_EXPORT_SET VectorSimilarity-exports | ||
COMPONENTS ${RAFT_COMPONENTS} | ||
CPM_ARGS | ||
GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git | ||
GIT_TAG ${PKG_PINNED_TAG} | ||
SOURCE_SUBDIR cpp | ||
OPTIONS | ||
"BUILD_TESTS OFF" | ||
"BUILD_BENCH OFF" | ||
"RAFT_COMPILE_LIBRARY ${PKG_COMPILE_LIBRARY}" | ||
) | ||
if(raft_ADDED) | ||
message(VERBOSE "VectorSimilarity: Using RAFT located in ${raft_SOURCE_DIR}") | ||
else() | ||
message(VERBOSE "VectorSimilarity: Using RAFT located in ${raft_DIR}") | ||
endif() | ||
endfunction() | ||
|
||
# Change pinned tag here to test a commit in CI | ||
# To use a different RAFT locally, set the CMake variable | ||
# CPM_raft_SOURCE=/path/to/local/raft | ||
find_and_configure_raft(VERSION ${RAFT_VERSION}.00 | ||
FORK ${RAFT_FORK} | ||
PINNED_TAG ${RAFT_PINNED_TAG} | ||
COMPILE_LIBRARY OFF | ||
) | ||
endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,14 @@ class BruteForceIndex_Single : public BruteForceIndex<DataType, DistType> { | |
const AbstractIndexInitParams &abstractInitParams); | ||
~BruteForceIndex_Single(); | ||
|
||
void clear() override { | ||
this->labelToIdLookup.clear(); | ||
this->idToLabelMapping.clear(); | ||
this->idToLabelMapping.shrink_to_fit(); | ||
this->vectorBlocks.clear(); | ||
this->vectorBlocks.shrink_to_fit(); | ||
this->count = idType{}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
int addVector(const void *vector_data, labelType label, void *auxiliaryCtx = nullptr) override; | ||
int deleteVector(labelType label) override; | ||
int deleteVectorById(labelType label, idType id) override; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this->count = 0
?