If the node is absent from the src
context and either it is present in the dst
context or ~into_merge_buffer
is different from No
: raises an error.
If ~into_merge_buffer:No
: If the node is present in the dst
context, schedules a copy of the tensor node from the device of src
to the device of dst
and returns true, otherwise returns false.
If ~into_merge_buffer
is different from No
: schedules the following task and returns true.
The merge-buffer task sets on dst
the merge buffer source to the given node. If ~into_merge_buffer:Streaming
, remembers the buffer pointer of the source node to use for streaming, without blocking. If ~into_merge_buffer:Copy
, copies from src
to the merge buffer of dst
's device.
If the dst
context resulted from a compilation with Streaming
or Copy
specific merge buffer code, the device_to_device
call should fail immediately if there's a mismatch with ~into_merge_buffer
.
NOTE: it's the caller's responsibility to synchronize the src
device, if needed, before calling device_to_device
, and if ~into_merge_buffer:Streaming
, the dst
device afterward, before any computations on the src
device overwrite the node.