Files | |
file | null_mask.hpp |
APIs for managing validity bitmasks. | |
Functions | |
size_type | cudf::state_null_count (mask_state state, size_type size) |
Returns the null count for a null mask of the specified state representing size elements. More... | |
std::size_t | cudf::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 boundary. More... | |
size_type | cudf::num_bitmask_words (size_type number_of_bits) |
Returns the number of bitmask_type words required to represent the specified number of bits. More... | |
rmm::device_buffer | cudf::create_null_mask (size_type size, mask_state state, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Creates a device_buffer for use as a null value indicator bitmask of a column . More... | |
void | cudf::set_null_mask (bitmask_type *bitmask, size_type begin_bit, size_type end_bit, bool valid) |
Sets a pre-allocated bitmask buffer to a given state in the range [begin_bit, end_bit) More... | |
cudf::size_type | cudf::count_set_bits (bitmask_type const *bitmask, size_type start, size_type stop) |
Given a bitmask, counts the number of set (1) bits in the range [start, stop) More... | |
cudf::size_type | cudf::count_unset_bits (bitmask_type const *bitmask, size_type start, size_type stop) |
Given a bitmask, counts the number of unset (0) bits in the range [start, stop) . More... | |
std::vector< size_type > | cudf::segmented_count_set_bits (bitmask_type const *bitmask, std::vector< cudf::size_type > const &indices) |
Given a bitmask, counts the number of set (1) bits in every range [indices[2*i], indices[(2*i)+1]) (where 0 <= i < indices.size() / 2). More... | |
std::vector< size_type > | cudf::segmented_count_unset_bits (bitmask_type const *bitmask, std::vector< cudf::size_type > const &indices) |
Given a bitmask, counts the number of unset (0) bits in every range [indices[2*i], indices[(2*i)+1]) (where 0 <= i < indices.size() / 2). More... | |
rmm::device_buffer | cudf::copy_bitmask (bitmask_type const *mask, size_type begin_bit, size_type end_bit, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Creates a device_buffer from a slice of bitmask defined by a range of indices [begin_bit, end_bit) . More... | |
rmm::device_buffer | cudf::copy_bitmask (column_view const &view, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Copies view 's bitmask from the bits [view.offset(), view.offset() + view.size()) into a device_buffer More... | |
rmm::device_buffer | cudf::bitmask_and (table_view const &view, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource()) |
Returns a bitwise AND of the bitmasks of columns of a table. More... | |
std::size_t cudf::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 boundary.
number_of_bits | The number of bits that need to be represented |
padding_boundary | The value returned will be rounded up to a multiple of this value |
rmm::device_buffer cudf::bitmask_and | ( | table_view const & | view, |
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Returns a bitwise AND of the bitmasks of columns of a table.
If any of the columns isn't nullable, it is considered all valid. If no column in the table is nullable, an empty bitmask is returned.
view | The table of columns |
mr | Device memory resource used to allocate the returned device_buffer |
rmm::device_buffer cudf::copy_bitmask | ( | bitmask_type const * | mask, |
size_type | begin_bit, | ||
size_type | end_bit, | ||
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Creates a device_buffer
from a slice of bitmask defined by a range of indices [begin_bit, end_bit)
.
Returns empty device_buffer
if bitmask == nullptr
.
cudf::logic_error | if begin_bit > end_bit |
cudf::logic_error | if begin_bit < 0 |
mask | Bitmask residing in device memory whose bits will be copied |
begin_bit | Index of the first bit to be copied (inclusive) |
end_bit | Index of the last bit to be copied (exclusive) |
mr | Device memory resource used to allocate the returned device_buffer |
device_buffer
containing the bits [begin_bit, end_bit)
from mask
. rmm::device_buffer cudf::copy_bitmask | ( | column_view const & | view, |
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Copies view
's bitmask from the bits [view.offset(), view.offset() + view.size())
into a device_buffer
Returns empty device_buffer
if the column is not nullable
view | Column view whose bitmask needs to be copied |
mr | Device memory resource used to allocate the returned device_buffer |
device_buffer
containing the bits [view.offset(), view.offset() + view.size())
from view
's bitmask. cudf::size_type cudf::count_set_bits | ( | bitmask_type const * | bitmask, |
size_type | start, | ||
size_type | stop | ||
) |
Given a bitmask, counts the number of set (1) bits in the range [start, stop)
Returns 0
if bitmask == nullptr
.
cudf::logic_error | if start > stop |
cudf::logic_error | if start < 0 |
bitmask | Bitmask residing in device memory whose bits will be counted |
start_bit | Index of the first bit to count (inclusive) |
stop_bit | Index of the last bit to count (exclusive) |
cudf::size_type cudf::count_unset_bits | ( | bitmask_type const * | bitmask, |
size_type | start, | ||
size_type | stop | ||
) |
Given a bitmask, counts the number of unset (0) bits in the range [start, stop)
.
Returns 0
if bitmask == nullptr
.
cudf::logic_error | if start > stop |
cudf::logic_error | if start < 0 |
bitmask | Bitmask residing in device memory whose bits will be counted |
start_bit | Index of the first bit to count (inclusive) |
stop_bit | Index of the last bit to count (exclusive) |
rmm::device_buffer cudf::create_null_mask | ( | size_type | size, |
mask_state | state, | ||
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Creates a device_buffer
for use as a null value indicator bitmask of a column
.
size | The number of elements to be represented by the mask |
state | The desired state of the mask |
mr | Device memory resource used to allocate the returned device_buffer. |
device_buffer
for use as a null bitmask satisfying the desired size and state size_type cudf::num_bitmask_words | ( | size_type | number_of_bits | ) |
Returns the number of bitmask_type
words required to represent the specified number of bits.
Unlike bitmask_allocation_size_bytes
, which returns the number of bytes needed for a bitmask allocation (including padding), this function returns the actual number bitmask_type
elements necessary to represent number_of_bits
. This is useful when one wishes to process all of the bits in a bitmask and ignore the padding/slack bits.
number_of_bits | The number of bits that need to be represented |
bitmask_type
elements std::vector<size_type> cudf::segmented_count_set_bits | ( | bitmask_type const * | bitmask, |
std::vector< cudf::size_type > const & | indices | ||
) |
Given a bitmask, counts the number of set (1) bits in every range [indices[2*i], indices[(2*i)+1])
(where 0 <= i < indices.size() / 2).
Returns an empty vector if bitmask == nullptr
.
cudf::logic_error | if indices.size() % 2 != 0 |
cudf::logic_error | if indices[2*i] < 0 or indices[2*i] > indices[(2*i)+1] |
[in] | bitmask | Bitmask residing in device memory whose bits will be counted |
[in] | indices | A vector of indices used to specify ranges to count the number of set bits |
std::vector<size_type> cudf::segmented_count_unset_bits | ( | bitmask_type const * | bitmask, |
std::vector< cudf::size_type > const & | indices | ||
) |
Given a bitmask, counts the number of unset (0) bits in every range [indices[2*i], indices[(2*i)+1])
(where 0 <= i < indices.size() / 2).
Returns an empty vector if bitmask == nullptr
.
cudf::logic_error | if indices.size() % 2 != 0 |
cudf::logic_error | if indices[2*i] < 0 or indices[2*i] > indices[(2*i)+1] |
[in] | bitmask | Bitmask residing in device memory whose bits will be counted |
[in] | indices | A vector of indices used to specify ranges to count the number of unset bits |
void cudf::set_null_mask | ( | bitmask_type * | bitmask, |
size_type | begin_bit, | ||
size_type | end_bit, | ||
bool | valid | ||
) |
Sets a pre-allocated bitmask buffer to a given state in the range [begin_bit, end_bit)
Sets [begin_bit, end_bit)
bits of bitmask to valid if valid==true
or null otherwise.
bitmask | Pointer to bitmask (e.g. returned by column_view.null_mask() ) |
begin_bit | Index of the first bit to set (inclusive) |
end_bit | Index of the last bit to set (exclusive) |
valid | If true set all entries to valid; otherwise, set all to null. |
size_type cudf::state_null_count | ( | mask_state | state, |
size_type | size | ||
) |
Returns the null count for a null mask of the specified state
representing size
elements.
state | The state of the null mask |
size | The number of elements represented by the mask |