Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use offsetalator in cudf::row_bit_count() #15003

Merged
merged 5 commits into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cpp/src/transform/row_bit_count.cu
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <cudf/column/column_factories.hpp>
#include <cudf/detail/iterator.cuh>
#include <cudf/detail/nvtx/ranges.hpp>
#include <cudf/detail/offsets_iterator.cuh>
#include <cudf/detail/utilities/cuda.cuh>
#include <cudf/detail/utilities/vector_factories.hpp>
#include <cudf/lists/lists_column_view.hpp>
Expand Down Expand Up @@ -352,11 +353,12 @@ __device__ size_type row_size_functor::operator()<string_view>(column_device_vie
return 0;
}

auto const offsets_size = sizeof(size_type) * CHAR_BIT;
auto const offsets_size =
(offsets.type().id() == type_id::INT32 ? sizeof(int32_t) : sizeof(int64_t)) * CHAR_BIT;
auto const validity_size = col.nullable() ? 1 : 0;
auto const chars_size =
(offsets.data<size_type>()[row_end] - offsets.data<size_type>()[row_start]) * CHAR_BIT;
return ((offsets_size + validity_size) * num_rows) + chars_size;
auto const d_offsets = cudf::detail::input_offsetalator(offsets.head(), offsets.type());
auto const chars_size = (d_offsets[row_end] - d_offsets[row_start]) * CHAR_BIT;
return static_cast<size_type>(((offsets_size + validity_size) * num_rows) + chars_size);
davidwendt marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
Loading