13#ifndef poputil_GraphFunction_hpp
14#define poputil_GraphFunction_hpp
15#include <poplar/DebugContext.hpp>
16#include <poplar/Graph.hpp>
17#include <poplar/Program.hpp>
25enum ArgType { InputArg, OutputArg, InOutArg, CreatedArg };
30 std::string debugName;
32 : type(type), similarTensor(std::move(tensor)),
33 debugName(std::move(debugName)) {}
36inline ArgSig input(
poplar::Tensor similar, std::string debugName =
"") {
37 return ArgSig(InputArg, std::move(similar), std::move(debugName));
40inline ArgSig inout(
poplar::Tensor similar, std::string debugName =
"") {
41 return ArgSig(InOutArg, std::move(similar), std::move(debugName));
44inline ArgSig output(
poplar::Tensor similar, std::string debugName =
"") {
45 return ArgSig(OutputArg, std::move(similar), std::move(debugName));
48inline ArgSig created(std::string debugName =
"") {
52using Signature = std::vector<ArgSig>;
60 std::vector<poplar::Tensor> params;
63 VoidFunction(VoidFunction &&fn);
65 std::function<
void(std::vector<poplar::Tensor> &,
72 std::function<
void(std::vector<poplar::Tensor> &,
79 void operator()(std::vector<poplar::Tensor> &args,
84class ProgramFunction {
85 VoidFunction voidFunc;
101 operator()(std::vector<poplar::Tensor> &args,
105class TensorFunction {
106 VoidFunction voidFunc;
113 bool inlined =
false,
121 bool inlined =
false,
DebugContext gathers the common external parameters of the context of an operation.
Definition: DebugContext.hpp:221
DebugNameAndId bundles a name and a DebugId to facilitate their propagation through function calls.
Definition: DebugContext.hpp:142
A reference to a function stored within a graph.
Definition: GraphElements.hpp:148
This class represents a graph program to be executed on the IPU.
Definition: Graph.hpp:52
A reference to a subset of tensor elements.
Definition: Tensor.hpp:38
This class represents a control program that executes operations on the graph.
Definition: Program.hpp:30
Program that executes a sequence of programs.
Definition: Program.hpp:77
ArgType
Type of argument to function program.
Definition: GraphFunction.hpp:25
General utility functions for building graphs.
Definition: GfloatExprUtil.hpp:23