westonpace commented on code in PR #36489:
URL: https://github.com/apache/arrow/pull/36489#discussion_r1267400077
##########
cpp/src/arrow/gpu/cuda_memory.cc:
##########
@@ -480,5 +485,21 @@ Result<uint8_t*> GetHostAddress(uintptr_t device_ptr) {
return static_cast<uint8_t*>(ptr);
}
+Result<std::shared_ptr<MemoryManager>> DefaultMemoryMapper(ArrowDeviceType
device_type,
+ int64_t device_id) {
+ switch (device_type) {
+ case ARROW_DEVICE_CPU:
+ return default_cpu_memory_manager();
+ case ARROW_DEVICE_CUDA:
+ case ARROW_DEVICE_CUDA_HOST:
+ case ARROW_DEVICE_CUDA_MANAGED: {
+ ARROW_ASSIGN_OR_RAISE(auto device,
arrow::cuda::CudaDevice::Make(device_id));
Review Comment:
This is a little weird but not caused by this PR so feel free to ignore. My
first thought, at looking at this, is that we are returning a dangling object
since `device` will be destroyed almost immediately.
I think `arrow::cuda::CudaDevice::Make` should probably be
`arrow::cuda::CudaDevice::Get` and return `const CudaDevice&` or `const
CudaDevice*`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]