roaring_bitmap.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
8 #include <cudf/column/column.hpp>
10 #include <cudf/types.hpp>
11 #include <cudf/utilities/export.hpp>
13 #include <cudf/utilities/span.hpp>
14 
15 #include <rmm/cuda_stream_view.hpp>
16 #include <rmm/resource_ref.hpp>
17 
18 #include <cuda/std/cstddef>
19 
20 #include <memory>
21 
22 namespace CUDF_EXPORT cudf {
23 
34 enum class roaring_bitmap_type : uint8_t {
35  BITS_32 = 0,
36  BITS_64 = 1
37 };
38 
54  public:
68  cudf::host_span<cuda::std::byte const> serialized_bitmap_data);
69 
74 
80  roaring_bitmap(roaring_bitmap&& other) noexcept;
81 
89 
90  roaring_bitmap(roaring_bitmap const&) = delete;
91 
92  roaring_bitmap& operator=(roaring_bitmap const&) = delete;
93 
102 
108  [[nodiscard]] roaring_bitmap_type type() const;
109 
115  [[nodiscard]] bool empty() const;
116 
122  [[nodiscard]] cuda::std::size_t size() const;
123 
129  [[nodiscard]] cuda::std::size_t size_bytes() const;
130 
144  [[nodiscard]] std::unique_ptr<cudf::column> contains_async(
145  cudf::column_view const& keys,
148 
163  cudf::mutable_column_view const& output,
164  rmm::cuda_stream_view stream) const;
165 
166  private:
168  class impl;
169  roaring_bitmap_type _type;
170  std::unique_ptr<impl> _impl;
171 };
172  // end of group
174 
175 } // namespace CUDF_EXPORT cudf
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
A non-owning, mutable view of device data as a column of elements, some of which may be null as indic...
A type-erased wrapper around cuco's roaring bitmap supporting both 32-bit and 64-bit keys.
cuda::std::size_t size_bytes() const
Returns the size of the serialized bitmap storage in bytes.
cuda::std::size_t size() const
Returns the number of keys stored in the bitmap.
roaring_bitmap & operator=(roaring_bitmap &&other) noexcept
Move assignment operator for the roaring bitmap class.
roaring_bitmap_type type() const
Returns the roaring bitmap type.
bool empty() const
Checks whether the bitmap contains no keys.
roaring_bitmap(roaring_bitmap_type type, cudf::host_span< cuda::std::byte const > serialized_bitmap_data)
Constructs a roaring_bitmap from serialized bitmap data (payload)
roaring_bitmap(roaring_bitmap &&other) noexcept
Move constructor for the roaring bitmap class.
std::unique_ptr< cudf::column > contains_async(cudf::column_view const &keys, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) const
Asynchronously queries the bitmap for membership of each key in the input column.
~roaring_bitmap()
Destructor for the roaring bitmap class.
void contains_async(cudf::column_view const &keys, cudf::mutable_column_view const &output, rmm::cuda_stream_view stream) const
Asynchronously queries the bitmap for membership of each key in a column and stores the result in the...
void materialize(rmm::cuda_stream_view stream=cudf::get_default_stream()) const
Materialize the underlying cuco roaring bitmap.
Class definition for cudf::column.
column view class definitions
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
rmm::device_async_resource_ref get_current_device_resource_ref()
Get the current device memory resource reference.
cuda::mr::resource_ref< cuda::mr::device_accessible > device_async_resource_ref
roaring_bitmap_type
Enumerates the supported roaring bitmap key types.
@ BITS_64
64-bit roaring bitmap (keys are uint64)
@ BITS_32
32-bit roaring bitmap (keys are uint32)
cuDF interfaces
Definition: host_udf.hpp:26
APIs for spans.
C++20 std::span with reduced feature set.
Definition: span.hpp:184
Type declarations for libcudf.