VertexIntrospector

#include <poplar/VertexIntrospector.hpp>
namespace poplar

Poplar classes and functions.

class FieldData
#include <VertexIntrospector.hpp>

Information about a vertex field, including its size and its initial value, if set.

This is used when calculating cycle estimates.

Vertex fields can be scalar, 1D or 2D. For example:

  • Scalar: float, Input<float>.

  • 1D: Vector<float>, Input<Vector<float>>

  • 2D: Input<VectorList<float>>, Vector<Input<Vector<float>>>

The sizes of vertex fields can always be returned, and the initial values can be returned for non-edge fields (float, Vector<float>) and edge fields (Input and so on) that are connected to constants.

Note that 2D fields are vectors of vectors, in other words they are jagged 2D arrays.

Public Functions

FieldData(const FieldData&) = delete
FieldData(FieldData&&) noexcept
virtual ~FieldData()
unsigned rank() const

Return the rank of the field.

  • 0 for scalar fields

  • 1 for 1D

  • 2 for 2D.

std::size_t size() const

Determine the size of the field.

Returns

For scalar fields it returns 1, for 1D fields it returns the size of the vector, and for 2D fields it returns the number of sub-vectors.

std::size_t getSizeAtIndex(std::size_t i) const

Determine the size of the sub-vector for 2D fields.

Throws an error if called on non-2D fields.

Parameters

i – Index of the sub-vector in the 2D field.

Returns

Return the size of the sub-vector for 2D fields.

layout::Vector getProfilerVectorLayout(std::size_t nestingLevel) const

Determine the layout for vector fields.

Parameters

i – The dimension to query, 0 for the outer vector, 1 for the inner.

Returns

The layout for vector fields.

layout::VectorList getProfilerVectorListLayout() const

For VectorList fields, return the layout.

We only support introspecting a VectorList that is the outermost vector.

inline SizeT operator[](std::size_t i) const

Determine size of field.

This is an alternate to getSizeAtIndex(). Instead of field.getSizeAtIndex(i) you can use field[i].size().

std::string name() const

Return the name of the vertex field.

template<typename T>
inline T getInitialValue(const Target &target) const

Get the inital value for a scalar field.

T must be of type scalar. Throws an error if this is not a scalar field.

template<typename T>
inline std::vector<T> getInitialValues(const Target &target) const

Get the initial value for a 1D or 2D vector field.

For 1D fields, T should be a scalar type (for example, float) and for 2D fields, T should be std::vector<>. Throws an error if this is a scalar field.

FieldData(std::unique_ptr<core::FieldData> fd)

Private Functions

template<typename T>
inline void getInitialValuesOverload(const Target &target, std::vector<T> &result) const
template<typename T>
inline void getInitialValuesOverload(const Target &target, std::vector<std::vector<T>> &result) const
void getInitialValues(const Target &target, void *dst, const TypeTraits &traits, std::size_t index = std::numeric_limits<std::size_t>::max()) const

Private Members

std::unique_ptr<core::FieldData> impl
struct SizeT

Public Functions

inline std::size_t size() const

Public Members

std::size_t value
class VertexIntrospector
#include <VertexIntrospector.hpp>

Available to cycle estimators to inspect the shape and initial values of a vertex’s fields.

Public Functions

FieldData getFieldInfo(const std::string &name) const

Information about the vertex field.

Parameters

name – The name of the vertex field as defined in its codelet.

Returns

Information about the vertex field.

ComputeSet getComputeSet() const

Return the compute set that this vertex is in.

VertexIntrospector(std::unique_ptr<core::VertexIntrospector> impl)
VertexIntrospector(VertexIntrospector&&) noexcept
inline const core::VertexIntrospector &getImpl() const

Private Members

std::unique_ptr<core::VertexIntrospector> impl
namespace core