null_mask.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #pragma once
6 
7 #include <cudf/types.hpp>
9 #include <cudf/utilities/export.hpp>
11 #include <cudf/utilities/span.hpp>
12 
13 #include <rmm/device_buffer.hpp>
14 
15 #include <vector>
16 
17 namespace CUDF_EXPORT cudf {
18 
37 
50 std::size_t bitmask_allocation_size_bytes(size_type number_of_bits,
51  std::size_t padding_boundary = 64);
52 
67 
80  size_type size,
81  mask_state state,
84 
99  size_type begin_bit,
100  size_type end_bit,
101  bool valid,
103 
122 [[deprecated]] void set_null_masks(cudf::host_span<bitmask_type*> bitmasks,
127 
148 
169 
188  bitmask_type const* mask,
189  size_type begin_bit,
190  size_type end_bit,
193 
207  column_view const& view,
210 
223 std::pair<rmm::device_buffer, size_type> bitmask_and(
224  table_view const& view,
227 
244 std::pair<std::vector<std::unique_ptr<rmm::device_buffer>>, std::vector<size_type>>
246  host_span<size_type const> segment_offsets,
249 
262 std::pair<rmm::device_buffer, size_type> bitmask_or(
263  table_view const& view,
266 
284  size_type start,
285  size_type stop,
286  rmm::cuda_stream_view stream = cudf::get_default_stream()); // end of group
288 } // 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 set of cudf::column_view's of the same size.
Definition: table_view.hpp:189
std::pair< std::vector< std::unique_ptr< rmm::device_buffer > >, std::vector< size_type > > segmented_bitmask_and(host_span< column_view const > colviews, host_span< size_type const > segment_offsets, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Performs segmented bitwise AND operations on the null masks of the input columns based on defined seg...
void set_null_masks_safe(cudf::host_span< bitmask_type * > bitmasks, cudf::host_span< size_type const > begin_bits, cudf::host_span< size_type const > end_bits, cudf::host_span< bool const > valids, rmm::cuda_stream_view stream=cudf::get_default_stream())
Sets a vector of non-overlapping pre-allocated bitmask buffers to given states in the corresponding r...
cudf::size_type null_count(bitmask_type const *bitmask, size_type start, size_type stop, rmm::cuda_stream_view stream=cudf::get_default_stream())
Given a validity bitmask, counts the number of null elements (unset bits) in the range [start,...
std::size_t bitmask_allocation_size_bytes(size_type number_of_bits, std::size_t padding_boundary=64)
Computes the required bytes necessary to represent the specified number of bits with a given padding ...
void set_null_masks(cudf::host_span< bitmask_type * > bitmasks, cudf::host_span< size_type const > begin_bits, cudf::host_span< size_type const > end_bits, cudf::host_span< bool const > valids, rmm::cuda_stream_view stream=cudf::get_default_stream())
Sets a vector of non-overlapping pre-allocated bitmask buffers to given states in the corresponding n...
size_type state_null_count(mask_state state, size_type size)
Returns the null count for a null mask of the specified state representing size elements.
rmm::device_buffer copy_bitmask(column_view const &view, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Copies view's bitmask from the bits [view.offset(), view.offset() + view.size()) into a device_buffer
rmm::device_buffer create_null_mask(size_type size, mask_state state, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Creates a device_buffer for use as a null value indicator bitmask of a column
std::pair< rmm::device_buffer, size_type > bitmask_or(table_view const &view, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Performs bitwise OR of the bitmasks of columns of a table. Returns a pair of resulting mask and count...
void set_null_mask(bitmask_type *bitmask, size_type begin_bit, size_type end_bit, bool valid, rmm::cuda_stream_view stream=cudf::get_default_stream())
Sets a pre-allocated bitmask buffer to a given state in the range [begin_bit, end_bit)
std::pair< rmm::device_buffer, size_type > bitmask_and(table_view const &view, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Performs bitwise AND of the bitmasks of columns of a table. Returns a pair of resulting mask and coun...
void set_null_masks_unsafe(cudf::host_span< bitmask_type * > bitmasks, cudf::host_span< size_type const > begin_bits, cudf::host_span< size_type const > end_bits, cudf::host_span< bool const > valids, rmm::cuda_stream_view stream=cudf::get_default_stream())
Sets a vector of non-overlapping pre-allocated bitmask buffers to given states in the corresponding n...
size_type num_bitmask_words(size_type number_of_bits)
Returns the number of bitmask_type words required to represent the specified number of bits.
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.
detail::cccl_async_resource_ref< cuda::mr::resource_ref< cuda::mr::device_accessible > > device_async_resource_ref
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:84
uint32_t bitmask_type
Bitmask type stored as 32-bit unsigned integer.
Definition: types.hpp:85
mask_state
Controls the allocation/initialization of a null mask.
Definition: types.hpp:170
cuDF interfaces
Definition: host_udf.hpp:26
APIs for spans.
C++20 std::span with reduced feature set.
Definition: span.hpp:182
Type declarations for libcudf.