roaring_bitmap.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
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 #include <span>
22 
23 namespace CUDF_EXPORT cudf {
24 
35 enum class roaring_bitmap_type : uint8_t {
36  BITS_32 = 0,
37  BITS_64 = 1
38 };
39 
55  public:
69  std::span<cuda::std::byte const> serialized_bitmap_data);
70 
75 
81  roaring_bitmap(roaring_bitmap&& other) noexcept;
82 
90 
91  roaring_bitmap(roaring_bitmap const&) = delete;
92 
93  roaring_bitmap& operator=(roaring_bitmap const&) = delete;
94 
103 
109  [[nodiscard]] roaring_bitmap_type type() const;
110 
116  [[nodiscard]] bool empty() const;
117 
123  [[nodiscard]] cuda::std::size_t size() const;
124 
130  [[nodiscard]] cuda::std::size_t size_bytes() const;
131 
145  [[nodiscard]] std::unique_ptr<cudf::column> contains_async(
146  cudf::column_view const& keys,
149 
164  cudf::mutable_column_view const& output,
165  rmm::cuda_stream_view stream) const;
166 
167  private:
169  class impl;
170  roaring_bitmap_type _type;
171  std::unique_ptr<impl> _impl;
172 };
173  // end of group
175 
176 } // 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 &&other) noexcept
Move constructor for the roaring bitmap class.
roaring_bitmap(roaring_bitmap_type type, std::span< cuda::std::byte const > serialized_bitmap_data)
Constructs a roaring_bitmap from serialized bitmap data (payload)
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.
Type declarations for libcudf.