Skip to content

Commit

Permalink
fix SCALAR_TEST memory errors
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikeyann committed Jul 28, 2021
1 parent 0078bf6 commit 88be4c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 5 additions & 4 deletions cpp/src/scalar/scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <structs/utilities.hpp>

#include <cudf/column/column.hpp>
#include <cudf/detail/utilities/vector_factories.hpp>
#include <cudf/detail/null_mask.hpp>
#include <cudf/fixed_point/fixed_point.hpp>
#include <cudf/scalar/scalar.hpp>
#include <cudf/strings/string_view.hpp>
Expand Down Expand Up @@ -567,12 +567,13 @@ void struct_scalar::superimpose_nulls(rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
// push validity mask down
std::vector<bitmask_type> host_validity({0});
auto validity = cudf::detail::make_device_uvector_sync(host_validity, stream, mr);
std::vector<bitmask_type> 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<bitmask_type const*>(validity.data()), 1, _data.get_column(i), stream, mr);
});
}

Expand Down
3 changes: 1 addition & 2 deletions cpp/src/structs/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 88be4c3

Please sign in to comment.