Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 11 additions & 1 deletion cpp/src/io/orc/writer_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,17 @@ cudf::detail::hostdevice_vector<uint8_t> allocate_and_encode_blobs(
// figure out the buffer size needed for protobuf format
orc_init_statistics_buffersize(
stats_merge_groups.device_ptr(), stat_chunks.data(), num_stat_blobs, stream);
auto max_blobs = stats_merge_groups.element(num_stat_blobs - 1, stream);

// get stats_merge_groups[num_stat_blobs - 1] via a host pinned bounce buffer
auto host_pinned_memory =
cudf::detail::make_pinned_vector_async<statistics_merge_group>(1, stream);
CUDF_CUDA_TRY(cudaMemcpyAsync(host_pinned_memory.data(),
stats_merge_groups.device_ptr(num_stat_blobs - 1),
sizeof(statistics_merge_group),
cudaMemcpyDeviceToHost,
stream.value()));
stream.synchronize();
auto max_blobs = host_pinned_memory.front();

cudf::detail::hostdevice_vector<uint8_t> blobs(max_blobs.start_chunk + max_blobs.num_chunks,
stream);
Expand Down
17 changes: 0 additions & 17 deletions cpp/src/io/utilities/hostdevice_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,6 @@ class hostdevice_vector {
[[nodiscard]] T* d_end() { return device_ptr(size()); }
[[nodiscard]] T const* d_end() const { return device_ptr(size()); }

/**
* @brief Returns the specified element from device memory
*
* @note This function incurs a device to host memcpy and should be used sparingly.
* @note This function synchronizes `stream`.
*
* @throws rmm::out_of_range exception if `element_index >= size()`
*
* @param element_index Index of the desired element
* @param stream The stream on which to perform the copy
* @return The value of the specified element
*/
[[nodiscard]] T element(std::size_t element_index, rmm::cuda_stream_view stream) const
{
return d_data.element(element_index, stream);
}

operator cudf::host_span<T>() { return host_span<T>{h_data}.subspan(0, size()); }
operator cudf::host_span<T const>() const
{
Expand Down