Skip to content

Conversation

lowener
Copy link

@lowener lowener commented May 15, 2023

Describe the changes in the pull request

This PR add support for RAFT-based index. IVF-Flat and IVF-PQ indexes will be added.
The main API change needed is the introduction of Batch vector addition (possibly through a VecSimIndex_AddVectorBatch function)

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Work still in progress

@CLAassistant
Copy link

CLAassistant commented May 15, 2023

CLA assistant check
All committers have signed the CLA.

@Spartee
Copy link

Spartee commented May 18, 2023

@lowener Thanks for much for putting this up! super excited. To run the tests can you sign the CLA? Let me know if you have and it's just not appearing.

@@ -0,0 +1,18 @@
# =============================================================================

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redis license

# or implied. See the License for the specific language governing permissions and limitations under
# the License.

if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/RAPIDS.cmake)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use cmake fetch content?

Comment on lines +28 to +32
include(rapids-cmake)
include(rapids-cpm)
include(rapids-cuda)
include(rapids-export)
include(rapids-find)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment about each specific include purpose

if (!flat_index_) {
flat_index_ = std::make_unique<raftIvfFlatIndex>(
raft::neighbors::ivf_flat::build<DataType, std::int64_t>(
res_, *build_params_flat_, raft::make_const_mdspan(vector_data_gpu.view())));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comments please

int RaftIVFIndex::addVectorBatch(const void *vector_data, labelType *labels, size_t batch_size,
bool overwrite_allowed) {
auto vector_data_gpu =
raft::make_device_matrix<DataType, std::int64_t>(res_, batch_size, this->dim);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain ifstd::int64_t is used for id or label?

return result_list;
}
auto vector_data_gpu =
raft::make_device_matrix<DataType, std::int64_t>(res_, queryParams->batchSize, this->dim);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

batchSize is misused here. It is used in our batch iterator for hybrid queries

this->ivf_index_->addVectorBatchGpuBuffer(vectorDataGpuBuffer.data_handle(),
labels_gpu.data_handle(),
nVectors);
updateIvfIndex = false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the flat buffer is copied to the IVF it should be flushed

@lowener lowener closed this Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants