kkraus14 commented on code in PR #36489:
URL: https://github.com/apache/arrow/pull/36489#discussion_r1259020737


##########
cpp/src/arrow/gpu/cuda_context.cc:
##########
@@ -384,7 +384,7 @@ Result<std::shared_ptr<Buffer>> 
CudaMemoryManager::ViewBufferTo(
   if (to->is_cpu()) {
     // Device-on-CPU view
     ARROW_ASSIGN_OR_RAISE(auto address, GetHostAddress(buf->address()));
-    return std::make_shared<Buffer>(address, buf->size(), to, buf);
+    return std::make_shared<Buffer>(address, buf->size(), to, buf, 
DeviceType::CUDA_HOST);
   }

Review Comment:
   I know this is existing code, but I don't think this is safe? It looks like 
we're taking the address to device memory and then just creating a new buffer 
wrapping that same address with a `CUDA_HOST` device?
   
   This would only work if the device of `buf` was `CUDA_HOST` or 
`CUDA_MANAGED` which doesn't look to be the case here.



-- 
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]

Reply via email to