HostSliceTensor

#include <popops/HostSliceTensor.hpp>

Create tensor layouts that are optimised for host transfers.

namespace poplar

Poplar classes and functions.

namespace popops

Common functions, such as elementwise and reductions.

Functions

IndicesAndTensor createHostSliceableTensor(poplar::Graph &graph, const poplar::Type &type, const std::vector<size_t> &shape, const bool isRead, const poplar::DebugContext &debugContext = {})

Create a Tensor that is well laid out for a host exchange copy and at the same time create the index tensor for the copy.

The shape must be size 2, dim(1) must be the size of the datastream or remote buffer, if using a copy from a remote buffer with multiple slice indices dim(0) must be num slice indices, other wise dim(0) is 1.

Parameters
  • graph – The Poplar graph to add the tensor to.

  • type – The element type of the tensor created.

  • shape – The hape of created tensor.

  • isRead – If true, the tensor will be read by the host. If false, the tensor data will be written to the host. If isRead is true, tile imbalance is likely to be greater.

Returns

Two tensors: the indices, which will have size shape[0] and the tensor that will be written to.

IndicesAndTensor createHostSliceableTensor(poplar::Graph &graph, const poplar::Type &type, const std::vector<size_t> &shape, const bool isRead, const size_t offset, const poplar::DebugContext &debugContext = {})

Create a Tensor that is well laid out for a host exchange copy and at the same time create the index tensor for the copy.

The shape must be size 2, dim(1) must be the size of the datastream or remote buffer, if using a copy from a remote buffer with multiple slice indices dim(0) must be num slice indices, other wise dim(0) is 1.

Parameters
  • graph – The Poplar graph to add the tensor to.

  • type – The element type of the tensor created.

  • shape – The hape of created tensor.

  • isRead – If true, the tensor will be read by the host. If false, the tensor data will be written to the host. If isRead is true, tile imbalance is likely to be greater.

  • offset – The bytes already assumed to have been packetized. The first tile used = (offset / bytes per packet).

Returns

Two tensors: the indices, which will have size shape[0] and the tensor that will be written to.

poplar::Tensor createHostTransferableTensor(poplar::Graph &graph, const poplar::Type &type, const std::vector<size_t> &shape, bool isRead, const poplar::DebugContext &debugContext = {})

Create a tensor that is well laid out for a host exchange copy.

Parameters
  • graph – The graph to add the tensor to.

  • type – The element type of the tensor created.

  • shape – The shape of the tensor created.

  • isRead – If true, the tensor will be read by the host. If false, the tensor data will be written to the host. Setting isRead to true is likely to make the read operation faster without affecting the write, but is also likely to cause greater tile imbalance.

Returns

The tensor created.

poplar::Tensor createHostTransferableTensor(poplar::Graph &graph, const poplar::Type &type, const std::vector<size_t> &shape, bool isRead, const size_t offset, const poplar::DebugContext &debugContext = {})

Create a tensor that is well laid out for a host exchange copy.

Parameters
  • graph – The graph to add the tensor to.

  • type – The element type of the tensor created.

  • shape – The shape of the tensor created.

  • isRead – If true, the tensor will be read by the host. If false, the tensor data will be written to the host. Setting isRead to true is likely to make the read operation faster without affecting the write, but is also likely to cause greater tile imbalance.

  • offset – The bytes already assumed to have been packetized. The first tile used = (offset / bytes per packet).

Returns

The tensor created.

struct IndicesAndTensor
#include <HostSliceTensor.hpp>

The pair of values returned by createHostSliceableTensor().

Public Members

poplar::Tensor indices
poplar::Tensor tensor