Poplar and PopLibs
CircBuf.hpp
Go to the documentation of this file.
1// Copyright (c) 2017 Graphcore Ltd. All rights reserved.
8#ifndef popops_CircBuf_hpp
9#define popops_CircBuf_hpp
10#include <poplar/Graph.hpp>
11#include <poplar/Program.hpp>
12#include <poplar/Tensor.hpp>
13#include <string>
14
15namespace popops {
16
17class CircBuf {
18public:
30 CircBuf(poplar::Graph &graph, const poplar::Type &dataType, unsigned size,
31 const std::vector<std::size_t> &shape,
32 const poplar::DebugContext &debugContext = {});
33
41 poplar::Tensor prev(unsigned i, poplar::program::Sequence &seq,
42 const poplar::DebugContext &debugContext = {});
43
51 const poplar::DebugContext &debugContext = {});
52
54 poplar::Tensor getIndex() const;
55
57 unsigned size() const;
58
61 poplar::Graph::TileToTensorMapping getTileMapping();
62
63private:
64 poplar::Graph &graph;
65 unsigned size_;
66 poplar::Tensor index;
67 std::vector<std::size_t> shape;
68 // The history buffer may be padded to ensure an integral number of grains
69 unsigned padElements;
70 poplar::Tensor hist;
71};
72
73} // namespace popops
74
75#endif // popops_CircBuf_hpp
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 reference to a subset of tensor elements.
Definition: Tensor.hpp:38
Class representing device data types.
Definition: Type.hpp:42
Program that executes a sequence of programs.
Definition: Program.hpp:77
Common functions, such as elementwise and reductions.
Definition: AllTrue.hpp:15
poplar::Tensor add(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={})
Add each element in A to the corresponding element in B.
Definition: ElementWise.hpp:1664