GraphFunction

#include <poputil/GraphFunction.hpp>

Definitions for reusing graph structures.

Since the graph structure takes up memory it is sometimes useful to re-apply the same graph structure for multiple different data items. The functions in this namespace provide a way to do this by treating graphs as reusable functions.

namespace poputil

General utility functions for building graphs.

namespace graphfn

Support for using poplar::Program objects like function calls.

Typedefs

using Signature = std::vector<ArgSig>

Enums

enum ArgType

Type of argument to function program.

Values:

enumerator InputArg
enumerator OutputArg
enumerator InOutArg
enumerator CreatedArg

Functions

inline ArgSig input(poplar::Tensor similar, std::string debugName = "")
inline ArgSig inout(poplar::Tensor similar, std::string debugName = "")
inline ArgSig output(poplar::Tensor similar, std::string debugName = "")
inline ArgSig created(std::string debugName = "")
struct ArgSig

Public Functions

inline ArgSig(ArgType type, poplar::Tensor tensor, std::string debugName)

Public Members

ArgType type
poplar::Tensor similarTensor
std::string debugName
class ProgramFunction

Public Functions

ProgramFunction(poplar::Graph &graph, Signature sig, std::function<poplar::program::Program(std::vector<poplar::Tensor>&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {})
ProgramFunction(poplar::Graph &graph, Signature sig, std::function<poplar::program::Program(std::vector<poplar::Tensor>&, const poplar::DebugNameAndId&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {})
poplar::program::Program operator()(std::vector<poplar::Tensor> &args, const poplar::DebugContext &debugContext = {})

Private Members

VoidFunction voidFunc
class TensorFunction

Public Functions

TensorFunction(poplar::Graph &graph, Signature sig, std::function<poplar::Tensor(std::vector<poplar::Tensor>&, poplar::program::Sequence&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {})
TensorFunction(poplar::Graph &graph, Signature sig, std::function<poplar::Tensor(std::vector<poplar::Tensor>&, poplar::program::Sequence&, const poplar::DebugNameAndId&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {})
poplar::Tensor operator()(std::vector<poplar::Tensor> &args, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})

Private Members

VoidFunction voidFunc
class VoidFunction

Public Functions

VoidFunction(VoidFunction &&fn)
VoidFunction(poplar::Graph &graph, Signature sig, std::function<void(std::vector<poplar::Tensor>&, poplar::program::Sequence&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {})
VoidFunction(poplar::Graph &graph, Signature sig, std::function<void(std::vector<poplar::Tensor>&, poplar::program::Sequence&, const poplar::DebugNameAndId&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {})
void operator()(std::vector<poplar::Tensor> &args, poplar::program::Sequence &seq, const poplar::DebugContext &dc = {})

Private Members

poplar::Graph &graph
Signature sig
bool inlined
poplar::program::Sequence prog
poplar::Function func
std::vector<poplar::Tensor> params