VectorListTypes

#include <poplar/VectorListTypes.hpp>

A VectorList is a list of vectors with a specific layout and with the usage semantics of a 2D vector.

A 1D vector must be laid out in a contiguous memory region. A 2D vector is a vector of 1D vectors. Each of these 1D vectors that make up a 2D vector is called a “sub-vector” for the remainder of this document. The elements of a 2D vector can be accessed by indexing the 2D vector along the outer and inner dimensions as A[outer][inner].

The following two categories of layouts are supported:

  1. VectorListLayout::DELTANELEMENTS is a memory efficient 2D vector layout. For legacy systems VectorListLayout::DELTAN served a similar purpose. Each sub-vector must be laid out as a contiguous memory region but the sub-vectors may may not be laid out contiguous with respect to each other in memory. Each sub-vector may have a different length.

  2. VectorListLayout::ONE_PTR and other VectorListLayout layouts that are prefixed by SCALED_PTR are for Poplar runtime use only.

template<typename T, unsigned MinAlign, bool Interleaved>
struct V2DLayoutEnumToType<T, VectorListLayout::DELTAN, MinAlign, Interleaved>

Public Types

using type = BaseAndDeltas<T, MinAlign>
template<typename T, unsigned MinAlign, bool Interleaved>
struct V2DLayoutEnumToType<T, VectorListLayout::DELTANELEMENTS, MinAlign, Interleaved>

Public Types

using type = BaseAndDeltasElements<T, MinAlign>
namespace poplar

Poplar classes and functions.

template<typename T, unsigned MinAlign>
struct BaseAndDelta

Public Functions

inline void *begin() const
inline BaseAndDelta &operator++()
inline bool operator==(const BaseAndDelta &rhs) const
inline bool operator!=(const BaseAndDelta &rhs) const
inline size_t size() const
inline bool empty() const
inline T &operator[](std::size_t index)
inline const T &operator[](std::size_t index) const

Public Members

uintptr_t base
const DeltaN *p
template<typename T, unsigned MinAlign>
struct BaseAndDeltaElements

Public Functions

inline void *begin() const
inline BaseAndDeltaElements &operator++()
inline bool operator==(const BaseAndDeltaElements &rhs) const
inline bool operator!=(const BaseAndDeltaElements &rhs) const
inline size_t size() const
inline bool empty() const
inline T &operator[](std::size_t index)
inline const T &operator[](std::size_t index) const

Public Members

uintptr_t base
const DeltaNElements *p
struct BaseAndDeltaElementsBase

Subclassed by poplar::BaseAndDeltasElements< T, MinAlign >

Public Functions

inline void setN(uint16_t n_)
inline unsigned size() const
inline BaseAndDeltaElementsBase(uintptr_t base, unsigned n, DeltaNElements *deltaNE)
BaseAndDeltaElementsBase() = default
inline void setBase(uintptr_t base_)
inline void setDeltaN(void *addr)
inline uintptr_t getBase() const
inline DeltaNElements *getDeltaN() const

Private Members

uint32_t base
uint32_t nA
uint32_t deltaN
uint32_t nB
template<typename T, unsigned MinAlign>
struct BaseAndDeltas : public poplar::BaseAndDeltasBase

Public Types

typedef BaseAndDelta<T, MinAlign> iterator

Public Functions

inline const iterator operator[](std::size_t index) const
inline iterator operator[](std::size_t index)
inline size_t size() const
inline bool empty() const
struct BaseAndDeltasBase

Subclassed by poplar::BaseAndDeltas< T, MinAlign >

Public Functions

BaseAndDeltasBase() = delete
inline uintptr_t getBase() const
inline ScaledPtr32VectorBase<DeltaN, 4> getDeltaN()
inline size_t getN() const

Public Members

uint16_t n
ScaledPtr32VectorBase<DeltaN, 4> deltaN

Private Members

uint16_t baseA
uint16_t baseB
template<typename T, unsigned MinAlign>
struct BaseAndDeltasElements : public poplar::BaseAndDeltaElementsBase

Public Types

typedef BaseAndDeltaElements<T, MinAlign> iterator

Public Functions

inline const iterator operator[](std::size_t index) const
inline iterator operator[](std::size_t index)
inline size_t size() const
inline bool empty() const
struct DeltaN

Public Members

unsigned offset
unsigned n
struct DeltaNElements

Public Functions

inline unsigned getN(unsigned alignment) const
inline unsigned getOffset(unsigned alignment) const
inline void setDeltaNElement(uintptr_t base, uintptr_t address, unsigned n, unsigned alignment)

Public Members

uint32_t packedBits

Public Static Functions

static inline constexpr unsigned log2(unsigned n)
template<typename T, VectorListLayout L, unsigned MinAlign, bool Interleaved>
class InOut<VectorList<T, L, MinAlign, Interleaved>> : public poplar::VectorList<T, L, MinAlign, Interleaved>
#include <VectorListTypes.hpp>

A 2D Input/Output vertex edge with a VectorList layout.

The edge is readable and writeable from the codelet compute() method (see External codelets).

Template Parameters
  • T – Element type.

  • L – Sub-vector layout.

  • MinAlign – The minimum number of bytes that the data address must be a multiple of.

  • Interleaved – Flag that when true indicates that the data must be stored in interleaved memory.

Public Functions

inline const VectorList<T, L, MinAlign, Interleaved> &operator*() const
inline const VectorList<T, L, MinAlign, Interleaved> *operator->() const
inline VectorList<T, L, MinAlign, Interleaved> &operator*()
inline VectorList<T, L, MinAlign, Interleaved> *operator->()
template<typename T, VectorListLayout L, unsigned MinAlign, bool Interleaved>
class Input<VectorList<T, L, MinAlign, Interleaved>> : public poplar::VectorList<T, L, MinAlign, Interleaved>
#include <VectorListTypes.hpp>

A 2D Input vertex edge with a VectorList layout.

The edge is read-only from the codelet compute() method (see External codelets).

Template Parameters
  • T – Element type.

  • L – Sub-vector layout.

  • MinAlign – The minimum number of bytes that the data address must be a multiple of.

  • Interleaved – Flag that when true indicates that the data must be stored in interleaved memory.

Public Functions

inline const VectorList<T, L, MinAlign, Interleaved> &operator*() const
inline const VectorList<T, L, MinAlign, Interleaved> *operator->() const
template<typename T, VectorListLayout L, unsigned MinAlign, bool Interleaved>
class Output<VectorList<T, L, MinAlign, Interleaved>> : public poplar::VectorList<T, L, MinAlign, Interleaved>
#include <VectorListTypes.hpp>

A 2D Output vertex edge with a VectorList layout.

The edge is write-only from the codelet compute() method (see External codelets).

Template Parameters
  • T – Element type.

  • L – Sub-vector layout.

  • MinAlign – The minimum number of bytes that the data address must be a multiple of.

  • Interleaved – Flag that when true indicates that the data must be stored in interleaved memory.

Public Functions

inline const VectorList<T, L, MinAlign, Interleaved> &operator*() const
inline const VectorList<T, L, MinAlign, Interleaved> *operator->() const
inline VectorList<T, L, MinAlign, Interleaved> &operator*()
inline VectorList<T, L, MinAlign, Interleaved> *operator->()
template<typename T, VectorListLayout L, unsigned MinAlign = detail::max(alignof(T), VectorListLayoutTraits<T, L>::MinAlign), bool Interleaved = false>
struct VectorList : public poplar::detail::VectorListBase<T, L, detail::max(alignof(T), VectorListLayoutTraits<T, L>::MinAlign), false>

Subclassed by poplar::InOut< VectorList< T, L, MinAlign, Interleaved > >, poplar::Input< VectorList< T, L, MinAlign, Interleaved > >, poplar::Output< VectorList< T, L, MinAlign, Interleaved > >

namespace detail

Functions

constexpr VectorListLayout resolveCompactDeltaN(const VectorListLayout layout)
template<typename T, VectorListLayout L, unsigned MinAlign, bool Interleaved>
struct V2DLayoutEnumToType
template<typename T, unsigned MinAlign, bool Interleaved> DELTAN, MinAlign, Interleaved >

Public Types

using type = BaseAndDeltas<T, MinAlign>
template<typename T, unsigned MinAlign, bool Interleaved> DELTANELEMENTS, MinAlign, Interleaved >

Public Types

using type = BaseAndDeltasElements<T, MinAlign>
template<typename T, VectorListLayout L, unsigned MinAlign, bool Interleaved>
struct VectorListBase : public V2DLayoutEnumToType::type<T, resolveCompactDeltaN(L), MinAlign, Interleaved>

Subclassed by poplar::VectorList< T, L, MinAlign, Interleaved >