Skip to content

Commit

Permalink
addressing review 2/2
Browse files Browse the repository at this point in the history
  • Loading branch information
viclafargue committed Jul 12, 2023
1 parent 0f6cdbe commit cad88b3
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 66 deletions.
12 changes: 0 additions & 12 deletions cpp/include/raft/neighbors/ivf_flat-ext.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ void search(raft::resources const& handle,
raft::device_matrix_view<IdxT, IdxT, row_major> neighbors,
raft::device_matrix_view<float, IdxT, row_major> distances) RAFT_EXPLICIT;

template <typename T, typename IdxT>
void reconstruct_batch(raft::resources const& handle,
const index<T, IdxT>& index,
raft::device_vector_view<const IdxT, IdxT> vector_ids,
raft::device_matrix_view<T, IdxT, row_major> vector_out) RAFT_EXPLICIT;

template <typename T, typename IdxT>
void reconstruct_list_data(raft::resources const& handle,
const index<T, IdxT>& index,
Expand Down Expand Up @@ -198,12 +192,6 @@ instantiate_raft_neighbors_ivf_flat_search(uint8_t, int64_t);
#undef instantiate_raft_neighbors_ivf_flat_search

#define instantiate_raft_neighbors_ivf_flat_reconstruct(T, IdxT) \
extern template void raft::neighbors::ivf_flat::reconstruct_batch<T, IdxT>( \
raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& index, \
raft::device_vector_view<const IdxT, IdxT> vector_ids, \
raft::device_matrix_view<T, IdxT, row_major> vector_out); \
\
extern template void raft::neighbors::ivf_flat::reconstruct_list_data<T, IdxT>( \
raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& index, \
Expand Down
22 changes: 0 additions & 22 deletions cpp/include/raft/neighbors/ivf_flat-inl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -464,28 +464,6 @@ void search(raft::resources const& handle,
nullptr);
}

/**
* @brief Reconstruct vector database
*
*
* @tparam T data element type
* @tparam IdxT type of the indices
*
* @param[in] handle
* @param[in] index ivf-flat constructed index
* @param[in] vector_ids vector with the ids of vectors to look for
* @param[out] vector_out matrix with the database of vectors
*/
template <typename T, typename IdxT>
void reconstruct_batch(raft::resources const& handle,
const index<T, IdxT>& index,
raft::device_vector_view<const IdxT, IdxT> vector_ids,
raft::device_matrix_view<T, IdxT, row_major> vector_out)
{
return raft::neighbors::ivf_flat::detail::reconstruct_batch(
handle, index, vector_ids, vector_out);
}

/**
* @brief Reconstruct vectors of a given cluster
*
Expand Down
5 changes: 0 additions & 5 deletions cpp/include/raft_runtime/neighbors/ivf_flat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ namespace raft::runtime::neighbors::ivf_flat {
std::optional<raft::device_vector_view<const IdxT, IdxT>> new_indices, \
raft::neighbors::ivf_flat::index<T, IdxT>* idx); \
\
void reconstruct_batch(raft::resources const& handle, \
raft::neighbors::ivf_flat::index<T, IdxT>& idx, \
raft::device_vector_view<const IdxT, IdxT> vector_ids, \
raft::device_matrix_view<T, IdxT, row_major> vector_out); \
\
void reconstruct_list_data(raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& idx, \
device_matrix_view<T, IdxT, row_major> out_vectors, \
Expand Down
6 changes: 0 additions & 6 deletions cpp/src/neighbors/ivf_flat_reconstruct_float_int64_t.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
#include <raft/neighbors/ivf_flat-inl.cuh>

#define instantiate_raft_neighbors_ivf_flat_reconstruct(T, IdxT) \
template void raft::neighbors::ivf_flat::reconstruct_batch<T, IdxT>( \
raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& idx, \
raft::device_vector_view<const IdxT, IdxT> vector_ids, \
raft::device_matrix_view<T, IdxT, row_major> vector_out); \
\
template void raft::neighbors::ivf_flat::reconstruct_list_data<T, IdxT>( \
raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& idx, \
Expand Down
6 changes: 0 additions & 6 deletions cpp/src/neighbors/ivf_flat_reconstruct_int8_t_int64_t.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
#include <raft/neighbors/ivf_flat-inl.cuh>

#define instantiate_raft_neighbors_ivf_flat_reconstruct(T, IdxT) \
template void raft::neighbors::ivf_flat::reconstruct_batch<T, IdxT>( \
raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& idx, \
raft::device_vector_view<const IdxT, IdxT> vector_ids, \
raft::device_matrix_view<T, IdxT, row_major> vector_out); \
\
template void raft::neighbors::ivf_flat::reconstruct_list_data<T, IdxT>( \
raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& idx, \
Expand Down
6 changes: 0 additions & 6 deletions cpp/src/neighbors/ivf_flat_reconstruct_uint8_t_int64_t.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
#include <raft/neighbors/ivf_flat-inl.cuh>

#define instantiate_raft_neighbors_ivf_flat_reconstruct(T, IdxT) \
template void raft::neighbors::ivf_flat::reconstruct_batch<T, IdxT>( \
raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& idx, \
raft::device_vector_view<const IdxT, IdxT> vector_ids, \
raft::device_matrix_view<T, IdxT, row_major> vector_out); \
\
template void raft::neighbors::ivf_flat::reconstruct_list_data<T, IdxT>( \
raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& idx, \
Expand Down
8 changes: 0 additions & 8 deletions cpp/src/raft_runtime/neighbors/ivf_flat_build.cu
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ namespace raft::runtime::neighbors::ivf_flat {
raft::neighbors::ivf_flat::extend<T, IdxT>(handle, new_vectors, new_indices, idx); \
} \
\
void reconstruct_batch(raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& idx, \
raft::device_vector_view<const IdxT, IdxT> vector_ids, \
raft::device_matrix_view<T, IdxT, row_major> vector_out) \
{ \
raft::neighbors::ivf_flat::reconstruct_batch<T, IdxT>(handle, idx, vector_ids, vector_out); \
} \
\
void reconstruct_list_data(raft::resources const& handle, \
const raft::neighbors::ivf_flat::index<T, IdxT>& idx, \
device_matrix_view<T, IdxT, row_major> out_vectors, \
Expand Down
3 changes: 2 additions & 1 deletion cpp/test/neighbors/ann_ivf_flat.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <raft/core/logger.hpp>
#include <raft/distance/distance_types.hpp>
#include <raft/neighbors/ivf_flat.cuh>
#include <raft/neighbors/detail/ivf_flat_build.cuh>
#include <raft/random/rng.cuh>
#include <raft/spatial/knn/ann.cuh>
#include <raft/spatial/knn/knn.cuh>
Expand Down Expand Up @@ -286,7 +287,7 @@ class AnnIVFFlatTest : public ::testing::TestWithParam<AnnIvfFlatInputs<IdxT>> {
raft::make_device_vector_view<const IdxT, IdxT>(vecs_ids.data(), ps.num_db_vecs);
auto vectors_out =
raft::make_device_matrix<DataT, IdxT, row_major>(handle_, ps.num_db_vecs, ps.dim);
ivf_flat::reconstruct_batch(handle_, index, vectors_ids, vectors_out.view());
ivf_flat::detail::reconstruct_batch(handle_, index, vectors_ids, vectors_out.view());

resource::sync_stream(handle_);

Expand Down

0 comments on commit cad88b3

Please sign in to comment.