Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Tianyu Liu <[email protected]>
  • Loading branch information
vuule and kingcrimsontianyu authored Feb 20, 2025
1 parent f0095b3 commit 208075a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
13 changes: 5 additions & 8 deletions cpp/src/io/orc/reader_impl_chunking.cu
Original file line number Diff line number Diff line change
Expand Up @@ -523,15 +523,12 @@ void reader_impl::load_next_stripe_data(read_mode mode)
}
}
std::vector<std::unique_ptr<cudf::io::datasource::buffer>> host_read_buffers;
for (auto& task : host_read_tasks) { // if there were host reads
host_read_buffers.emplace_back(std::get<0>(task).get());
for (auto& [fut, expected_size, dev_dst] : host_read_tasks) { // if there were host reads
host_read_buffers.emplace_back(fut.get());
auto* host_buffer = host_read_buffers.back().get();
CUDF_EXPECTS(host_buffer->size() == std::get<1>(task), "Unexpected discrepancy in bytes read.");
CUDF_CUDA_TRY(cudaMemcpyAsync(std::get<2>(task),
host_buffer->data(),
host_buffer->size(),
cudaMemcpyDefault,
_stream.value()));
CUDF_EXPECTS(host_buffer->size() == expected_size, "Unexpected discrepancy in bytes read.");
CUDF_CUDA_TRY(cudaMemcpyAsync(
dev_dst, host_buffer->data(), host_buffer->size(), cudaMemcpyDefault, _stream.value()));
}

for (auto& task : device_read_tasks) { // if there were device reads
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/io/utilities/datasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class kvikio_source : public datasource {
kvikio_source(HandleT&& h) : _kvikio_handle(std::move(h)) {}
std::unique_ptr<buffer> host_read(size_t offset, size_t size) override
{
auto clamped_read = clamped_read_to_vector(offset, size);
clamped_read.second.get();
return buffer::create(std::move(clamped_read.first));
auto [v, fut] = clamped_read_to_vector(offset, size);
fut.get();
return buffer::create(std::move(v));
}

std::future<std::unique_ptr<datasource::buffer>> host_read_async(size_t offset,
Expand Down

0 comments on commit 208075a

Please sign in to comment.