Add a fast path to copy to numpy.ndarray#2120
Conversation
|
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
|
Array API standard conformance tests for dpctl=0.21.0dev0=py310h93fe807_53 ran successfully. |
ndgrigorian
left a comment
There was a problem hiding this comment.
I wonder if we should still submit q.wait() for the sake of consistency. I doubt it would impact any workflows, but if one relies on this function to be a blocking call, it might be a surprise that it doesn't, even in this special case
perhaps we should also consider implementing asynchronous copies to NumPy and the blocking keyword, like CuPy does
But we never claimed that copying to a numpy array is a blocking call. It sounds more as the internal logic of dpctl, and the user has never to rely on it.
That sounds as a good idea which might be helpful to clear expose blocking logic under the user control. |
True, but it might be expected regardless, since any transfer from device to host is expected to be a blocking call. But I guess it shouldn't really matter, since a size-0 array contains no data, so it probably shouldn't be an issue. |
This PR adds a fast path to copy the USM data to
numpy.ndarray.In case when the USM data has the zero size, there is no need to synchronize the data and to perform the copy. It will be enough to call
numpy.ndarrayconstructor with appropriateshapeanddtypekeywords.