Poplar and PopLibs
TileMapping.hpp File Reference

Functions for handling the mapping of tensors to tiles. More...

#include "poplar/DebugContext.hpp"
#include "poplar/Graph.hpp"
#include "poplar/Tensor.hpp"
#include <vector>

Go to the source code of this file.

Classes

class  poputil::TensorUseTracker
 Class that tracks the usage of data on different tiles. More...
 

Namespaces

namespace  poputil
 General utility functions for building graphs.
 

Functions

std::vector< std::vector< poplar::Interval > > poputil::calcLinearTileMapping (const poplar::Graph &graph, std::vector< std::size_t > shape, unsigned minElementsPerTile, unsigned grainSize, unsigned offset=0, bool ascendingOrder=true)
 Calculate a tile mapping that spreads the tensor evenly over the tiles in a graph. More...
 
std::vector< std::vector< poplar::Interval > > poputil::calcLinearTileMapping (const poplar::Graph &graph, const poplar::Tensor &t, unsigned offset=0, bool ascendingOrder=true)
 Calculate a tile mapping that spreads the tensor evenly over the tiles in a graph. More...
 
std::pair< poplar::Graph::TileToTensorMapping, unsigned > poputil::calcLinearTileMappingAndNewOffset (const poplar::Graph &graph, const poplar::Tensor &t, unsigned offset=0)
 Calculate a tile mapping that spreads the tensor evenly over the tiles in a graph. More...
 
void poputil::mapTensorLinearly (poplar::Graph &graph, const poplar::Tensor &t, unsigned minElementsPerTile, unsigned grainSize)
 Map the specified tensor, spreading the tensor evenly over the tiles in a graph. More...
 
void poputil::mapTensorLinearlyWithOffset (poplar::Graph &graph, const poplar::Tensor &t, unsigned minElementsPerTile, unsigned grainSize, unsigned offset, bool ascendingOrder=true)
 Map the specified tensor, spreading the tensor evenly over the tiles in a graph. More...
 
void poputil::mapTensorLinearly (poplar::Graph &graph, const poplar::Tensor &t)
 Map the specified tensor, spreading the tensor evenly over the tiles in a graph. More...
 
void poputil::mapTensorLinearlyWithOffset (poplar::Graph &graph, const poplar::Tensor &t, unsigned offset=0, bool ascendingOrder=true)
 Map the specified tensor, spreading the tensor evenly over the tiles in a graph. More...
 
std::size_t poputil::chooseMappingOffset (std::size_t numTiles, const std::vector< std::size_t > &shape)
 Choose an offset for use with tensor mapping functions using a hash of the shape provided. More...
 
std::size_t poputil::chooseMappingOffset (std::size_t numTiles, const std::vector< std::size_t > &shape, std::size_t seed)
 Choose an offset for use with tensor mapping functions using a hash of the shape, and a seed. More...
 
unsigned poputil::getTileImbalance (const poplar::Graph::TileToTensorMapping &mapping, unsigned minElementsPerTile=0, unsigned grainSize=1)
 Determine how unbalanced a tensor is when mapped over tiles in a graph. More...
 
unsigned poputil::getTileImbalance (const poplar::Graph &graph, const poplar::Tensor &t, unsigned minElementsPerTile=0, unsigned grainSize=1)
 Determine how unbalanced a tensor is mapped over tiles. More...
 
poplar::Tensor poputil::cloneToIpu (poplar::Graph &graph, const poplar::Tensor &t, unsigned dstIPU, const poplar::DebugContext &debugContext={}, poplar::TensorCloneMethod method=poplar::TensorCloneMethod::PRESERVE_ORDER_UNLESS_ALIASES)
 Create a clone of the specified tensor on the specified IPU. More...
 
poplar::Tensor poputil::cloneToGraph (poplar::Graph &srcGraph, poplar::Graph &dstGraph, const poplar::Tensor &t, const poplar::DebugContext &debugContext={}, poplar::TensorCloneMethod method=poplar::TensorCloneMethod::PRESERVE_ORDER_UNLESS_ALIASES)
 Create a clone of the specified tensor on the specified graph. More...
 
std::pair< poplar::Tensor, unsigned > poputil::cloneAndExpandAliasing (poplar::Graph &graph, const poplar::Tensor &t, unsigned offset=0, const poplar::DebugContext &debugContext={})
 Create a clone of the specified tensor on the specified graph. More...
 
poplar::Tensor poputil::copyToIpu (poplar::Graph &masterGraph, const poplar::Tensor &t, poplar::program::Sequence &prog, unsigned dstIPU, const poplar::DebugContext &debugContext={}, poplar::TensorCloneMethod method=poplar::TensorCloneMethod::PRESERVE_ORDER_UNLESS_ALIASES)
 Move a tensor from one IPU to another. More...
 
poplar::Tensor poputil::createIpuCopy (poplar::Graph &graph, const poplar::Tensor &t, unsigned dstIpu, poplar::Tensor &copySrc, poplar::Tensor &copyDst, const poplar::DebugContext &debugContext={}, poplar::TensorCloneMethod method=poplar::TensorCloneMethod::PRESERVE_ORDER_AND_ALIASES)
 Prepare to move a tensor from one IPU to another. More...
 
bool poputil::dimIsSplitOverTiles (const poplar::Graph &graph, const poplar::Tensor &t, unsigned dimension)
 Check if a dimension of a tensor is split over more than one tile. More...
 
bool poputil::dimIsSplitOverIPUs (const poplar::Graph &graph, const poplar::Tensor &t, unsigned dimension)
 Check if a dimension of a tensor is split over more than one IPU. More...
 
poplar::Tensor poputil::createBroadcastOperand (poplar::Graph &graph, const poplar::Tensor &fullTensor, const poplar::Type &type, unsigned dim, bool ditherMapping=false, const poplar::DebugContext &debugContext={})
 Create a simpler tensor that is mapped in the same way as another, full, tensor. More...
 
unsigned poputil::transformTileIndex (unsigned tile, unsigned numTiles, unsigned offset, bool ascending)
 Transform a tile index such that the result begins at zero and increments. More...
 
unsigned poputil::invTransformTileIndex (unsigned tile, unsigned numTiles, unsigned offset, bool ascending)
 Transform a tile index such that the result begins at an offset and increments or decrements. More...
 

Detailed Description

Functions for handling the mapping of tensors to tiles.