Description
Based on discussion in dmlc/dlpack#57, array.__dlpack__
method supports stream
keyword, implementing @tqchen's suggestion for synchronization semantics.
The from_dlpack
command in array API does not support it at present though, requiring users to explicitly synchronize at the exporter's side.
The from_dlpack
function has acquired device
keyword (see #626) to permit porting device data to host, e.g. from_dlpack(gpu_arr, device=(kDLCPU, 0))
and, potentially, to allow exchanges between different APIs targeting the same device (e.g., between kDLOneAPI
and kDLCUDA
for oneAPI devices targeting NVidia GPUs) down the road.
It is tempting to want to add support for stream
keyword to from_dlpack
, but this keyword value must make sense for importing library, while stream
value passed to __dlpack__
must make sense for exporting library. So it seems that from_dlpack
should only allow specifying non-default value stream
keyword when it can make sense for both. Maybe when device type of requested device is the same as the type indicated in arr.__dlpack_device__
.