diff --git a/cpp/src/dictionary/detail/merge.cu b/cpp/src/dictionary/detail/merge.cu index 2ff0a3e0a2a..e972403cad3 100644 --- a/cpp/src/dictionary/detail/merge.cu +++ b/cpp/src/dictionary/detail/merge.cu @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -62,8 +63,11 @@ std::unique_ptr merge(dictionary_column_view const& lcol, return make_dictionary_column( std::make_unique(lcol.keys(), stream, mr), std::move(indices_column), - rmm::device_buffer{ - lcol.has_nulls() || rcol.has_nulls() ? static_cast(merged_size) : 0, stream, mr}, + cudf::detail::create_null_mask( + lcol.has_nulls() || rcol.has_nulls() ? static_cast(merged_size) : 0, + mask_state::UNINITIALIZED, + stream, + mr), lcol.null_count() + rcol.null_count()); } diff --git a/cpp/src/scalar/scalar.cpp b/cpp/src/scalar/scalar.cpp index a8d05e98034..f982e7b99f2 100644 --- a/cpp/src/scalar/scalar.cpp +++ b/cpp/src/scalar/scalar.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include #include @@ -574,12 +574,13 @@ void struct_scalar::superimpose_nulls(rmm::cuda_stream_view stream, rmm::mr::device_memory_resource* mr) { // push validity mask down - std::vector host_validity({0}); - auto validity = cudf::detail::make_device_uvector_sync(host_validity, stream, mr); + std::vector host_validity( + cudf::bitmask_allocation_size_bytes(1) / sizeof(bitmask_type), 0); + auto validity = cudf::detail::create_null_mask(1, mask_state::ALL_NULL, stream); auto iter = thrust::make_counting_iterator(0); std::for_each(iter, iter + _data.num_columns(), [&](size_type i) { cudf::structs::detail::superimpose_parent_nulls( - validity.data(), 1, _data.get_column(i), stream, mr); + static_cast(validity.data()), 1, _data.get_column(i), stream, mr); }); } diff --git a/cpp/src/structs/utilities.cpp b/cpp/src/structs/utilities.cpp index 80bea2ab55e..aa32c555324 100644 --- a/cpp/src/structs/utilities.cpp +++ b/cpp/src/structs/utilities.cpp @@ -187,8 +187,7 @@ void superimpose_parent_nulls(bitmask_type const* parent_null_mask, { if (!child.nullable()) { // Child currently has no null mask. Copy parent's null mask. - child.set_null_mask(rmm::device_buffer{ - parent_null_mask, cudf::bitmask_allocation_size_bytes(child.size()), stream, mr}); + child.set_null_mask(cudf::detail::copy_bitmask(parent_null_mask, 0, child.size(), stream, mr)); child.set_null_count(parent_null_count); } else { // Child should have a null mask. diff --git a/cpp/tests/copying/concatenate_tests.cu b/cpp/tests/copying/concatenate_tests.cu index 5237c75e4d4..c48f7ad4dbc 100644 --- a/cpp/tests/copying/concatenate_tests.cu +++ b/cpp/tests/copying/concatenate_tests.cu @@ -48,8 +48,6 @@ using Table = cudf::table; template struct TypedColumnTest : public cudf::test::BaseFixture { - static std::size_t data_size() { return 1000; } - static std::size_t mask_size() { return 100; } cudf::data_type type() { return cudf::data_type{cudf::type_to_id()}; } TypedColumnTest(rmm::cuda_stream_view stream = rmm::cuda_stream_default) @@ -58,14 +56,14 @@ struct TypedColumnTest : public cudf::test::BaseFixture { { auto typed_data = static_cast(data.data()); auto typed_mask = static_cast(mask.data()); - std::vector h_data(data_size()); + std::vector h_data(data.size()); std::iota(h_data.begin(), h_data.end(), char{0}); - std::vector h_mask(mask_size()); + std::vector h_mask(mask.size()); std::iota(h_mask.begin(), h_mask.end(), char{0}); CUDA_TRY(cudaMemcpyAsync( - typed_data, h_data.data(), data_size(), cudaMemcpyHostToDevice, stream.value())); + typed_data, h_data.data(), data.size(), cudaMemcpyHostToDevice, stream.value())); CUDA_TRY(cudaMemcpyAsync( - typed_mask, h_mask.data(), mask_size(), cudaMemcpyHostToDevice, stream.value())); + typed_mask, h_mask.data(), mask.size(), cudaMemcpyHostToDevice, stream.value())); stream.synchronize(); } @@ -484,7 +482,7 @@ TEST_F(OverflowTest, Presliced) auto offset_gen = cudf::detail::make_counting_transform_iterator( 0, [string_size](size_type index) { return index * string_size; }); cudf::test::fixed_width_column_wrapper offsets(offset_gen, offset_gen + num_rows + 1); - auto many_chars = cudf::make_fixed_width_column(data_type{type_id::INT8}, num_rows); + auto many_chars = cudf::make_fixed_width_column(data_type{type_id::INT8}, total_chars_size); auto col = cudf::make_strings_column( num_rows, offsets.release(), std::move(many_chars), 0, rmm::device_buffer{}); @@ -515,7 +513,7 @@ TEST_F(OverflowTest, Presliced) offsets->view().begin(), offsets->view().end(), offsets->mutable_view().begin()); - auto many_chars = cudf::make_fixed_width_column(data_type{type_id::INT8}, num_rows); + auto many_chars = cudf::make_fixed_width_column(data_type{type_id::INT8}, total_chars_size); auto col = cudf::make_strings_column( num_rows, std::move(offsets), std::move(many_chars), 0, rmm::device_buffer{}); diff --git a/cpp/tests/utilities/column_utilities.cu b/cpp/tests/utilities/column_utilities.cu index 88e9e3d1384..f3002bc4b1a 100644 --- a/cpp/tests/utilities/column_utilities.cu +++ b/cpp/tests/utilities/column_utilities.cu @@ -114,14 +114,6 @@ std::unique_ptr generate_child_row_indices(lists_column_view const& c, // // result = [6, 1, 11, 1, 1] // - auto validity_iter = cudf::detail::make_counting_transform_iterator( - 0, - [row_indices = row_indices.begin(), - validity = c.null_mask(), - offset = c.offset()] __device__(int index) { - auto const true_index = row_indices[index] + offset; - return !validity || cudf::bit_is_set(validity, true_index) ? 1 : 0; - }); auto output_row_iter = cudf::detail::make_counting_transform_iterator( 0, [row_indices = row_indices.begin(), @@ -136,8 +128,9 @@ std::unique_ptr generate_child_row_indices(lists_column_view const& c, output_row_iter, output_row_iter + row_indices.size(), output_row_start->view().begin(), - validity_iter, - result->mutable_view().begin()); + row_size_iter, + result->mutable_view().begin(), + [] __device__(auto row_size) { return row_size != 0; }); // generate keys for each output row // @@ -150,11 +143,12 @@ std::unique_ptr generate_child_row_indices(lists_column_view const& c, keys->mutable_view().end(), [] __device__() { return 0; }); thrust::scatter_if(rmm::exec_policy(), - validity_iter, - validity_iter + row_indices.size(), + row_size_iter, + row_size_iter + row_indices.size(), output_row_start->view().begin(), - validity_iter, - keys->mutable_view().begin()); + row_size_iter, + keys->mutable_view().begin(), + [] __device__(auto row_size) { return row_size != 0; }); thrust::inclusive_scan(rmm::exec_policy(), keys->view().begin(), keys->view().end(),