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

ARROW-15374: [C++][FlightRPC] Add support for MemoryManager in data methods #12239

Closed
wants to merge 1 commit into from

Conversation

lidavidm
Copy link
Member

This enables using Flight with something like CUDA without having to manually copy data. Given the work around UCX on the mailing list, this would enable alternative backends to optimize based on where data is allocated.

@github-actions
Copy link

Copy link
Contributor

@cyb70289 cyb70289 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +466 to +468
if (ARROW_PREDICT_FALSE(!memory_manager_->is_cpu() && data->body)) {
ARROW_ASSIGN_OR_RAISE(data->body, Buffer::ViewOrCopy(data->body, memory_manager_));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Does it make sense to move this code inside peekable_reader_->Next()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, it does make error reporting more complicated though since PeekableReader doesn't have a way to report errors.

return Status::Invalid("Expected buffer on device: ", device.ToString(),
". Was allocated on device: ", buffer->device()->ToString());
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also recurse into child data here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I realize the test might only use primitive data, in which case it doesn't matter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a guard against this.


FlightStreamChunk chunk;
ASSERT_OK(reader->Next(&chunk));
for (const auto& column : chunk.data->columns()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also check the contents of the returned data here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I added a helper to do this.

// This will likely lead to abort as gRPC cannot recover from an error here
return ToGrpcStatus(status);
}
slices.push_back(slice);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not sure how grpc::Slice behaves wrt copies)

Suggested change
slices.push_back(slice);
slices.push_back(std::move(slice));

@pitrou pitrou closed this in a7f518c Jan 31, 2022
@ursabot
Copy link

ursabot commented Jan 31, 2022

Benchmark runs are scheduled for baseline = 690e22f and contender = a7f518c. a7f518c is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Finished ⬇️0.0% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.17% ⬆️0.04%] ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@lidavidm lidavidm deleted the arrow-15374 branch January 31, 2022 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants