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

[ENH] [4/5] Header structure: split search of ivf methods #1440

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d9801e8
MV: add -inl suffix to header paths
ahendriksen Apr 20, 2023
50b374d
MV: raft_runtime src files
ahendriksen Apr 13, 2023
8974ae3
FIX: add missing includes
ahendriksen Apr 20, 2023
95ef31b
FIX: getWorkspaceSize
ahendriksen Apr 20, 2023
7edcb6a
PREP: Separate rbf_fin_op
ahendriksen Apr 20, 2023
71de7bd
PREP: registers: Add _types header
ahendriksen Apr 20, 2023
541cabc
Change RAFT_COMPILED from INTERFACE to PUBLIC
ahendriksen Apr 20, 2023
d81b14e
Define RAFT_EXPLICIT and RAFT_EXPLICIT_INSTANTIATE_ONLY
ahendriksen Apr 20, 2023
48ea769
Update docs
ahendriksen Apr 20, 2023
e6bb5d5
Replace specializations by split headers
ahendriksen Apr 20, 2023
ff79abf
Deprecate specialization headers
ahendriksen Apr 20, 2023
c9e7413
Add interleaved scan instances
ahendriksen Apr 20, 2023
0c889dc
Separate fused_l2_nn_helpers
ahendriksen Apr 20, 2023
f97b2a8
Remove pairwise_matrix_instantiation_point
ahendriksen Apr 20, 2023
fb637f7
Rename specialization => instantiation
ahendriksen Apr 20, 2023
7b065af
test/neighbors/selection.cu: Expose kFaissMaxK
ahendriksen Apr 20, 2023
d5b5673
Remove includes of specialization headers
ahendriksen Apr 20, 2023
94d8117
test/distance/dist_adj.cu: Add instance
ahendriksen Apr 20, 2023
361570b
test/cluster/linkage.cu: Allow instance
ahendriksen Apr 20, 2023
5171de3
test/sparse/neighbors/connect_components.cu: Allow instance
ahendriksen Apr 20, 2023
4426c50
test/neighbors/ann_ivf_pq/test_float_uint32_t.cu: Allow instance
ahendriksen Apr 20, 2023
e527efc
test/matrix/select_k.cu: Change index type
ahendriksen Apr 20, 2023
17902e9
test/neighbors/fused_l2_knn.cu: Change index type
ahendriksen Apr 20, 2023
976189b
Force explicit instantiations in tests
ahendriksen Apr 20, 2023
bdae61d
Force explicit instantiations in benchmarks
ahendriksen Apr 20, 2023
b0b8fe5
Test that headers are free standing
ahendriksen Apr 20, 2023
7d1aa77
Split ivf-pq and ivf-flat search
ahendriksen Apr 20, 2023
b647aef
Make ivf_flat_search RAFT_EXPLICIT
ahendriksen Apr 26, 2023
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
7 changes: 7 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ if(RAFT_COMPILE_LIBRARY)
src/neighbors/detail/ivf_flat_interleaved_scan_int8_t_int32_t_int64_t.cu
src/neighbors/detail/ivf_flat_interleaved_scan_uint8_t_uint32_t_int64_t.cu
src/neighbors/detail/ivf_flat_search.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_float.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_fp8_false.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_fp8_true.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_half.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_fp8_false.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_fp8_true.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_half.cu
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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <cstdint> // uintX_t
#include <raft/neighbors/ivf_flat_types.hpp> // raft::neighbors::ivf_flat::index
#include <raft/util/raft_explicit.hpp> // RAFT_EXPLICIT
#include <rmm/cuda_stream_view.hpp> // rmm:cuda_stream_view

#ifdef RAFT_EXPLICIT_INSTANTIATE_ONLY

namespace raft::neighbors::ivf_flat::detail {

template <typename T, typename AccT, typename IdxT>
void ivfflat_interleaved_scan(const raft::neighbors::ivf_flat::index<T, IdxT>& index,
const T* queries,
const uint32_t* coarse_query_results,
const uint32_t n_queries,
const raft::distance::DistanceType metric,
const uint32_t n_probes,
const uint32_t k,
const bool select_min,
IdxT* neighbors,
float* distances,
uint32_t& grid_dim_x,
rmm::cuda_stream_view stream) RAFT_EXPLICIT;

} // namespace raft::neighbors::ivf_flat::detail

#endif // RAFT_EXPLICIT_INSTANTIATE_ONLY

#define instantiate_raft_neighbors_ivf_flat_detail_ivfflat_interleaved_scan(T, AccT, IdxT) \
extern template void raft::neighbors::ivf_flat::detail::ivfflat_interleaved_scan<T, AccT, IdxT>( \
const raft::neighbors::ivf_flat::index<T, IdxT>& index, \
const T* queries, \
const uint32_t* coarse_query_results, \
const uint32_t n_queries, \
const raft::distance::DistanceType metric, \
const uint32_t n_probes, \
const uint32_t k, \
const bool select_min, \
IdxT* neighbors, \
float* distances, \
uint32_t& grid_dim_x, \
rmm::cuda_stream_view stream)

instantiate_raft_neighbors_ivf_flat_detail_ivfflat_interleaved_scan(float, float, int64_t);
instantiate_raft_neighbors_ivf_flat_detail_ivfflat_interleaved_scan(int8_t, int32_t, int64_t);
instantiate_raft_neighbors_ivf_flat_detail_ivfflat_interleaved_scan(uint8_t, uint32_t, int64_t);

#undef instantiate_raft_neighbors_ivf_flat_detail_ivfflat_interleaved_scan
Loading