Poplar and PopLibs
|
A program that copies data. More...
#include <Program.hpp>
Public Member Functions | |
Copy (Tensor src, Tensor dst, bool dontOutline=false, const DebugContext &debugContext={}) | |
Construct a program to copy data from one tensor to another. More... | |
Copy (const DataStream &stream, Tensor dst, bool optimiseMemory=false, const DebugContext &debugContext={}) | |
Construct a program to copy from a data stream to a tensor. More... | |
Copy (Tensor src, const DataStream &stream, bool optimiseMemory=false, const DebugContext &debugContext={}) | |
Construct a program to copy a tensor to a data stream. More... | |
Copy (const RemoteBuffer &buffer, Tensor dst, const DebugContext &debugContext={}) | |
Construct a program to copy a remote buffer to a tensor. More... | |
Copy (const RemoteBuffer &buffer, Tensor dst, Tensor offset, const DebugContext &debugContext={}) | |
Construct a program to copy a remote buffer to a tensor. More... | |
Copy (Tensor src, const RemoteBuffer &buffer, const DebugContext &debugContext={}) | |
Construct a program to copy a tensor to a remote buffer. More... | |
Copy (Tensor src, const RemoteBuffer &buffer, Tensor offset, const DebugContext &debugContext={}) | |
Construct a program to copy a tensor to a remote buffer. More... | |
Copy (const FunctionBuffer &buffer, const Function &function, const DebugContext &debugContext={}) | |
Construct a program to copy the contents of a FunctionBuffer to a Function. More... | |
A program that copies data.
poplar::program::Copy::Copy | ( | Tensor | src, |
Tensor | dst, | ||
bool | dontOutline = false , |
||
const DebugContext & | debugContext = {} |
||
) |
Construct a program to copy data from one tensor to another.
This constructor creates a program that will copy data from the src
tensor to the dst
tensor.
src | The tensor to copy from. |
dst | The tensor to copy to. |
dontOutline | Do not outline this copy as a function call. Default is false (the copy will be outlined). |
debugContext | Optional DebugId and program name. |
poplar::program::Copy::Copy | ( | const DataStream & | stream, |
Tensor | dst, | ||
bool | optimiseMemory = false , |
||
const DebugContext & | debugContext = {} |
||
) |
Construct a program to copy from a data stream to a tensor.
stream | The stream to copy from. |
dst | The tensor to copy to. |
optimiseMemory | If set to true, Poplar will sacrifice speed to reduce memory use. For example, it may rearrange data on the host and outline writes. Setting this will disable prefetch. |
debugContext | Optional DebugId and program name. |
poplar::program::Copy::Copy | ( | Tensor | src, |
const DataStream & | stream, | ||
bool | optimiseMemory = false , |
||
const DebugContext & | debugContext = {} |
||
) |
Construct a program to copy a tensor to a data stream.
src | The tensor to copy from. |
stream | The stream to copy to. |
optimiseMemory | If set to true, Poplar will sacrifice speed to reduce memory use. For example, it may rearrange data on the host and outline writes. Setting this will disable prefetch. |
debugContext | Optional DebugId and program name. |
poplar::program::Copy::Copy | ( | const RemoteBuffer & | buffer, |
Tensor | dst, | ||
const DebugContext & | debugContext = {} |
||
) |
Construct a program to copy a remote buffer to a tensor.
buffer | The remote buffer to copy from. |
dst | The tensor to copy to. |
debugContext | Optional DebugId and program name. |
poplar::program::Copy::Copy | ( | const RemoteBuffer & | buffer, |
Tensor | dst, | ||
Tensor | offset, | ||
const DebugContext & | debugContext = {} |
||
) |
Construct a program to copy a remote buffer to a tensor.
The data to be transferred is controlled by the definition of the buffer and the offset
parameter.
The buffer has repeat
data-transfer "rows" each containing numElements
data items (these are not necessarily the same as rows in the destination tensor.) The size of offset
defines the number of rows to copy. The rows to be copied are defined by offset:
each element of offset
is the index of a row to be copied.
The size of dst
must be equal to the data transfer size: sizeof(offset)
* numElements
.
If the offset
tensor has more than one element then the dst
must be a rank 2 tensor with dimensions [offset.numElements()
, remoteBuffer.numElements()
].
Multiple values in the offset
tensor with the same value will result in undefined behaviour because the order of writes to the buffer is not guaranteed.
buffer | The remote buffer to copy from. |
dst | The tensor to copy to. |
offset | The "rows"" in the remote buffer to copy from. |
debugContext | Optional DebugId and program name. |
poplar::program::Copy::Copy | ( | Tensor | src, |
const RemoteBuffer & | buffer, | ||
const DebugContext & | debugContext = {} |
||
) |
Construct a program to copy a tensor to a remote buffer.
src | The tensor to copy from. |
buffer | The remote buffer buffer to copy to. |
debugContext | Optional DebugId and program name. |
poplar::program::Copy::Copy | ( | Tensor | src, |
const RemoteBuffer & | buffer, | ||
Tensor | offset, | ||
const DebugContext & | debugContext = {} |
||
) |
Construct a program to copy a tensor to a remote buffer.
The data that is transferred is controlled by the definition of the buffer and the offset
parameter.
The buffer has repeat
data transfer "rows" each containing numElements
data items. (These are not necessarily the same as rows in the source tensor) The rows to be copied are defined by offset
. The size of offset
defines the number of rows to copy. Each element of offset
is the index of a row to be copied.
The size of src
must be equal to the data transfer size: sizeof(offset)
* numElements
.
If the offset
tensor has more than one element then the src
must be a rank 2 tensor with dimensions [offset.numElements()
, remoteBuffer.numElements()
].
Multiple values in the offset
tensor with the same value will result in undefined behaviour.
src | The tensor to copy from. |
buffer | The remote buffer buffer to copy to. |
offset | The "rows" in the remote buffer to copy to. |
debugContext | Optional DebugId and program name. |
poplar::program::Copy::Copy | ( | const FunctionBuffer & | buffer, |
const Function & | function, | ||
const DebugContext & | debugContext = {} |
||
) |
Construct a program to copy the contents of a FunctionBuffer to a Function.
Note that there is no Copy program for the inverse direction i.e. Function to FunctionBuffer because no mutable state is stored in a FunctionBuffer.
buffer | The FunctionBuffer to copy from. |
function | The Function to copy to. |
debugContext | Option DebugId and program name. |