Skip to content

Commit

Permalink
Use template instantiations in benchmarks as well.
Browse files Browse the repository at this point in the history
- move common -ext.cuh headers to raft_internal
- move .cu files back to src
  • Loading branch information
tfeher committed Mar 11, 2024
1 parent 1df5de7 commit 713951c
Show file tree
Hide file tree
Showing 32 changed files with 50 additions and 37 deletions.
8 changes: 8 additions & 0 deletions cpp/bench/prims/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ if(BUILD_PRIMS_BENCH)
bench/prims/neighbors/knn/ivf_pq_filter_float_int64_t.cu
bench/prims/neighbors/knn/ivf_pq_int8_t_int64_t.cu
bench/prims/neighbors/knn/ivf_pq_uint8_t_int64_t.cu
src/neighbors/detail/ivf_pq_search_filtering_float_int64_t.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_float_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_fp8_false_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_fp8_true_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_half_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_fp8_false_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_fp8_true_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_half_bitset64.cu
bench/prims/neighbors/refine_float_int64_t.cu
bench/prims/neighbors/refine_uint8_t_int64_t.cu
bench/prims/main.cpp
Expand Down
5 changes: 3 additions & 2 deletions cpp/bench/prims/neighbors/knn/ivf_pq_filter_float_int64_t.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,9 +14,10 @@
* limitations under the License.
*/

#undef RAFT_EXPLICIT_INSTANTIATE_ONLY // Enable instantiation of search with filter
#include "../knn.cuh"

#include <raft_internal/neighbors/ivf_pq_compute_similarity_filters_test-ext.cuh>
#include <raft_internal/neighbors/test/neighborsivf_pq_search_test-ext.cuh>
namespace raft::bench::spatial {

KNN_REGISTER(float, int64_t, ivf_pq_filter_knn, kInputsFilter, kNoCopyOnly, kScopeFull);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

#pragma once

#include "ivf_pq_compute_similarity_filters_test-ext.cuh"

#include <raft/core/device_mdspan.hpp> // raft::device_matrix_view
#include <raft/core/resources.hpp> // raft::resources
#include <raft/neighbors/ivf_pq.cuh>
#include <raft/neighbors/ivf_pq_types.hpp> // raft::neighbors::ivf_pq::index
#include <raft/neighbors/sample_filter.cuh>
#include <raft/neighbors/sample_filter_types.hpp>

#include <raft_internal/neighbors/ivf_pq_compute_similarity_filters_test-ext.cuh>

#include <cstdint> // int64_t

#define instantiate_raft_neighbors_ivf_pq_search(T, IdxT) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

#include "ivf_pq_compute_similarity_filters_test-ext.cuh"

#include <raft/core/device_mdspan.hpp> // raft::device_matrix_view
#include <raft/core/resources.hpp> // raft::resources
#include <raft/neighbors/ivf_pq-inl.cuh>
#include <raft/neighbors/ivf_pq_types.hpp> // raft::neighbors::ivf_pq::index
#include <raft/neighbors/sample_filter.cuh>
#include <raft/neighbors/sample_filter_types.hpp>

#include <raft_internal/neighbors/ivf_pq_compute_similarity_filters_test-ext.cuh>

#include <cstdint> // int64_t

#define instantiate_raft_neighbors_ivf_pq_search_with_filtering(T, IdxT, FilterT) \
Expand Down
44 changes: 22 additions & 22 deletions cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -403,28 +403,28 @@ if(BUILD_TESTS)
test/neighbors/ann_ivf_flat/test_uint8_t_int64_t.cu
test/neighbors/ann_ivf_pq/ivf_pq_build_float_uint32_t.cu
test/neighbors/ann_ivf_pq/ivf_pq_search_float_uint32_t.cu
test/neighbors/ann_ivf_pq/ivf_pq_search_filtering_float_int64_t.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_float_filt32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_fp8_false_filt32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_fp8_true_filt32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_half_filt32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_half_fp8_false_filt32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_half_fp8_true_filt32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_half_half_filt32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_float_bitset32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_fp8_false_bitset32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_fp8_true_bitset32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_half_bitset32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_half_fp8_false_bitset32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_half_fp8_true_bitset32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_half_half_bitset32.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_float_bitset64.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_fp8_false_bitset64.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_fp8_true_bitset64.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_float_half_bitset64.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_half_fp8_false_bitset64.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_half_fp8_true_bitset64.cu
test/neighbors/ann_ivf_pq/ivf_pq_compute_similarity_half_half_bitset64.cu
src/neighbors/detail/ivf_pq_search_filtering_float_int64_t.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_float_filt32.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_fp8_false_filt32.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_fp8_true_filt32.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_half_filt32.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_fp8_false_filt32.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_fp8_true_filt32.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_half_filt32.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_float_bitset32.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_fp8_false_bitset32.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_fp8_true_bitset32.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_half_bitset32.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_fp8_false_bitset32.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_fp8_true_bitset32.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_half_bitset32.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_float_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_fp8_false_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_fp8_true_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_float_half_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_fp8_false_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_fp8_true_bitset64.cu
src/neighbors/detail/ivf_pq_compute_similarity_half_half_bitset64.cu
test/neighbors/ann_ivf_pq/test_float_uint32_t.cu
test/neighbors/ann_ivf_pq/test_float_int64_t.cu
test/neighbors/ann_ivf_pq/test_int8_t_int64_t.cu
Expand Down
4 changes: 2 additions & 2 deletions cpp/test/neighbors/ann_ivf_pq/ivf_pq_search_float_uint32_t.cu
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

#include "ivf_pq_compute_similarity_filters_test-ext.cuh"

#include <raft/neighbors/ivf_pq-inl.cuh>
#include <raft/neighbors/ivf_pq_types.hpp> // raft::neighbors::ivf_pq::index
#include <raft/neighbors/sample_filter.cuh>

#include <raft_internal/neighbors/ivf_pq_compute_similarity_filters_test-ext.cuh>

#define instantiate_raft_neighbors_ivf_pq_search(T, IdxT) \
template void raft::neighbors::ivf_pq::search<T, IdxT>( \
raft::resources const& handle, \
Expand Down
5 changes: 3 additions & 2 deletions cpp/test/neighbors/ann_ivf_pq/test_filter_float_int64_t.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*/

#include "../ann_ivf_pq.cuh"
#include "ivf_pq_compute_similarity_filters_test-ext.cuh"
#include "ivf_pq_search_test-ext.cuh"

#include <raft_internal/neighbors/ivf_pq_compute_similarity_filters_test-ext.cuh>
#include <raft_internal/neighbors/ivf_pq_search_test-ext.cuh>

namespace raft::neighbors::ivf_pq {

Expand Down
5 changes: 3 additions & 2 deletions cpp/test/neighbors/ann_ivf_pq/test_filter_int8_t_int64_t.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*/

#include "../ann_ivf_pq.cuh"
#include "ivf_pq_compute_similarity_filters_test-ext.cuh"
#include "ivf_pq_search_test-ext.cuh"

#include <raft_internal/neighbors/ivf_pq_compute_similarity_filters_test-ext.cuh>
#include <raft_internal/neighbors/ivf_pq_search_test-ext.cuh>

namespace raft::neighbors::ivf_pq {

Expand Down
5 changes: 3 additions & 2 deletions cpp/test/neighbors/ann_ivf_pq/test_float_uint32_t.cu
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

#include "../ann_ivf_pq.cuh"
#include "ivf_pq_build_test-ext.cuh"
#include "ivf_pq_compute_similarity_filters_test-ext.cuh"
#include "ivf_pq_search_test-ext.cuh"

#include <raft_internal/neighbors/ivf_pq_compute_similarity_filters_test-ext.cuh>
#include <raft_internal/neighbors/ivf_pq_search_test-ext.cuh>

namespace raft::neighbors::ivf_pq {

Expand Down
3 changes: 2 additions & 1 deletion cpp/test/neighbors/ann_ivf_pq/test_int8_t_int64_t.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/

#include "../ann_ivf_pq.cuh"
#include "ivf_pq_search_test-ext.cuh"

#include <raft_internal/neighbors/ivf_pq_search_test-ext.cuh>
namespace raft::neighbors::ivf_pq {

using f32_i08_i64 = ivf_pq_test<float, int8_t, int64_t>;
Expand Down

0 comments on commit 713951c

Please sign in to comment.