8#ifndef poplin_Convolution_hpp
9#define poplin_Convolution_hpp
12#include <poplar/Graph.hpp>
13#include <poplar/OptionFlags.hpp>
14#include <poplar/Program.hpp>
47 const ConvParams ¶ms);
62 const ConvParams ¶ms);
77 const ConvParams ¶ms);
242 PlanningCache *cache =
nullptr);
275 const ConvParams ¶ms,
278 PlanningCache *cache =
nullptr);
298 PlanningCache *cache =
nullptr);
319 PlanningCache *cache =
nullptr);
347 const ConvParams ¶ms,
348 bool transposeAndFlipWeights,
352 PlanningCache *cache =
nullptr);
380 bool transposeAndFlipWeights,
384 PlanningCache *cache =
nullptr);
386using ConvPlanParams = std::tuple<
const poplar::Target *,
const ConvParams,
401 PlanningCache &cache);
417 const std::set<ConvPlanParams> &convs,
418 PlanningCache &cache);
466 PlanningCache *cache =
nullptr);
495 PlanningCache *cache =
nullptr);
585 const ConvParams ¶ms,
587 PlanningCache *cache =
nullptr);
608 const ConvParams ¶ms,
610 PlanningCache *cache =
nullptr);
623 const ConvParams &fwdParams,
625 PlanningCache *cache =
nullptr);
655class PlanningCacheImpl;
662 std::size_t size()
const;
664 std::unique_ptr<PlanningCacheImpl> impl;
Data types for convolution parameters.
DebugContext gathers the common external parameters of the context of an operation.
Definition: DebugContext.hpp:221
This class represents a graph program to be executed on the IPU.
Definition: Graph.hpp:52
A set of option/value string flags to be used in various APIs.
Definition: OptionFlags.hpp:24
A target representation.
Definition: Target.hpp:69
A reference to a subset of tensor elements.
Definition: Tensor.hpp:38
Program that executes a sequence of programs.
Definition: Program.hpp:77
Linear algebra functions.
Definition: Cholesky.hpp:14
double getWuPerfectCycleCount(const poplar::Graph &graph, const ConvParams ¶ms)
Calculate the number of cycles to perform the weight update pass assuming maximal utilisation of the ...
void convolutionWeightUpdate(poplar::Graph &graph, const poplar::Tensor &zDeltas, const poplar::Tensor &weights, const poplar::Tensor &activations, ConvParams params, const poplar::Tensor &scale, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Append operations to a poplar::Program to generate and apply the weight update.
poplar::Tensor calculateWeightDeltas(poplar::Graph &graph, const poplar::Tensor &zDeltas, const poplar::Tensor &activations, const ConvParams ¶ms, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Append an operation to a poplar::Program to generate the tensor of weight deltas.
poplar::Tensor convolution(poplar::Graph &graph, const poplar::Tensor &in, const poplar::Tensor &weights, const ConvParams ¶ms, bool transposeAndFlipWeights, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Convolve an input with a set of weights.
void convolutionValidateOptions(const poplar::OptionFlags &options)
Provides an interface to validate the convolution options.
uint64_t getWuFlops(const ConvParams ¶ms)
Calculate minimum number of floating point operations required to perform the weight update pass conv...
poplar::Tensor createBiases(poplar::Graph &graph, const poplar::Tensor &activations, const poplar::DebugContext &debugContext={"biases"})
Create a bias tensor suitable for input to the addBias() function.
poplar::Tensor fullyConnectedWeightTranspose(poplar::Graph &graph, poplar::Tensor weights, const ConvParams ¶ms, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Arranges the weights (activations) such that they are suited for the backward pass in a fully connect...
void addBias(poplar::Graph &graph, const poplar::Tensor &in, const poplar::Tensor &biases, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={})
Adds a program to prog which adds biases to activations tensor.
uint64_t getFwdFlops(const ConvParams ¶ms)
Calculate the minimum number of floating point operations required to perform the forward pass convol...
void convolutionWithOutput(poplar::Graph &graph, const poplar::Tensor &in, const poplar::Tensor &weights, const poplar::Tensor &out, const ConvParams ¶ms, bool transposeAndFlipWeights, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Convolve an input with a set of weights into a pre-allocated output tensor.
void reportWeightUpdatePlanInfo(std::ostream &out, const poplar::Graph &graph, const ConvParams &fwdParams, const poplar::OptionFlags &fwdOptions={}, PlanningCache *cache=nullptr)
Report the convolution plan corresponding to the weight update pass given the forward pass params and...
void convolutionBiasUpdate(poplar::Graph &graph, const poplar::Tensor &zDeltas, const poplar::Tensor &biases, const poplar::Tensor &scale, const poplar::OptionFlags &options, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={})
Add a program to update biases tensor with the gradients derived from the zDeltas tensor.
poplar::Tensor createInput(poplar::Graph &graph, const ConvParams ¶ms, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Create an input tensor for a convolution.
poplar::Tensor createConvOutput(poplar::Graph &graph, const ConvParams ¶ms, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Create an output tensor for a convolution.
void preplanConvolutions(const std::set< ConvPlanParams > &convs, PlanningCache &cache)
uint64_t getBwdFlops(const ConvParams ¶ms)
Calculate the minimum number of floating point operations required to perform the backward pass convo...
double getBwdPerfectCycleCount(const poplar::Graph &graph, const ConvParams ¶ms)
Calculate the number of cycles to perform the backward pass assuming maximal utilisation of the targe...
PlanCosts reportPlanEstimatedCosts(const poplar::Graph &graph, const ConvParams ¶ms, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Report the estimated cycles and memory costs of the convolution plan corresponding to the params and ...
void weightsTransposeChansFlipXY(poplar::Graph &graph, const poplar::Tensor &weightsIn, const poplar::Tensor &weightsOut, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={})
Copy the weights in weightsIn into weightsOut such that each element of the kernel is transposed with...
poplar::Tensor createWeights(poplar::Graph &graph, const ConvParams ¶ms, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Create a weight tensor suitable for use with convolution()
double getFwdPerfectCycleCount(const poplar::Graph &graph, const ConvParams ¶ms)
Calculate the number of cycles to perform the forward pass assuming maximal utilisation of target har...
void reportPlanInfo(std::ostream &out, const poplar::Graph &graph, const ConvParams ¶ms, const poplar::OptionFlags &options={}, PlanningCache *cache=nullptr)
Report the convolution plan corresponding to the params and options provided.
Structure for estimated costs returned by reportPlanEstimatedCosts()
Definition: Convolution.hpp:590