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

Fix memcheck error in distinct inner join #15164

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 7 additions & 10 deletions cpp/src/join/distinct_hash_join.cu
Original file line number Diff line number Diff line change
Expand Up @@ -205,27 +205,24 @@ CUDF_KERNEL void distinct_join_probe_kernel(Iter iter,
cudf::size_type buffer_size = 0;
PointKernel marked this conversation as resolved.
Show resolved Hide resolved

while (idx - block.thread_rank() < n) { // the whole thread block falls into the same iteration
cudf::size_type thread_count{0};
cudf::size_type build_idx{0};
if (idx < n) {
auto const found = hash_table.find(*(iter + idx));
thread_count = found != hash_table.end();
build_idx = static_cast<cudf::size_type>(found->second);
}
auto const found = idx < n ? hash_table.find(*(iter + idx)) : hash_table.end();
auto const has_match = found != hash_table.end();

// Use a whole-block scan to calculate the output location
cudf::size_type offset;
cudf::size_type block_count;
block_scan(block_scan_temp_storage).ExclusiveSum(thread_count, offset, block_count);
block_scan(block_scan_temp_storage)
.ExclusiveSum(static_cast<cudf::size_type>(has_match), offset, block_count);

if (buffer_size + block_count > buffer_capacity) {
flush_buffer(block, buffer_size, buffer, counter, build_indices, probe_indices);
block.sync();
buffer_size = 0;
}

if (thread_count == 1) {
buffer[buffer_size + offset] = cuco::pair{build_idx, static_cast<cudf::size_type>(idx)};
if (has_match) {
buffer[buffer_size + offset] = cuco::pair{static_cast<cudf::size_type>(found->second),
static_cast<cudf::size_type>(idx)};
}
buffer_size += block_count;
block.sync();
PointKernel marked this conversation as resolved.
Show resolved Hide resolved
Expand Down