Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
bedcf4c
first commit
tarang-jain Jul 9, 2025
09f9a22
Merge branch 'branch-25.08' of https://github.com/rapidsai/cuvs into …
tarang-jain Jul 9, 2025
51836d4
index header
tarang-jain Jul 9, 2025
23ef877
populate functions;ivf_list type;kmeans_predict
tarang-jain Jul 11, 2025
a7fce8e
Merge branch 'branch-25.08' of https://github.com/rapidsai/cuvs into …
tarang-jain Jul 11, 2025
6a98a88
hamming_op
tarang-jain Jul 12, 2025
76c9ee5
Merge branch 'branch-25.08' into binary-kmeans
tarang-jain Jul 12, 2025
916a4cf
rm binary_ivf
tarang-jain Jul 12, 2025
8ec4d59
Merge branch 'binary-kmeans' of https://github.com/tarang-jain/cuvs i…
tarang-jain Jul 12, 2025
1941b2e
modify ivf_flat_build
tarang-jain Jul 12, 2025
cd00b83
rm binary_ivf_flat
tarang-jain Jul 12, 2025
4cffe84
rm unused
tarang-jain Jul 12, 2025
2bc9007
updates
tarang-jain Jul 12, 2025
7803850
quantize
tarang-jain Jul 12, 2025
ff7be4a
cleanup
tarang-jain Jul 12, 2025
3149192
pre-commit
tarang-jain Jul 12, 2025
dd1b0d4
update kmeans_predict
tarang-jain Jul 12, 2025
2b9bef4
src kmeans
tarang-jain Jul 12, 2025
6ec32d8
style
tarang-jain Jul 12, 2025
5c59753
corrections to logic
tarang-jain Jul 14, 2025
2271809
clang
tarang-jain Jul 14, 2025
29388e9
testing
tarang-jain Jul 14, 2025
4a491cd
correct tests
tarang-jain Jul 14, 2025
4c27acd
binary_index flag
tarang-jain Jul 14, 2025
7085405
correct mdspan,reduction_op
tarang-jain Jul 14, 2025
2075bd0
Merge branch 'branch-25.08' into binary-kmeans
tarang-jain Jul 15, 2025
d06b4f5
correct checks
tarang-jain Jul 15, 2025
13de163
Merge branch 'branch-25.08' of https://github.com/rapidsai/cuvs into …
tarang-jain Jul 15, 2025
e79d520
Merge branch 'binary-kmeans' of https://github.com/tarang-jain/cuvs i…
tarang-jain Jul 15, 2025
c7f3ade
Merge branch 'branch-25.10' of https://github.com/rapidsai/cuvs into …
tarang-jain Jul 31, 2025
e7fdd4c
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Aug 1, 2025
3ce25af
fused-kernel
tarang-jain Aug 1, 2025
1f565ef
Merge branch 'binary-kmeans' of https://github.com/tarang-jain/cuvs i…
tarang-jain Aug 1, 2025
2c2a91d
cleeanup;syntax
tarang-jain Aug 1, 2025
b9a6a65
cleanup
tarang-jain Aug 1, 2025
0f19648
temp-fix-compilation-errors
tarang-jain Aug 1, 2025
2de4bcc
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Aug 5, 2025
f572e0b
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Aug 5, 2025
66d8b94
uint32_t for storing dists
tarang-jain Aug 6, 2025
46f9676
Merge branch 'branch-25.10' of https://github.com/rapidsai/cuvs into …
tarang-jain Aug 6, 2025
fa2193f
Merge branch 'binary-kmeans' of https://github.com/tarang-jain/cuvs i…
tarang-jain Aug 6, 2025
8f18ce0
no use_norms check
tarang-jain Aug 6, 2025
c7084ac
coarse search
tarang-jain Aug 6, 2025
1ca868b
debug; fix dim() error
tarang-jain Aug 6, 2025
42859fb
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Aug 6, 2025
f0597fa
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Aug 12, 2025
ca97da6
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Aug 25, 2025
8ad530b
Merge branch 'branch-25.10' of https://github.com/rapidsai/cuvs into …
tarang-jain Aug 26, 2025
17449e4
debug
tarang-jain Sep 2, 2025
f8e6e86
Merge branch 'branch-25.10' of https://github.com/rapidsai/cuvs into …
tarang-jain Sep 2, 2025
6aa2401
fix float underflow
tarang-jain Sep 4, 2025
d1717f5
rm new file
tarang-jain Sep 4, 2025
3b284cd
Merge branch 'branch-25.10' of https://github.com/rapidsai/cuvs into …
tarang-jain Sep 4, 2025
f34103d
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Sep 5, 2025
86a6593
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Sep 11, 2025
ef37c59
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Sep 15, 2025
5e794fe
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Sep 16, 2025
359d458
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Sep 16, 2025
d999591
Merge branch 'branch-25.10' into binary-kmeans
tarang-jain Sep 17, 2025
f242561
bug fixes
tarang-jain Sep 17, 2025
5517ae3
Merge branch 'binary-kmeans' of https://github.com/tarang-jain/cuvs i…
tarang-jain Sep 17, 2025
4aa2881
Merge branch 'branch-25.12' into binary-kmeans
tarang-jain Sep 25, 2025
b0d78b6
Merge branch 'branch-25.12' into binary-kmeans
tarang-jain Sep 26, 2025
184f025
Merge branch 'branch-25.12' into binary-kmeans
tarang-jain Sep 29, 2025
113e242
Merge branch 'branch-25.12' into binary-kmeans
tarang-jain Oct 6, 2025
540db62
correct fused instantiation
tarang-jain Oct 8, 2025
d9eed14
Merge branch 'binary-kmeans' of https://github.com/tarang-jain/cuvs i…
tarang-jain Oct 8, 2025
7ceed82
Merge branch 'branch-25.12' into binary-kmeans
tarang-jain Oct 9, 2025
ac261be
Merge branch 'branch-25.12' into binary-kmeans
tarang-jain Oct 10, 2025
b66b8ee
cleanup
tarang-jain Oct 13, 2025
4a19ec1
Merge branch 'binary-kmeans' of https://github.com/tarang-jain/cuvs i…
tarang-jain Oct 13, 2025
80d5f9c
Merge branch 'branch-25.12' of https://github.com/rapidsai/cuvs into …
tarang-jain Oct 13, 2025
d2b1184
Merge branch 'branch-25.12' of https://github.com/rapidsai/cuvs into …
tarang-jain Oct 15, 2025
ab1083e
Merge branch 'branch-25.12' into binary-kmeans
tarang-jain Oct 16, 2025
9a26624
thorough equivalence testing checkpoint
tarang-jain Oct 16, 2025
8a2098f
Merge branch 'binary-kmeans' of https://github.com/tarang-jain/cuvs i…
tarang-jain Oct 16, 2025
d4aae95
cleanup-1
tarang-jain Oct 16, 2025
f5c61dc
cleanup-2
tarang-jain Oct 16, 2025
54ae1a2
cleanup-3
tarang-jain Oct 16, 2025
76fc1f4
cleanup-4 (style
tarang-jain Oct 16, 2025
a8a3a0a
cleanup-6 tests
tarang-jain Oct 17, 2025
05363f5
cleanup-7 (tests)
tarang-jain Oct 17, 2025
de3bcc1
cleanup-8 tests
tarang-jain Oct 17, 2025
a02e563
cleanup-8 (tests)
tarang-jain Oct 17, 2025
b6181a0
cleanup-8 (tests)
tarang-jain Oct 17, 2025
5f640c1
use raft ci artifacts from pr
tarang-jain Oct 17, 2025
cc0fa18
wheels artifacts from raft pr
tarang-jain Oct 17, 2025
de606fa
style
tarang-jain Oct 17, 2025
385d8c7
shell stlye check
tarang-jain Oct 17, 2025
ae49732
Remove RAFT Dask channel from conda packages script
tarang-jain Oct 17, 2025
566b247
fix visible sections in simt_kernel
tarang-jain Oct 17, 2025
a24d13b
Merge branch 'branch-25.12' of https://github.com/rapidsai/cuvs into …
tarang-jain Oct 17, 2025
b4ea915
raft artifact for python build
tarang-jain Oct 17, 2025
34d2ec5
Merge branch 'branch-25.12' of https://github.com/rapidsai/cuvs into …
tarang-jain Oct 17, 2025
55b13d8
add skip flags
tarang-jain Oct 20, 2025
f44a7d8
Merge branch 'branch-25.12' of https://github.com/rapidsai/cuvs into …
tarang-jain Oct 20, 2025
942dc96
Merge branch 'main' into binary-kmeans
tarang-jain Oct 22, 2025
8d99bc7
set binary_index_ flag explicitly
tarang-jain Oct 22, 2025
5153555
Merge branch 'main' into binary-kmeans
tarang-jain Oct 22, 2025
ca41dc8
Merge branch 'main' of https://github.com/rapidsai/cuvs into binary-k…
tarang-jain Oct 25, 2025
182dadf
correct recall threshold
tarang-jain Oct 25, 2025
99eea8a
merge upstream
tarang-jain Oct 28, 2025
5220772
style and correct tests
tarang-jain Oct 28, 2025
5fc6f4b
rm extra test
tarang-jain Oct 28, 2025
37378d7
Merge branch 'main' into binary-kmeans
tarang-jain Oct 28, 2025
b948a33
rm test
tarang-jain Oct 28, 2025
c5e07b1
Merge branch 'binary-kmeans' of https://github.com/tarang-jain/cuvs i…
tarang-jain Oct 28, 2025
cbf83b8
Merge branch 'main' into binary-kmeans
tarang-jain Nov 4, 2025
c14f26f
Merge branch 'main' into binary-kmeans
tarang-jain Nov 7, 2025
b3eac6f
Merge branch 'main' into binary-kmeans
tarang-jain Nov 10, 2025
03a01a1
Merge branch 'main' into binary-kmeans
achirkin Nov 12, 2025
7b409c7
on the fly dataset expansion
tarang-jain Nov 26, 2025
080a5ea
Merge branch 'main' into binary-kmeans
tarang-jain Nov 26, 2025
107a3e4
address PR reviews
tarang-jain Nov 26, 2025
1caabeb
Merge branch 'binary-kmeans' of https://github.com/tarang-jain/cuvs i…
tarang-jain Nov 26, 2025
3681320
simplify bitwise_decode_op
tarang-jain Nov 26, 2025
118a3d7
commit suggestion
tarang-jain Nov 26, 2025
3399656
clang
tarang-jain Nov 26, 2025
d4fe3fe
Merge branch 'main' into binary-kmeans
tarang-jain Dec 2, 2025
653364e
merge upstream
tarang-jain Dec 3, 2025
ef34908
address reviews
tarang-jain Dec 3, 2025
d12a211
style
tarang-jain Dec 3, 2025
91c6734
undo ci changes
tarang-jain Dec 3, 2025
42f1bb7
fix kmeans mapping op
tarang-jain Dec 3, 2025
e59a357
other fixes to kmeans for binary data
tarang-jain Dec 3, 2025
d13c0c9
fix compilation errors
tarang-jain Dec 4, 2025
8162293
fix compilation
tarang-jain Dec 4, 2025
fcae247
fix compilation
tarang-jain Dec 4, 2025
a9599bd
doc
tarang-jain Dec 4, 2025
ffbcdcc
Merge branch 'main' of https://github.com/rapidsai/cuvs into binary-k…
tarang-jain Dec 4, 2025
3ffba85
simplify ivf-flat build
tarang-jain Dec 4, 2025
c0a99e2
fix compilation errors
tarang-jain Dec 5, 2025
dbb6423
bug fixes
tarang-jain Dec 5, 2025
248911c
debug
tarang-jain Dec 5, 2025
0656ee6
more corrections to kmeans
tarang-jain Dec 5, 2025
1423356
Merge branch 'main' into binary-kmeans
tarang-jain Dec 19, 2025
a25ddac
Merge branch 'main' into binary-kmeans
tarang-jain Dec 22, 2025
e8a8152
Merge branch 'main' of https://github.com/rapidsai/cuvs into binary-k…
tarang-jain Dec 23, 2025
8feebb8
bug fixes
tarang-jain Dec 23, 2025
997ddde
debug
tarang-jain Dec 24, 2025
89b54a1
working impl;rm debug statements
tarang-jain Dec 24, 2025
07354d1
rm debug prints:
tarang-jain Dec 24, 2025
07e1837
Merge branch 'main' into binary-kmeans
tarang-jain Dec 30, 2025
510bafd
Merge branch 'release/26.02' into binary-kmeans
tarang-jain Jan 20, 2026
0ddce5d
Merge branch 'release/26.02' into binary-kmeans
tarang-jain Jan 23, 2026
d546471
Merge branch 'release/26.02' into binary-kmeans
tarang-jain Jan 27, 2026
a2f5a8b
REL v26.02.00 release
AyodeAwe Feb 4, 2026
19cfe12
Merge branch 'release/26.02' into binary-kmeans
tarang-jain Mar 11, 2026
e143514
rebase
tarang-jain Mar 17, 2026
2505349
fix compilation
tarang-jain Mar 17, 2026
61ca5b7
Merge branch 'main' into binary-kmeans
tarang-jain Mar 17, 2026
18f0caf
Merge branch 'main' into binary-kmeans
tarang-jain Mar 17, 2026
11e91a6
merge upstream, resolve merge conflicts
tarang-jain May 29, 2026
c5f0252
Fix binary IVF correctness, persistence, and bindings
tarang-jain Oct 1, 2026
27b19a6
Merge upstream main into binary IVF fixes
tarang-jain Oct 1, 2026
7f27206
Merge branch 'main' into binary-kmeans
tarang-jain Oct 1, 2026
2f1fbc5
Keep binary IVF changes in the C++ API
tarang-jain Oct 1, 2026
1de4801
Fix packed k-means template compilation
tarang-jain Oct 1, 2026
1b94be6
Merge branch 'main' of https://github.com/rapidsai/cuvs into pr1099-s…
tarang-jain Oct 2, 2026
759f6e2
Export bitwise Hamming dispatch instantiation
tarang-jain Oct 2, 2026
6b184ab
Make dispatch export template formatter-safe
tarang-jain Oct 2, 2026
47cd1e5
Keep binary Hamming distance support scoped to IVF
tarang-jain Oct 2, 2026
ec879d9
Merge branch 'main' into binary-kmeans
tarang-jain Oct 3, 2026
f6d6959
Merge branch 'main' into binary-kmeans
tarang-jain Oct 5, 2026
ad45abe
Fix CAGRA test for balanced k-means centroid validation
tarang-jain Oct 5, 2026
9ea5739
Merge branch 'main' into fix/kmeans-balanced-centroid-count-cagra-600
tarang-jain Oct 5, 2026
a1e1861
fix style
tarang-jain Oct 5, 2026
33e5419
Merge fix/kmeans-balanced-centroid-count-cagra-600 into binary-kmeans
tarang-jain Oct 5, 2026
96147cd
Fix remaining CAGRA balanced k-means test inputs
tarang-jain Oct 6, 2026
939994b
Allow fixed-width IVF-PQ codebooks for small training sets
tarang-jain Oct 6, 2026
fe99276
Merge corrected balanced k-means fix into binary-kmeans
tarang-jain Oct 6, 2026
e977137
Restore small-dataset IVF-PQ CAGRA coverage
tarang-jain Oct 6, 2026
672ea9e
Merge restored IVF-PQ CAGRA coverage into binary-kmeans
tarang-jain Oct 6, 2026
b892dcc
Remove packed cosine norm handling
tarang-jain Oct 6, 2026
70e0746
Trim packed balanced k-means tests
tarang-jain Oct 6, 2026
6db88b9
Merge branch 'main' into binary-kmeans
tarang-jain Oct 6, 2026
1aa722d
Merge branch 'main' into binary-kmeans
tarang-jain Oct 7, 2026
64d103b
update docs
tarang-jain Oct 7, 2026
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
25 changes: 25 additions & 0 deletions cpp/include/cuvs/cluster/kmeans.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,19 @@ struct balanced_params : base_params {
* average cluster size; in that mode, `balance_upper_tolerance` does not control donor selection.
*/
balanced_donor_selection donor_selection = balanced_donor_selection::SizeSorted;

/**
* If true, treats uint8_t input data as bit-packed binary data where each byte contains 8 bits.
* Bits are expanded on-the-fly, least-significant bit first, to {-1, +1} floats
* during training and prediction. Other input types are rejected when this flag is set.
* When enabled:
* - Input data dimension represents packed dimension (actual_dim / 8)
* - Output centroids dimension is expanded (packed_dim * 8)
* - The metric operates on the expanded floating-point vectors (for example L2Expanded),
* not on the packed bytes; BitwiseHamming is not a balanced k-means training metric.
* - CosineExpanded is not supported.
*/
bool is_packed_binary = false;
};

/**
Expand Down Expand Up @@ -717,6 +730,12 @@ void fit(const raft::resources& handle,
/**
* @brief Find balanced clusters with k-means algorithm.
*
* @note When `params.is_packed_binary` is true, `X.extent(1)` counts packed bytes,
* and centroids must have `8 * X.extent(1)` floating-point coordinates. Bits are
* expanded least-significant bit first to {-1, +1}; the selected metric operates
* on those expanded vectors. CosineExpanded is not supported in packed binary mode.
* With the flag disabled, uint8_t values are numeric.
*
* @code{.cpp}
* #include <raft/core/resources.hpp>
* #include <cuvs/cluster/kmeans.hpp>
Expand Down Expand Up @@ -1215,6 +1234,12 @@ void predict(const raft::resources& handle,
/**
* @brief Predict the closest cluster each sample in X belongs to.
*
* @note When `params.is_packed_binary` is true, `X.extent(1)` counts packed bytes,
* and centroids must have `8 * X.extent(1)` floating-point coordinates. Bits are
* expanded least-significant bit first to {-1, +1}; the selected metric operates
* on those expanded vectors. CosineExpanded is not supported in packed binary mode.
* With the flag disabled, uint8_t values are numeric.
*
* @code{.cpp}
* #include <raft/core/resources.hpp>
* #include <cuvs/cluster/kmeans.hpp>
Expand Down
1 change: 1 addition & 0 deletions cpp/include/cuvs/detail/jit_lto/common_fragments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ struct tag_h {};
struct tag_d {};
struct tag_i8 {};
struct tag_u8 {};
struct tag_u32 {};
struct tag_filter_none {};
struct tag_filter_bitset {};
struct tag_filter_bloom_filter {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -16,6 +16,7 @@ struct tag_acc_u32 {};
// Tag types for distance metrics
struct tag_metric_euclidean {};
struct tag_metric_inner_product {};
struct tag_metric_bitwise_hamming {};
struct tag_metric_custom_udf {};

// Tag types for post-processing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -13,6 +13,7 @@ struct tag_layout_col {};
struct tag_fin_op_identity {};
struct tag_fin_op_rbf {};

struct tag_distance_bitwise_hamming {};
struct tag_distance_canberra {};
struct tag_distance_correlation {};
struct tag_distance_cosine {};
Expand Down
67 changes: 60 additions & 7 deletions cpp/include/cuvs/neighbors/ivf_flat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ struct index_params : cuvs::neighbors::index_params {
* from scratch after invoking (`ivf_flat::extend`) a few times with new data, the distribution of
* which is no longer representative of the original training set.
*
* The alternative behavior (adaptive_centers = true) is to update the cluster centers for new
* data when it is added. In this case, `index.centers()` are always exactly the centroids of the
* data in the corresponding clusters. The drawback of this behavior is that the centroids depend
* on the order of adding new data (through the classification of the added data); that is,
* `index.centers()` "drift" together with the changing distribution of the newly added data.
* The alternative behavior (adaptive_centers = true) is to update the cluster centers when new
* data is added. For BitwiseHamming, centers are packed bitwise majorities of the data in each
* cluster, with ties resolved to zero. For other metrics, centers are floating-point means of
* the data in each cluster. Cluster assignments and centers depend on the order of adding new
* data, so the centers drift with the changing distribution of the newly added data.
*/
bool adaptive_centers = false;
/**
Expand Down Expand Up @@ -208,10 +208,38 @@ struct index : cuvs::neighbors::index {
raft::device_vector_view<uint32_t, uint32_t> list_sizes() noexcept;
raft::device_vector_view<const uint32_t, uint32_t> list_sizes() const noexcept;

/** k-means cluster centers corresponding to the lists [n_lists, dim] */
/** Floating-point k-means centers [n_lists, dim]; empty for binary indexes. */
raft::device_matrix_view<float, uint32_t, raft::row_major> centers() noexcept;
raft::device_matrix_view<const float, uint32_t, raft::row_major> centers() const noexcept;

/**
* @brief Packed binary cluster centers, with `dim()` bytes per center.
* @return A mutable device view of shape [n_lists, dim], or an empty view for nonbinary indexes.
*/
raft::device_matrix_view<uint8_t, int64_t, raft::row_major> binary_centers() noexcept;

/**
* @brief Packed binary cluster centers, with `dim()` bytes per center.
* @return A read-only device view of shape [n_lists, dim], or an empty view for nonbinary
* indexes.
*/
raft::device_matrix_view<const uint8_t, int64_t, raft::row_major> binary_centers() const noexcept;

/**
* @brief Exact per-bit one-counts for adaptive binary centers.
* Together with list_sizes(), these retain majority statistics across extensions.
* @return A mutable device view of shape [n_lists, dim * 8], or an empty view when unused.
*/
raft::device_matrix_view<uint32_t, int64_t, raft::row_major> binary_center_counts() noexcept;

/**
* @brief Exact per-bit one-counts for adaptive binary centers.
* Together with list_sizes(), these retain majority statistics across extensions.
* @return A read-only device view of shape [n_lists, dim * 8], or an empty view when unused.
*/
raft::device_matrix_view<const uint32_t, int64_t, raft::row_major> binary_center_counts()
const noexcept;

/**
* (Optional) Precomputed norms of the `centers` w.r.t. the chosen distance metric [n_lists].
*
Expand All @@ -237,7 +265,10 @@ struct index : cuvs::neighbors::index {
/** Total length of the index. */
IdxT size() const noexcept;

/** Dimensionality of the data. */
/** Dimensionality of the data.
* @note For binary index, this returns the dimensionality of the byte dataset, which is the
* number of bits / 8.
*/
uint32_t dim() const noexcept;

/** Number of clusters/inverted lists. */
Expand All @@ -263,6 +294,9 @@ struct index : cuvs::neighbors::index {

void check_consistency();

/** Whether the index uses byte-packed vectors and BitwiseHamming distance. */
bool binary_index() const noexcept;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add Doxygen docs for the new public binary_index() API.

This new public method should include a complete Doxygen block (at least behavior/return semantics) to match the header documentation standard.

📝 Proposed doc update
+  /**
+   * `@brief` Indicates whether this index is configured for binary (BitwiseHamming) mode.
+   *
+   * `@return` true if binary centers are used; false otherwise.
+   */
   bool binary_index() const noexcept;

As per coding guidelines: cpp/include/cuvs/**/*.{hpp,h}: "All public API functions must include complete Doxygen documentation describing parameters, return values, and any side effects".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
bool binary_index() const noexcept;
/**
* `@brief` Indicates whether this index is configured for binary (BitwiseHamming) mode.
*
* `@return` true if binary centers are used; false otherwise.
*/
bool binary_index() const noexcept;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/include/cuvs/neighbors/ivf_flat.hpp` at line 273, Add a complete Doxygen
comment block for the public method binary_index() describing what the method
does, its return semantics (what true/false means), that it is noexcept, and any
side effects or invariants it relies on; update the declaration bool
binary_index() const noexcept; with a Doxygen block that includes a brief
description, a `@return` explaining the boolean meaning, and notes about
thread-safety or state changes if applicable to the IVF_FLAT index class.


private:
/**
* TODO: in theory, we can lift this to the template parameter and keep it at hardware maximum
Expand All @@ -275,7 +309,10 @@ struct index : cuvs::neighbors::index {
std::vector<std::shared_ptr<list_data<T, IdxT>>> lists_;
raft::device_vector<uint32_t, uint32_t> list_sizes_;
raft::device_matrix<float, uint32_t, raft::row_major> centers_;
raft::device_matrix<uint8_t, int64_t, raft::row_major> binary_centers_;
raft::device_matrix<uint32_t, int64_t, raft::row_major> binary_center_counts_;
std::optional<raft::device_vector<float, uint32_t>> center_norms_;
bool binary_index_;

// Computed members
raft::device_vector<T*, uint32_t> data_ptrs_;
Expand Down Expand Up @@ -310,6 +347,7 @@ struct index : cuvs::neighbors::index {
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Usage example:
* @code{.cpp}
Expand Down Expand Up @@ -339,6 +377,7 @@ auto build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Usage example:
* @code{.cpp}
Expand Down Expand Up @@ -369,6 +408,7 @@ void build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Usage example:
* @code{.cpp}
Expand Down Expand Up @@ -398,6 +438,7 @@ auto build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Usage example:
* @code{.cpp}
Expand Down Expand Up @@ -428,6 +469,7 @@ void build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Usage example:
* @code{.cpp}
Expand Down Expand Up @@ -457,6 +499,7 @@ auto build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Usage example:
* @code{.cpp}
Expand Down Expand Up @@ -487,6 +530,7 @@ void build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Usage example:
* @code{.cpp}
Expand Down Expand Up @@ -516,6 +560,7 @@ auto build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Usage example:
* @code{.cpp}
Expand Down Expand Up @@ -546,6 +591,7 @@ void build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Note, if index_params.add_data_on_build is set to true, the user can set a
* stream pool in the input raft::resource with at least one stream to enable kernel and copy
Expand Down Expand Up @@ -582,6 +628,7 @@ auto build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Note, if index_params.add_data_on_build is set to true, the user can set a
* stream pool in the input raft::resource with at least one stream to enable kernel and copy
Expand Down Expand Up @@ -619,6 +666,7 @@ void build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Note, if index_params.add_data_on_build is set to true, the user can set a
* stream pool in the input raft::resource with at least one stream to enable kernel and copy
Expand Down Expand Up @@ -655,6 +703,7 @@ auto build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Note, if index_params.add_data_on_build is set to true, the user can set a
* stream pool in the input raft::resource with at least one stream to enable kernel and copy
Expand Down Expand Up @@ -692,6 +741,7 @@ void build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Note, if index_params.add_data_on_build is set to true, the user can set a
* stream pool in the input raft::resource with at least one stream to enable kernel and copy
Expand Down Expand Up @@ -728,6 +778,7 @@ auto build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Note, if index_params.add_data_on_build is set to true, the user can set a
* stream pool in the input raft::resource with at least one stream to enable kernel and copy
Expand Down Expand Up @@ -765,6 +816,7 @@ void build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Note, if index_params.add_data_on_build is set to true, the user can set a
* stream pool in the input raft::resource with at least one stream to enable kernel and copy
Expand Down Expand Up @@ -801,6 +853,7 @@ auto build(raft::resources const& handle,
* - L2Unexpanded
* - InnerProduct
* - CosineExpanded
* - BitwiseHamming (uint8_t input only; dimensions are measured in packed bytes)
*
* Note, if index_params.add_data_on_build is set to true, the user can set a
* stream pool in the input raft::resource with at least one stream to enable kernel and copy
Expand Down
Loading
Loading