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 cudf::thread_index_type in merge.cu #13972

Merged
merged 5 commits into from
Sep 6, 2023
Merged
Changes from 4 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
12 changes: 7 additions & 5 deletions cpp/src/merge/merge.cu
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ __global__ void materialize_merged_bitmask_kernel(
size_type const num_destination_rows,
index_type const* const __restrict__ merged_indices)
{
size_type destination_row = threadIdx.x + blockIdx.x * blockDim.x;
auto tid = detail::grid_1d::global_thread_id();

auto active_threads = __ballot_sync(0xffff'ffffu, destination_row < num_destination_rows);
auto active_threads = __ballot_sync(0xffff'ffffu, tid < num_destination_rows);

while (destination_row < num_destination_rows) {
auto stride = detail::grid_1d::grid_stride();
divyegala marked this conversation as resolved.
Show resolved Hide resolved
while (tid < num_destination_rows) {
auto const destination_row = static_cast<size_type>(tid);
auto const [src_side, src_row] = merged_indices[destination_row];
bool const from_left{src_side == side::LEFT};
bool source_bit_is_valid{true};
Expand All @@ -99,8 +101,8 @@ __global__ void materialize_merged_bitmask_kernel(
// Only one thread writes output
if (0 == threadIdx.x % warpSize) { out_validity[word_index(destination_row)] = result_mask; }

destination_row += blockDim.x * gridDim.x;
active_threads = __ballot_sync(active_threads, destination_row < num_destination_rows);
tid += stride;
active_threads = __ballot_sync(active_threads, tid < num_destination_rows);
}
}

Expand Down