Skip to content
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

Remove selection_faiss #2027

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove selection_faiss
Remove the selection_faiss instantiations. Since #1985, we haven't
been using the faiss select_k code and these aren't necessary anymore.
This should lead to a 70MB improvement in libraft.so binary size.

This also removes the raft::spatial::select_k code in favour of matrix::
select_k - the spatial version was marked deprecated, and didn't
switch between the best selection algorithms for the input size.
  • Loading branch information
benfred committed Nov 29, 2023
commit 6292fd7eba1f5c75806ee77058be6ee4ce598af2
10 changes: 0 additions & 10 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -372,16 +372,6 @@ if(RAFT_COMPILE_LIBRARY)
src/neighbors/detail/refine_host_float_float.cpp
src/neighbors/detail/refine_host_int8_t_float.cpp
src/neighbors/detail/refine_host_uint8_t_float.cpp
src/neighbors/detail/selection_faiss_int32_t_float.cu
src/neighbors/detail/selection_faiss_int_double.cu
src/neighbors/detail/selection_faiss_long_float.cu
src/neighbors/detail/selection_faiss_size_t_double.cu
src/neighbors/detail/selection_faiss_size_t_float.cu
src/neighbors/detail/selection_faiss_uint32_t_float.cu
src/neighbors/detail/selection_faiss_int64_t_double.cu
src/neighbors/detail/selection_faiss_int64_t_half.cu
src/neighbors/detail/selection_faiss_uint32_t_double.cu
src/neighbors/detail/selection_faiss_uint32_t_half.cu
src/neighbors/ivf_flat_build_float_int64_t.cu
src/neighbors/ivf_flat_build_int8_t_int64_t.cu
src/neighbors/ivf_flat_build_uint8_t_int64_t.cu
3 changes: 0 additions & 3 deletions cpp/bench/prims/matrix/select_k.cu
Original file line number Diff line number Diff line change
@@ -279,9 +279,6 @@ const static size_t MAX_MEMORY = 16 * 1024 * 1024 * 1024ULL;
SELECTION_REGISTER_ALGO_INPUT(KeyT, IdxT, kWarpDistributed, input) \
SELECTION_REGISTER_ALGO_INPUT(KeyT, IdxT, kWarpDistributedShm, input) \
} \
if (input.k <= raft::neighbors::detail::kFaissMaxK<IdxT, KeyT>()) { \
SELECTION_REGISTER_ALGO_INPUT(KeyT, IdxT, kFaissBlockSelect, input) \
} \
} \
}

1 change: 0 additions & 1 deletion cpp/include/raft/matrix/detail/select_k-inl.cuh
Original file line number Diff line number Diff line change
@@ -25,7 +25,6 @@
#include <raft/matrix/init.cuh>

#include <raft/core/resource/thrust_policy.hpp>
#include <raft/neighbors/detail/selection_faiss.cuh>
#include <rmm/cuda_stream_view.hpp>
#include <rmm/mr/device/device_memory_resource.hpp>
#include <thrust/scan.h>
67 changes: 0 additions & 67 deletions cpp/include/raft/neighbors/detail/selection_faiss-ext.cuh

This file was deleted.

163 changes: 0 additions & 163 deletions cpp/include/raft/neighbors/detail/selection_faiss-inl.cuh

This file was deleted.

24 changes: 0 additions & 24 deletions cpp/include/raft/neighbors/detail/selection_faiss.cuh

This file was deleted.

31 changes: 0 additions & 31 deletions cpp/include/raft/neighbors/detail/selection_faiss_helpers.cuh

This file was deleted.

19 changes: 9 additions & 10 deletions cpp/include/raft/sparse/neighbors/detail/knn.cuh
Original file line number Diff line number Diff line change
@@ -24,12 +24,12 @@
#include <raft/util/cuda_utils.cuh>
#include <raft/util/cudart_utils.hpp>

#include <raft/matrix/select_k.cuh>
#include <raft/sparse/coo.hpp>
#include <raft/sparse/csr.hpp>
#include <raft/sparse/detail/utils.h>
#include <raft/sparse/distance/distance.cuh>
#include <raft/sparse/op/slice.cuh>
#include <raft/spatial/knn/knn.cuh>

#include <algorithm>

@@ -365,15 +365,14 @@ class sparse_knn_t {
bool ascending = raft::distance::is_min_close(metric);

// kernel to slice first (min) k cols and copy into batched merge buffer
raft::spatial::knn::select_k(batch_dists,
batch_indices,
batch_rows,
batch_cols,
out_dists,
out_indices,
ascending,
n_neighbors,
resource::get_cuda_stream(handle));
raft::matrix::select_k<value_t, value_idx>(
handle,
make_device_matrix_view<const value_t, int64_t>(batch_dists, batch_rows, batch_cols),
make_device_matrix_view<const value_idx, int64_t>(batch_indices, batch_rows, batch_cols),
make_device_matrix_view<value_t, int64_t>(out_dists, batch_rows, n_neighbors),
make_device_matrix_view<value_idx, int64_t>(out_indices, batch_rows, n_neighbors),
ascending,
true);
}

void compute_distances(csr_batcher_t<value_idx, value_t>& idx_batcher,
Loading