Poplar and PopLibs
CSRFunctions.hpp
1// Copyright (c) 2019 Graphcore Ltd. All rights reserved.
2
3#ifndef poplar_CSRFunctions_hpp
4#define poplar_CSRFunctions_hpp
5
6#include <poplar/Graph.hpp>
7#include <poplar/Program.hpp>
8#include <string>
9
10namespace poplar {
11
48 bool inv = true;
49 bool div0 = true;
50 bool oflo = true;
51 bool esr = true;
52 bool nanoo = true;
53 FloatingPointBehaviour(bool inv, bool div0, bool oflo, bool esr, bool nanoo)
54 : inv(inv), div0(div0), oflo(oflo), esr(esr), nanoo(nanoo) {}
55 FloatingPointBehaviour() = default;
56 FloatingPointBehaviour operator!() const {
57 return FloatingPointBehaviour(!inv, !div0, !oflo, !esr, !nanoo);
58 }
59};
60
79 const FloatingPointBehaviour &behaviour,
80 const DebugContext &debugContext = {});
81
99 const poplar::Tensor &behaviour,
100 const DebugContext &debugContext = {});
101
117 poplar::program::Sequence &prog, bool behaviour,
118 const DebugContext &debugContext = {});
119
153 const FloatingPointBehaviour &clear, const FloatingPointBehaviour &set,
154 const DebugContext &debugContext = {});
155
156} // namespace poplar
157#endif // poplar_CSRFunctions_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
Program that executes a sequence of programs.
Definition: Program.hpp:77
Poplar classes and functions.
Definition: ArrayRef.hpp:14
void setFloatingPointBehaviour(poplar::Graph &graph, poplar::program::Sequence &prog, const FloatingPointBehaviour &behaviour, const DebugContext &debugContext={})
Set the floating point behaviour of a tile.
poplar::Tensor getAndModifyFloatingPointBehaviour(poplar::Graph &graph, poplar::program::Sequence &prog, const FloatingPointBehaviour &clear, const FloatingPointBehaviour &set, const DebugContext &debugContext={})
Get the current state and modify the floating-point behaviour on every tile that belongs to the targe...
void setStochasticRounding(poplar::Graph &graph, poplar::program::Sequence &prog, bool behaviour, const DebugContext &debugContext={})
Set stochastic rounding on or off for the selected tile.
Structure to specify floating point behaviour.
Definition: CSRFunctions.hpp:47