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

Optimize ORC reader performance for list data #13708

Merged
merged 6 commits into from
Jul 25, 2023
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
21 changes: 8 additions & 13 deletions cpp/src/io/orc/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -722,15 +722,14 @@ struct list_buffer_data {
};

// Generates offsets for list buffer from number of elements in a row.
void generate_offsets_for_list(device_span<list_buffer_data const> buff_data,
rmm::cuda_stream_view stream)
void generate_offsets_for_list(host_span<list_buffer_data> buff_data, rmm::cuda_stream_view stream)
{
auto const transformer = [] __device__(list_buffer_data const list_data) {
thrust::exclusive_scan(
thrust::seq, list_data.data, list_data.data + list_data.size, list_data.data);
};
thrust::for_each(rmm::exec_policy(stream), buff_data.begin(), buff_data.end(), transformer);
stream.synchronize();
for (auto& list_data : buff_data) {
thrust::exclusive_scan(rmm::exec_policy_nosync(stream),
list_data.data,
list_data.data + list_data.size,
list_data.data);
}
}

/**
Expand Down Expand Up @@ -1334,11 +1333,7 @@ table_with_metadata reader::impl::read(uint64_t skip_rows,
}
});

if (buff_data.size()) {
auto const dev_buff_data = cudf::detail::make_device_uvector_async(
buff_data, _stream, rmm::mr::get_current_device_resource());
generate_offsets_for_list(dev_buff_data, _stream);
}
if (not buff_data.empty()) { generate_offsets_for_list(buff_data, _stream); }
}
}

Expand Down