AI Engine API User Guide (AIE) 2022.2
aie::detail::accum< Class, MinBits, Elems > Class Template Reference

#include <accum.hpp>

Public Types

using value_type = accum_tag_t< Class, MinBits >
 

Public Member Functions

 accum ()
  More...
 
template<unsigned MinBits2>
 accum (const accum< Class, MinBits2, Elems > &acc)
  More...
 
template<typename T >
 accum (const vector< T, Elems > &v, int shift=0)
  More...
 
 accum (storage_t data)
  More...
 
template<typename DstTag >
auto cast_to () const
  More...
 
template<unsigned ElemsOut>
accum< Class, Bits, ElemsOut > extract (unsigned idx) const
  More...
 
template<typename T >
void from_vector (const vector< T, Elems > &v, int shift=0)
  More...
 
template<typename T >
void from_vector_sign (const vector< T, Elems > &v, bool v_sign, int shift=0)
  More...
 
template<unsigned ElemsOut>
accum< Class, Bits, ElemsOut > grow () const
  More...
 
template<unsigned ElemsOut>
accum< Class, Bits, ElemsOut > grow_extract (unsigned idx) const
 
template<unsigned ElemsIn, unsigned Bits2>
accuminsert (unsigned idx, const accum< Class, Bits2, ElemsIn > &acc)
  More...
 
template<unsigned ElemsIn>
accuminsert (unsigned idx, typename accum< Class, Bits, ElemsIn >::storage_t acc)
  More...
 
 operator storage_t () const
  More...
 
 operator vector< cfloat, Elems > () const
  More...
 
 operator vector< float, Elems > () const
  More...
 
template<typename T >
accumoperator= (const vector< T, Elems > &v)
  More...
 
auto to_native () const
  More...
 
auto to_vector () const
  More...
 
template<typename T >
vector< T, Elems > to_vector (int shift=0) const
  More...
 
template<typename T >
vector< T, Elems > to_vector_sign (bool v_sign, int shift=0) const
  More...
 
template<typename T >
vector< T, Elems > to_vector_zip (int shift=0) const
  More...
 
template<typename... SubAccums>
void upd_all (const SubAccums &...subaccums)
  More...
 

Static Public Member Functions

static constexpr unsigned bits ()
  More...
 
static constexpr bool is_complex ()
  More...
 
static constexpr bool is_floating_point ()
  More...
 
static constexpr bool is_real ()
  More...
 
static constexpr unsigned size ()
  More...
 
static constexpr AccumClass value_class ()
  More...
 

Public Attributes

storage_t data
 

Constructor & Destructor Documentation

◆ accum() [1/4]

template<AccumClass Class, unsigned MinBits, unsigned Elems>
aie::detail::accum< Class, MinBits, Elems >::accum ( )
inline

Default constructor. The value of the elements is undefined.

◆ accum() [2/4]

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<unsigned MinBits2>
aie::detail::accum< Class, MinBits, Elems >::accum ( const accum< Class, MinBits2, Elems > &  acc)
inline

Copy constructor.

◆ accum() [3/4]

template<AccumClass Class, unsigned MinBits, unsigned Elems>
aie::detail::accum< Class, MinBits, Elems >::accum ( storage_t  data)
inline

Construct from internal native types.

Parameters
dataData used to construct the accumulator from.

◆ accum() [4/4]

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<typename T >
aie::detail::accum< Class, MinBits, Elems >::accum ( const vector< T, Elems > &  v,
int  shift = 0 
)
inlineexplicit

Construct from a vector. The accumulator class and the vector type must be compatible. The accumulator size and the vector size must be the same.

Parameters
vData used to construct the accumulator from.
shiftUpshift value.

Member Function Documentation

◆ bits()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
static constexpr unsigned aie::detail::accum< Class, MinBits, Elems >::bits ( )
inlinestaticconstexpr

Returns the total size of the accumulator in bits.

◆ cast_to()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<typename DstTag >
auto aie::detail::accum< Class, MinBits, Elems >::cast_to ( ) const
inline

Reinterprets the current accumulator as an accumulator of the given type. The number of elements is automatically computed by the function

Template Parameters
DstTagType the accumulator will be cast to

◆ extract()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<unsigned ElemsOut>
accum<Class, Bits, ElemsOut> aie::detail::accum< Class, MinBits, Elems >::extract ( unsigned  idx) const
inline

Returns a subaccumulator with the contents of a region of the accumulator.

Template Parameters
ElemsOutSize of the returned subaccumulator.
Parameters
idxIndex of the subaccumulator to be returned.

◆ from_vector()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<typename T >
void aie::detail::accum< Class, MinBits, Elems >::from_vector ( const vector< T, Elems > &  v,
int  shift = 0 
)
inline

Updates the contents of the accumulator using the values in the given vector after applying the requested upshift operation.

Parameters
vInput vector.
shiftNumber of bits to be upshifted.

◆ from_vector_sign()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<typename T >
void aie::detail::accum< Class, MinBits, Elems >::from_vector_sign ( const vector< T, Elems > &  v,
bool  v_sign,
int  shift = 0 
)
inline

Note: Not currently functional on this architecture Updates the contents of the accumulator using the values in the given vector after applying the requested upshift operation. Allows for dynamic control of whether the values are considered signed or not.

Parameters
vInput vector.
v_signValues are considered signed or not, regardless of the underlying type.
shiftNumber of bits to be upshifted.

◆ grow()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<unsigned ElemsOut>
accum<Class, Bits, ElemsOut> aie::detail::accum< Class, MinBits, Elems >::grow ( ) const
inline

Returns a copy of the current accumulator in a larger accumulator. The value of the new elements is undefined.

Template Parameters
ElemsOutSize of the output accumulator.

◆ insert() [1/2]

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<unsigned ElemsIn, unsigned Bits2>
accum& aie::detail::accum< Class, MinBits, Elems >::insert ( unsigned  idx,
const accum< Class, Bits2, ElemsIn > &  acc 
)
inline

Updates the contents of a region of the accumulator using the values in the given native subaccumulator and returns a reference to the updated accumulator.

Parameters
idxIndex of the subaccumulator to be replaced.
accNative subaccumulator to be written into the region.

◆ insert() [2/2]

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<unsigned ElemsIn>
accum& aie::detail::accum< Class, MinBits, Elems >::insert ( unsigned  idx,
typename accum< Class, Bits, ElemsIn >::storage_t  acc 
)
inline

Updates the contents of a region of the accumulator using the values in the given native subaccumulator and returns a reference to the updated accumulator.

Parameters
idxIndex of the subaccumulator to be replaced.
accNative subaccumulator to be written into the region.

◆ is_complex()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
static constexpr bool aie::detail::accum< Class, MinBits, Elems >::is_complex ( )
inlinestaticconstexpr

Returns a bool that says whether the element class is a complex number.

◆ is_floating_point()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
static constexpr bool aie::detail::accum< Class, MinBits, Elems >::is_floating_point ( )
inlinestaticconstexpr

Returns a bool that says whether the element class is a floating point number.

◆ is_real()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
static constexpr bool aie::detail::accum< Class, MinBits, Elems >::is_real ( )
inlinestaticconstexpr

Returns a bool that says whether the element class is a real number.

◆ operator storage_t()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
aie::detail::accum< Class, MinBits, Elems >::operator storage_t ( ) const
inline

Operator for conversion to the internal underlying type. If the number of internal subaccumulators is 1, this type matches the native type.

◆ operator vector< cfloat, Elems >()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
aie::detail::accum< Class, MinBits, Elems >::operator vector< cfloat, Elems > ( ) const
inline

Operator for conversion of complex FP32 accumulators to a vector of the same type.

◆ operator vector< float, Elems >()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
aie::detail::accum< Class, MinBits, Elems >::operator vector< float, Elems > ( ) const
inline

Operator for conversion of FP32 accumulators to a vector of the same type.

◆ operator=()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<typename T >
accum& aie::detail::accum< Class, MinBits, Elems >::operator= ( const vector< T, Elems > &  v)
inline

Updates the contents of the accumulator using the values in the given vector. No upshift is applied.

Parameters
vInput vector.

◆ size()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
static constexpr unsigned aie::detail::accum< Class, MinBits, Elems >::size ( )
inlinestaticconstexpr

Returns the number of elements in the accumulator.

◆ to_native()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
auto aie::detail::accum< Class, MinBits, Elems >::to_native ( ) const
inline

Returns the native type of the accumulator. Only valid when the number of subaccumulators is 1.

◆ to_vector() [1/2]

template<AccumClass Class, unsigned MinBits, unsigned Elems>
auto aie::detail::accum< Class, MinBits, Elems >::to_vector ( ) const
inline

Returns the values of the FP32 accumulator in a vector of the requested type.

◆ to_vector() [2/2]

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<typename T >
vector<T, Elems> aie::detail::accum< Class, MinBits, Elems >::to_vector ( int  shift = 0) const
inline

Returns the values of the accumulator in a vector of the requested type, after applying the requested shift-round-saturate operation.

Parameters
shiftNumber of bits that need to be downshifted.

◆ to_vector_sign()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<typename T >
vector<T, Elems> aie::detail::accum< Class, MinBits, Elems >::to_vector_sign ( bool  v_sign,
int  shift = 0 
) const
inline

Note: Not currently functional on this architecture Returns the values of the accumulator in a vector of the requested type, after applying the requested shift-round-saturate operation, with control of the sign of the return type.

Parameters
v_signReturned vector is signed or not, regardless of the underlying type.
shiftNumber of bits that need to be downshifted.

◆ to_vector_zip()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<typename T >
vector<T, Elems> aie::detail::accum< Class, MinBits, Elems >::to_vector_zip ( int  shift = 0) const
inline

Returns the values of the accumulator in a vector of the requested type, after applying the requested shift-round-saturate operation. The values are interleaved as if the accumulator would be split in two parts and zipped.

Parameters
shiftNumber of bits that need to be downshifted.

◆ upd_all()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
template<typename... SubAccums>
void aie::detail::accum< Class, MinBits, Elems >::upd_all ( const SubAccums &...  subaccums)
inline

Updates the contents of the accumulator using the values in the given subaccumulators. Subaccumulators must be of the same class and size.

Parameters
subaccumsList of subaccumulators.

◆ value_class()

template<AccumClass Class, unsigned MinBits, unsigned Elems>
static constexpr AccumClass aie::detail::accum< Class, MinBits, Elems >::value_class ( )
inlinestaticconstexpr

Returns the class of the accumulator elements.


The documentation for this class was generated from the following files: