Skip to content

Commit

Permalink
Add doc and bitmap
Browse files Browse the repository at this point in the history
  • Loading branch information
lowener committed Jan 13, 2025
1 parent 77a6657 commit 9187b07
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
24 changes: 20 additions & 4 deletions cpp/include/raft/core/bitmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,18 @@ struct bitmap_view : public bitset_view<bitmap_t, index_t> {
* @param bitmap_ptr Device raw pointer
* @param rows Number of row in the matrix.
* @param cols Number of col in the matrix.
* @param original_nbits Original number of bits used when the bitmap was created, to handle
* potential mismatches of data types. This is useful for using ANN indexes when a bitmap was
* originally created with a different data type than the ones currently supported in cuVS ANN
* indexes.
*/
_RAFT_HOST_DEVICE bitmap_view(bitmap_t* bitmap_ptr, index_t rows, index_t cols)
: bitset_view<bitmap_t, index_t>(bitmap_ptr, rows * cols), rows_(rows), cols_(cols)
_RAFT_HOST_DEVICE bitmap_view(bitmap_t* bitmap_ptr,
index_t rows,
index_t cols,
index_t original_nbits = 0)
: bitset_view<bitmap_t, index_t>(bitmap_ptr, rows * cols, original_nbits),
rows_(rows),
cols_(cols)
{
}

Expand All @@ -65,11 +74,18 @@ struct bitmap_view : public bitset_view<bitmap_t, index_t> {
* @param bitmap_span Device vector view of the bitmap
* @param rows Number of row in the matrix.
* @param cols Number of col in the matrix.
* @param original_nbits Original number of bits used when the bitmap was created, to handle
* potential mismatches of data types. This is useful for using ANN indexes when a bitmap was
* originally created with a different data type than the ones currently supported in cuVS ANN
* indexes.
*/
_RAFT_HOST_DEVICE bitmap_view(raft::device_vector_view<bitmap_t, index_t> bitmap_span,
index_t rows,
index_t cols)
: bitset_view<bitmap_t, index_t>(bitmap_span, rows * cols), rows_(rows), cols_(cols)
index_t cols,
index_t original_nbits = 0)
: bitset_view<bitmap_t, index_t>(bitmap_span, rows * cols, original_nbits),
rows_(rows),
cols_(cols)
{
}

Expand Down
14 changes: 13 additions & 1 deletion cpp/include/raft/core/bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ template <typename bitset_t = uint32_t, typename index_t = uint32_t>
struct bitset_view {
static constexpr index_t bitset_element_size = sizeof(bitset_t) * 8;

/**
* @brief Create a bitset view from a device pointer to the bitset.
*
* @param bitset_ptr Device pointer to the bitset
* @param bitset_len Number of bits in the bitset
* @param original_nbits Original number of bits used when the bitset was created, to handle
* potential mismatches of data types. This is useful for using ANN indexes when a bitset was
* originally created with a different data type than the ones currently supported in cuVS ANN
* indexes.
*/
_RAFT_HOST_DEVICE bitset_view(bitset_t* bitset_ptr,
index_t bitset_len,
index_t original_nbits = 0)
Expand All @@ -54,7 +64,9 @@ struct bitset_view {
* @param bitset_span Device vector view of the bitset
* @param bitset_len Number of bits in the bitset
* @param original_nbits Original number of bits used when the bitset was created, to handle
* potential mismatches of data types.
* potential mismatches of data types. This is useful for using ANN indexes when a bitset was
* originally created with a different data type than the ones currently supported in cuVS ANN
* indexes.
*/
_RAFT_HOST_DEVICE bitset_view(raft::device_vector_view<bitset_t, index_t> bitset_span,
index_t bitset_len,
Expand Down

0 comments on commit 9187b07

Please sign in to comment.