Skip to content

Commit

Permalink
Fix incorrect signature in cagra-q single-cta instances
Browse files Browse the repository at this point in the history
  • Loading branch information
achirkin committed Mar 13, 2024
1 parent 125b1b0 commit 4a13077
Show file tree
Hide file tree
Showing 49 changed files with 558 additions and 461 deletions.
59 changes: 30 additions & 29 deletions cpp/src/neighbors/detail/cagra/q_search_single_cta_00_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,41 @@
*/
#include <raft/neighbors/detail/cagra/search_single_cta_kernel-inl.cuh>
#include <raft/neighbors/detail/cagra/q.cuh>
#include <raft/neighbors/sample_filter_types.hpp>
#define COMMA ,
namespace raft::neighbors::cagra::detail::single_cta_search {
#define instantiate_single_cta_select_and_run( \\
TEAM_SIZE, MAX_DATASET_DIM, DATASET_DESC_T, SAMPLE_FILTER_T) \\
template void \\
select_and_run<TEAM_SIZE, MAX_DATASET_DIM, DATASET_DESC_T, SAMPLE_FILTER_T>( \\
DATASET_DESC_T dataset_desc, \\
raft::device_matrix_view<const typename DATASET_DESC_T::INDEX_T, int64_t, row_major> graph, \\
typename DATASET_DESC_T::INDEX_T* const topk_indices_ptr, \\
typename DATASET_DESC_T::DISTANCE_T* const topk_distances_ptr, \\
const typename DATASET_DESC_T::DATA_T* const queries_ptr, \\
const uint32_t num_queries, \\
const typename DATASET_DESC_T::INDEX_T* dev_seed_ptr, \\
uint32_t* const num_executed_iterations, \\
uint32_t topk, \\
uint32_t num_itopk_candidates, \\
uint32_t block_size, \\
uint32_t smem_size, \\
int64_t hash_bitlen, \\
typename DATASET_DESC_T::INDEX_T* hashmap_ptr, \\
size_t small_hash_bitlen, \\
size_t small_hash_reset_interval, \\
uint32_t num_random_samplings, \\
uint64_t rand_xor_mask, \\
uint32_t num_seeds, \\
size_t itopk_size, \\
size_t search_width, \\
size_t min_iterations, \\
size_t max_iterations, \\
SAMPLE_FILTER_T sample_filter, \\
#define instantiate_single_cta_select_and_run( \\
TEAM_SIZE, MAX_DATASET_DIM, DATASET_DESC_T, SAMPLE_FILTER_T) \\
template void \\
select_and_run<TEAM_SIZE, MAX_DATASET_DIM, DATASET_DESC_T, SAMPLE_FILTER_T>( \\
DATASET_DESC_T dataset_desc, \\
raft::device_matrix_view<const typename DATASET_DESC_T::INDEX_T, int64_t, row_major> graph, \\
typename DATASET_DESC_T::INDEX_T* topk_indices_ptr, \\
typename DATASET_DESC_T::DISTANCE_T* topk_distances_ptr, \\
const typename DATASET_DESC_T::DATA_T* queries_ptr, \\
const uint32_t num_queries, \\
const typename DATASET_DESC_T::INDEX_T* dev_seed_ptr, \\
uint32_t* num_executed_iterations, \\
uint32_t topk, \\
uint32_t num_itopk_candidates, \\
uint32_t block_size, \\
uint32_t smem_size, \\
int64_t hash_bitlen, \\
typename DATASET_DESC_T::INDEX_T* hashmap_ptr, \\
size_t small_hash_bitlen, \\
size_t small_hash_reset_interval, \\
uint32_t num_random_samplings, \\
uint64_t rand_xor_mask, \\
uint32_t num_seeds, \\
size_t itopk_size, \\
size_t search_width, \\
size_t min_iterations, \\
size_t max_iterations, \\
SAMPLE_FILTER_T sample_filter, \\
cudaStream_t stream);
"""
Expand Down Expand Up @@ -116,7 +117,7 @@
with open(path, "w") as f:
f.write(header)
f.write(
f"instantiate_single_cta_select_and_run(\n {team}, {mxdim}, raft::neighbors::cagra::detail::standard_dataset_descriptor_t<{data_t} COMMA {idx_t} COMMA 0 COMMA 0 COMMA {distance_t}>, raft::neighbors::filtering::none_cagra_sample_filter);\n"
f"instantiate_single_cta_select_and_run(\n {team}, {mxdim}, raft::neighbors::cagra::detail::cagra_q_dataset_descriptor_t<{data_t} COMMA {code_book_t} COMMA {pq_bit} COMMA {subspace_dim} COMMA 0 COMMA {distance_t} COMMA {idx_t} COMMA 0>, raft::neighbors::filtering::none_cagra_sample_filter);\n"
)

f.write(trailer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*
*/

#include <raft/neighbors/detail/cagra/q.cuh>
#include <raft/neighbors/detail/cagra/search_single_cta_kernel-inl.cuh>
#include <raft/neighbors/sample_filter_types.hpp>

Expand All @@ -36,12 +37,12 @@ namespace raft::neighbors::cagra::detail::single_cta_search {
template void select_and_run<TEAM_SIZE, MAX_DATASET_DIM, DATASET_DESC_T, SAMPLE_FILTER_T>( \
DATASET_DESC_T dataset_desc, \
raft::device_matrix_view<const typename DATASET_DESC_T::INDEX_T, int64_t, row_major> graph, \
typename DATASET_DESC_T::INDEX_T* const topk_indices_ptr, \
typename DATASET_DESC_T::DISTANCE_T* const topk_distances_ptr, \
const typename DATASET_DESC_T::DATA_T* const queries_ptr, \
typename DATASET_DESC_T::INDEX_T * topk_indices_ptr, \
typename DATASET_DESC_T::DISTANCE_T * topk_distances_ptr, \
const typename DATASET_DESC_T::DATA_T* queries_ptr, \
const uint32_t num_queries, \
const typename DATASET_DESC_T::INDEX_T* dev_seed_ptr, \
uint32_t* const num_executed_iterations, \
uint32_t* num_executed_iterations, \
uint32_t topk, \
uint32_t num_itopk_candidates, \
uint32_t block_size, \
Expand All @@ -60,11 +61,12 @@ namespace raft::neighbors::cagra::detail::single_cta_search {
SAMPLE_FILTER_T sample_filter, \
cudaStream_t stream);

instantiate_single_cta_select_and_run(32,
1024,
raft::neighbors::cagra::detail::standard_dataset_descriptor_t<
float COMMA uint32_t COMMA 0 COMMA 0 COMMA float>,
raft::neighbors::filtering::none_cagra_sample_filter);
instantiate_single_cta_select_and_run(
32,
1024,
raft::neighbors::cagra::detail::cagra_q_dataset_descriptor_t<
float COMMA half COMMA 8 COMMA 2 COMMA 0 COMMA float COMMA uint32_t COMMA 0>,
raft::neighbors::filtering::none_cagra_sample_filter);

#undef instantiate_single_cta_search_kernel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*
*/

#include <raft/neighbors/detail/cagra/q.cuh>
#include <raft/neighbors/detail/cagra/search_single_cta_kernel-inl.cuh>
#include <raft/neighbors/sample_filter_types.hpp>

Expand All @@ -36,12 +37,12 @@ namespace raft::neighbors::cagra::detail::single_cta_search {
template void select_and_run<TEAM_SIZE, MAX_DATASET_DIM, DATASET_DESC_T, SAMPLE_FILTER_T>( \
DATASET_DESC_T dataset_desc, \
raft::device_matrix_view<const typename DATASET_DESC_T::INDEX_T, int64_t, row_major> graph, \
typename DATASET_DESC_T::INDEX_T* const topk_indices_ptr, \
typename DATASET_DESC_T::DISTANCE_T* const topk_distances_ptr, \
const typename DATASET_DESC_T::DATA_T* const queries_ptr, \
typename DATASET_DESC_T::INDEX_T * topk_indices_ptr, \
typename DATASET_DESC_T::DISTANCE_T * topk_distances_ptr, \
const typename DATASET_DESC_T::DATA_T* queries_ptr, \
const uint32_t num_queries, \
const typename DATASET_DESC_T::INDEX_T* dev_seed_ptr, \
uint32_t* const num_executed_iterations, \
uint32_t* num_executed_iterations, \
uint32_t topk, \
uint32_t num_itopk_candidates, \
uint32_t block_size, \
Expand All @@ -60,11 +61,12 @@ namespace raft::neighbors::cagra::detail::single_cta_search {
SAMPLE_FILTER_T sample_filter, \
cudaStream_t stream);

instantiate_single_cta_select_and_run(32,
1024,
raft::neighbors::cagra::detail::standard_dataset_descriptor_t<
float COMMA uint32_t COMMA 0 COMMA 0 COMMA float>,
raft::neighbors::filtering::none_cagra_sample_filter);
instantiate_single_cta_select_and_run(
32,
1024,
raft::neighbors::cagra::detail::cagra_q_dataset_descriptor_t<
float COMMA half COMMA 8 COMMA 4 COMMA 0 COMMA float COMMA uint32_t COMMA 0>,
raft::neighbors::filtering::none_cagra_sample_filter);

#undef instantiate_single_cta_search_kernel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*
*/

#include <raft/neighbors/detail/cagra/q.cuh>
#include <raft/neighbors/detail/cagra/search_single_cta_kernel-inl.cuh>
#include <raft/neighbors/sample_filter_types.hpp>

Expand All @@ -36,12 +37,12 @@ namespace raft::neighbors::cagra::detail::single_cta_search {
template void select_and_run<TEAM_SIZE, MAX_DATASET_DIM, DATASET_DESC_T, SAMPLE_FILTER_T>( \
DATASET_DESC_T dataset_desc, \
raft::device_matrix_view<const typename DATASET_DESC_T::INDEX_T, int64_t, row_major> graph, \
typename DATASET_DESC_T::INDEX_T* const topk_indices_ptr, \
typename DATASET_DESC_T::DISTANCE_T* const topk_distances_ptr, \
const typename DATASET_DESC_T::DATA_T* const queries_ptr, \
typename DATASET_DESC_T::INDEX_T * topk_indices_ptr, \
typename DATASET_DESC_T::DISTANCE_T * topk_distances_ptr, \
const typename DATASET_DESC_T::DATA_T* queries_ptr, \
const uint32_t num_queries, \
const typename DATASET_DESC_T::INDEX_T* dev_seed_ptr, \
uint32_t* const num_executed_iterations, \
uint32_t* num_executed_iterations, \
uint32_t topk, \
uint32_t num_itopk_candidates, \
uint32_t block_size, \
Expand All @@ -60,11 +61,12 @@ namespace raft::neighbors::cagra::detail::single_cta_search {
SAMPLE_FILTER_T sample_filter, \
cudaStream_t stream);

instantiate_single_cta_select_and_run(8,
128,
raft::neighbors::cagra::detail::standard_dataset_descriptor_t<
float COMMA uint32_t COMMA 0 COMMA 0 COMMA float>,
raft::neighbors::filtering::none_cagra_sample_filter);
instantiate_single_cta_select_and_run(
8,
128,
raft::neighbors::cagra::detail::cagra_q_dataset_descriptor_t<
float COMMA half COMMA 8 COMMA 2 COMMA 0 COMMA float COMMA uint32_t COMMA 0>,
raft::neighbors::filtering::none_cagra_sample_filter);

#undef instantiate_single_cta_search_kernel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*
*/

#include <raft/neighbors/detail/cagra/q.cuh>
#include <raft/neighbors/detail/cagra/search_single_cta_kernel-inl.cuh>
#include <raft/neighbors/sample_filter_types.hpp>

Expand All @@ -36,12 +37,12 @@ namespace raft::neighbors::cagra::detail::single_cta_search {
template void select_and_run<TEAM_SIZE, MAX_DATASET_DIM, DATASET_DESC_T, SAMPLE_FILTER_T>( \
DATASET_DESC_T dataset_desc, \
raft::device_matrix_view<const typename DATASET_DESC_T::INDEX_T, int64_t, row_major> graph, \
typename DATASET_DESC_T::INDEX_T* const topk_indices_ptr, \
typename DATASET_DESC_T::DISTANCE_T* const topk_distances_ptr, \
const typename DATASET_DESC_T::DATA_T* const queries_ptr, \
typename DATASET_DESC_T::INDEX_T * topk_indices_ptr, \
typename DATASET_DESC_T::DISTANCE_T * topk_distances_ptr, \
const typename DATASET_DESC_T::DATA_T* queries_ptr, \
const uint32_t num_queries, \
const typename DATASET_DESC_T::INDEX_T* dev_seed_ptr, \
uint32_t* const num_executed_iterations, \
uint32_t* num_executed_iterations, \
uint32_t topk, \
uint32_t num_itopk_candidates, \
uint32_t block_size, \
Expand All @@ -60,11 +61,12 @@ namespace raft::neighbors::cagra::detail::single_cta_search {
SAMPLE_FILTER_T sample_filter, \
cudaStream_t stream);

instantiate_single_cta_select_and_run(8,
128,
raft::neighbors::cagra::detail::standard_dataset_descriptor_t<
float COMMA uint32_t COMMA 0 COMMA 0 COMMA float>,
raft::neighbors::filtering::none_cagra_sample_filter);
instantiate_single_cta_select_and_run(
8,
128,
raft::neighbors::cagra::detail::cagra_q_dataset_descriptor_t<
float COMMA half COMMA 8 COMMA 4 COMMA 0 COMMA float COMMA uint32_t COMMA 0>,
raft::neighbors::filtering::none_cagra_sample_filter);

#undef instantiate_single_cta_search_kernel

Expand Down
Loading

0 comments on commit 4a13077

Please sign in to comment.