null_mask.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2024, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include <cudf/types.hpp>
20 #include <cudf/utilities/span.hpp>
21 
22 #include <rmm/device_buffer.hpp>
23 #include <rmm/mr/device/per_device_resource.hpp>
24 #include <rmm/resource_ref.hpp>
25 
26 #include <vector>
27 
28 namespace cudf {
29 
48 
61 std::size_t bitmask_allocation_size_bytes(size_type number_of_bits,
62  std::size_t padding_boundary = 64);
63 
78 
90 rmm::device_buffer create_null_mask(
91  size_type size,
92  mask_state state,
93  rmm::cuda_stream_view stream = cudf::get_default_stream(),
94  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
95 
110  size_type begin_bit,
111  size_type end_bit,
112  bool valid,
113  rmm::cuda_stream_view stream = cudf::get_default_stream());
114 
132 rmm::device_buffer copy_bitmask(
133  bitmask_type const* mask,
134  size_type begin_bit,
135  size_type end_bit,
136  rmm::cuda_stream_view stream = cudf::get_default_stream(),
137  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
138 
151 rmm::device_buffer copy_bitmask(
152  column_view const& view,
153  rmm::cuda_stream_view stream = cudf::get_default_stream(),
154  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
155 
168 std::pair<rmm::device_buffer, size_type> bitmask_and(
169  table_view const& view,
170  rmm::cuda_stream_view stream = cudf::get_default_stream(),
171  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
172 
185 std::pair<rmm::device_buffer, size_type> bitmask_or(
186  table_view const& view,
187  rmm::cuda_stream_view stream = cudf::get_default_stream(),
188  rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource());
189 
207  size_type start,
208  size_type stop,
209  rmm::cuda_stream_view stream = cudf::get_default_stream()); // end of group
211 } // namespace 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:187
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 ...
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 create_null_mask(size_type size, mask_state state, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Creates a device_buffer for use as a null value indicator bitmask of a column.
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=rmm::mr::get_current_device_resource())
Performs bitwise AND of the bitmasks of columns of a table. Returns a pair of resulting mask and coun...
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)
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.
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=rmm::mr::get_current_device_resource())
Performs bitwise OR of the bitmasks of columns of a table. Returns a pair of resulting mask and count...
rmm::device_buffer copy_bitmask(bitmask_type const *mask, size_type begin_bit, size_type end_bit, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=rmm::mr::get_current_device_resource())
Creates a device_buffer from a slice of bitmask defined by a range of indices [begin_bit,...
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
int32_t size_type
Row index type for columns and tables.
Definition: types.hpp:93
uint32_t bitmask_type
Bitmask type stored as 32-bit unsigned integer.
Definition: types.hpp:94
mask_state
Controls the allocation/initialization of a null mask.
Definition: types.hpp:179
cuDF interfaces
Definition: aggregation.hpp:34
APIs for spans.
Type declarations for libcudf.