AI Engine API User Guide (AIE) 2023.2
Loading...
Searching...
No Matches
Basic Types

The two main types offered by the AIE API are vectors (aie::vector) and accumulators (aie::accum). More...

Overview

The two main types offered by the AIE API are vectors (aie::vector) and accumulators (aie::accum).

Vector

A vector represents a collection of elements of the same type which is transparently mapped to the corresponding vector registers supported on each architecture. Vectors are parametrized by the element type and the number of elements, and any combination that defines a 128b/256b/512b/1024b vector is supported.

Supported vector types and sizes
Arch.int4uint4int8uint8int16uint16int32uint32bfloat16floatcint16cint32cfloat
AIE 16/32/64/128 16/32/64/128 8/16/32/64 4/8/16/32 4/8/16/32 4/8/16/32 2/4/8/16 2/4/8/16
AIE-ML 32/64/128/256 32/64/128/256 16/32/64/128 16/32/64/128 8/16/32/64 8/16/32/64 4/8/16/32 4/8/16/32 8/16/32/64 4/8/16/32 4/8/16/32 2/4/8/16 2/4/8/16

To declare a vector, specify the desired template parameters following the vector template parameters table. The following example declares a vector variable with 32 elements of type int16:

Type for vector registers.
Definition vector.hpp:107

Refer to Basic Type Initialization for examples of how to initialize vector objects.

Accumulator

An accumulator represents a collection of elements of the same class, typically obtained as a result of a multiplication operation. They are transparently mapped to the corresponding accumulator registers supported on each architecture. Accumulators commonly provide a large amount of bits, allowing users to perform long chains of operations whose intermediate results would otherwise exceed the range of regular vector types. They are parametrized by the element type (see Accumulator Element Types) and the number of elements. Element types specify the class of an element (e.g. integral, floating point, complex) and its minimum amount of bits required. AIE API then maps it to the nearest accumulator type that is supported natively.

Supported accumulator types and sizes
Arch.acc32acc40acc48acc56acc64acc72acc80accfloatcacc32cacc40cacc48cacc56cacc64cacc72cacc80caccfloat
AIE Lanes 8/16/32/64/128 8/16/32/64/128 8/16/32/64/128 4/8/16/32/64 4/8/16/32/64 4/8/16/32/64 4/8/16/32/64 4/8/16/32 4/8/16/32/64 4/8/16/32/64 4/8/16/32/64 2/4/8/16/32 2/4/8/16/32 2/4/8/16/32 2/4/8/16/32 2/4/8/16
Native accumulation 48b 48b 48b 80b 80b 80b 80b 32b 48b 48b 48b 80b 80b 80b 80b 32b
AIE-ML Lanes 8/16/32/64/128 4/8/16/32/64 4/8/16/32/64 4/8/16/32/64 4/8/16/32/64 4/8/16/32/64/128 2/4/8/16/32 2/4/8/16/32 2/4/8/16/32 2/4/8/16/32 2/4/8/16/32 2/4/8/16/32/64
Native accumulation 32b 64b 64b 64b 64b 32b 64b 64b 64b 64b 64b 32b

Like vectors, declaring an accumulator consists of specifying all its template parameters, following the accumulator template parameters table for the accepted combinations when declaring accumulators. For example:

aie::accum<accfloat, 16> my_accumulator;
Type for vector accumulators.
Definition accum.hpp:84

Refer to Basic Type Initialization for examples of how to initialize accumulator objects.

Mask

Some comparison operations return masks. A mask is a collection of values that can be 0 or 1.

aie::mask<64> my_mask;
Type for vector element masks.
Definition mask.hpp:61

Refer to Basic Type Initialization for examples of how to initialize mask objects.

Modules

 Basic Type Initialization
 
 Vector and Accumulator Conversions
 Vectors can be reinterpreted as vectors with a different element type, as long as they have the same total size.
 
 Concepts for Basic Types
 
 Accumulator Element Types
 Accumulators in AIE API rely on the aie::accum class template.
 
 Lazy Operations
 AIE architectures offer multiplication instructions that can perform additional operations on on the input arguments.
 

Classes

class  aie::accum< MinAccumTag, Elems >
 Type for vector accumulators. More...
 
class  aie::mask< Elems >
 Type for vector element masks. More...
 
class  aie::vector< T, Elems >
 Type for vector registers. More...
 
class  aie::vector_elem_const_ref< T, N >
 Constant reference to vector element. More...
 
class  aie::vector_elem_ref< T, N >
 Reference to vector element. More...
 

Typedefs

template<ElemBaseType T, unsigned Elems = native_vector_length_v<T>>
using aie::sparse_vector = detail::sparse_vector< T, Elems >
 Type for sparse vector registers.
 

Class Documentation

◆ aie::accum

class aie::accum
template<AccumElemBaseType MinAccumTag, unsigned Elems>
class aie::accum< MinAccumTag, Elems >

Type for vector accumulators.

Template Parameters
MinAccumTagType tag that specifies the accumulator class and the required number of accumulation bits. Internally, this is rounded up to the smallest native accumulator size that meets the accuracy requirements. It must meet AccumElemBaseType. See also: accumulator element types.
ElemsNumber of elements in the accumulator.

Public Types

using storage_t = typename base_type::storage_t
 Type that holds the actual accumulator's data.
 
using value_type = typename base_type::value_type
 Type of the elements in the accumulator.
 

Public Member Functions

 accum ()=default
 Default constructor.
 
 accum (const accum &)=default
 Copy constructor.
 
template<AccumElemBaseType Tag2>
requires (has_same_representation<Tag2>())
 accum (const accum< Tag2, Elems > &acc)
 Copies another accumulator with the same underlying representation.
 
template<typename T >
 accum (const vector< T, Elems > &v, int shift=0)
 Construct from a vector.
 
 accum (storage_t data)
 Construct from internal storage type.
 
template<typename DstTag >
auto cast_to () const
 Reinterprets the current accumulator as an accumulator of the given type.
 
template<unsigned ElemsOut>
accum< MinAccumTag, ElemsOut > extract (unsigned idx) const
 Returns a subaccumulator with the contents of a region of the accumulator.
 
template<typename T >
void from_vector (const vector< T, Elems > &v, int shift=0)
 Updates the contents of the accumulator using the values in the given vector after applying the requested upshift operation.
 
template<typename T >
void from_vector_sign (const vector< T, Elems > &v, bool v_sign, int shift=0)
 Updates the contents of the accumulator using the values in the given vector after applying the requested upshift operation.
 
template<unsigned ElemsOut>
accum< MinAccumTag, ElemsOut > grow () const
 Returns a copy of the current accumulator in a larger accumulator.
 
template<unsigned ElemsOut>
accum< MinAccumTag, ElemsOut > grow_extract (unsigned idx) const
 Returns a copy of the accumulator with a new size.
 
template<unsigned ElemsIn, AccumElemBaseType Tag2>
accuminsert (unsigned idx, const accum< Tag2, ElemsIn > &acc)
 Updates the contents of a region of the accumulator with a native subaccumulator.
 
template<unsigned ElemsIn>
accuminsert (unsigned idx, typename accum< MinAccumTag, ElemsIn >::storage_t acc)
 Updates the contents of a region of the accumulator using the values in the given native subaccumulator.
 
 operator storage_t () const
 Operator for conversion to the internal underlying type.
 
template<typename T >
requires (detail::accum_class_for_type_v<T> == value_class() && is_floating_point() && size() <= 32)
 operator vector< T, Elems > () const
 Performs the conversion of a FP32/CFP32 accumulator to a vector of the same type.
 
template<typename T >
accumoperator= (const vector< T, Elems > &v)
 Updates the contents of the accumulator using the values in the given vector.
 
auto to_native () const
 Returns the native type of the accumulator.
 
auto to_vector () const
 Returns the values of the FP32 accumulator in a vector of the requested type.
 
template<typename T >
vector< T, Elems > to_vector (int shift=0) const
 Applies shift-round-saturate to the elements of the accumulator and stores the result into a vector of the requested type, keeping the original values unchanged.
 
template<typename T >
vector< T, Elems > to_vector_sign (bool v_sign, int shift=0) const
 Applies shift-round-saturate to the elements of the accumulator and stores the result into a vector of the type and signedness requested.
 
template<typename T >
vector< T, Elems > to_vector_zip (int shift=0) const
 Permutes and applies shift-round-saturate to the elements of the accumulator.
 
template<AccumElemBaseType Tag2, unsigned E2, unsigned... Es>
requires (Elems == (E2 + (Es + ...)) && ((Elems / E2 == Elems / Es) && ...))
void upd_all (const accum< Tag2, E2 > &subacc, const accum< Tag2, Es > &...subaccums)
 Updates the contents of the accumulator using the values in the given subaccumulators.
 

Static Public Member Functions

static constexpr unsigned bits ()
 Returns the total size of the accumulator in bits.
 
static constexpr bool is_complex ()
 Returns true if the element class is a complex number.
 
static constexpr bool is_floating_point ()
 Returns true if the element class is a floating point number.
 
static constexpr bool is_real ()
 Returns true if the element class is a real number.
 
static constexpr unsigned size ()
 Returns the number of elements in the accumulator.
 
static constexpr detail::AccumClass value_class ()
 Returns the class of the accumulator elements.
 

Friends

template<AccumElemBaseType Tag2, unsigned E2>
class accum
 
template<detail::AccumClass Class, unsigned MinBits, unsigned E2>
class accum_base
 

Member Typedef Documentation

◆ storage_t

template<AccumElemBaseType MinAccumTag, unsigned Elems>
using aie::accum< MinAccumTag, Elems >::storage_t = typename base_type::storage_t

Type that holds the actual accumulator's data.

May be different to its native type.

◆ value_type

template<AccumElemBaseType MinAccumTag, unsigned Elems>
using aie::accum< MinAccumTag, Elems >::value_type = typename base_type::value_type

Type of the elements in the accumulator.

Constructor & Destructor Documentation

◆ accum() [1/5]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
aie::accum< MinAccumTag, Elems >::accum ( )
default

Default constructor.

The value of the elements is undefined.

◆ accum() [2/5]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
aie::accum< MinAccumTag, Elems >::accum ( const accum< MinAccumTag, Elems > &  )
default

Copy constructor.

◆ accum() [3/5]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<AccumElemBaseType Tag2>
requires (has_same_representation<Tag2>())
aie::accum< MinAccumTag, Elems >::accum ( const accum< Tag2, Elems > &  acc)
inline

Copies another accumulator with the same underlying representation.

◆ accum() [4/5]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
aie::accum< MinAccumTag, Elems >::accum ( storage_t  data)
inline

Construct from internal storage type.

Parameters
dataData used to construct the accumulator from.

◆ accum() [5/5]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T >
aie::accum< MinAccumTag, 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<AccumElemBaseType MinAccumTag, unsigned Elems>
static constexpr unsigned aie::accum< MinAccumTag, Elems >::bits ( )
inlinestaticconstexpr

Returns the total size of the accumulator in bits.

◆ cast_to()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename DstTag >
auto aie::accum< MinAccumTag, 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<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsOut>
accum< MinAccumTag, ElemsOut > aie::accum< MinAccumTag, 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<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T >
void aie::accum< MinAccumTag, 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<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T >
void aie::accum< MinAccumTag, Elems >::from_vector_sign ( const vector< T, Elems > &  v,
bool  v_sign,
int  shift = 0 
)
inline

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.

Note
Currently functional on AIE-ML or later architectures only.
Parameters
vInput vector.
v_signValues are considered signed or not, regardless of the underlying type.
shiftNumber of bits to be upshifted.

◆ grow()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsOut>
accum< MinAccumTag, ElemsOut > aie::accum< MinAccumTag, 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.

◆ grow_extract()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsOut>
accum< MinAccumTag, ElemsOut > aie::accum< MinAccumTag, Elems >::grow_extract ( unsigned  idx) const
inline

Returns a copy of the accumulator with a new size.

  • Performs an extract(idx) operation when the new size is smaller.
  • Performs a grow() operation when the new size is bigger.
See also
grow<ElemsOut>(unsigned) const
extract<ElemsOut>(unsigned) const

◆ insert() [1/2]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsIn, AccumElemBaseType Tag2>
accum & aie::accum< MinAccumTag, Elems >::insert ( unsigned  idx,
const accum< Tag2, ElemsIn > &  acc 
)
inline

Updates the contents of a region of the accumulator with a native subaccumulator.

Parameters
idxIndex of the subaccumulator to be replaced.
accNative subaccumulator to be written into the region.
Returns
Reference to the updated accumulator.

◆ insert() [2/2]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<unsigned ElemsIn>
accum & aie::accum< MinAccumTag, Elems >::insert ( unsigned  idx,
typename accum< MinAccumTag, ElemsIn >::storage_t  acc 
)
inline

Updates the contents of a region of the accumulator using the values in the given native subaccumulator.

Parameters
idxIndex of the subaccumulator to be replaced.
accNative subaccumulator to be written into the region.
Returns
Reference to the updated accumulator.

◆ is_complex()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
static constexpr bool aie::accum< MinAccumTag, Elems >::is_complex ( )
inlinestaticconstexpr

Returns true if the element class is a complex number.

◆ is_floating_point()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
static constexpr bool aie::accum< MinAccumTag, Elems >::is_floating_point ( )
inlinestaticconstexpr

Returns true if the element class is a floating point number.

◆ is_real()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
static constexpr bool aie::accum< MinAccumTag, Elems >::is_real ( )
inlinestaticconstexpr

Returns true if the element class is a real number.

◆ operator storage_t()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
aie::accum< MinAccumTag, 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< T, Elems >()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T >
requires (detail::accum_class_for_type_v<T> == value_class() && is_floating_point() && size() <= 32)
aie::accum< MinAccumTag, Elems >::operator vector< T, Elems > ( ) const
inline

Performs the conversion of a FP32/CFP32 accumulator to a vector of the same type.

◆ operator=()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T >
accum & aie::accum< MinAccumTag, 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<AccumElemBaseType MinAccumTag, unsigned Elems>
static constexpr unsigned aie::accum< MinAccumTag, Elems >::size ( )
inlinestaticconstexpr

Returns the number of elements in the accumulator.

◆ to_native()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
auto aie::accum< MinAccumTag, 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<AccumElemBaseType MinAccumTag, unsigned Elems>
auto aie::accum< MinAccumTag, Elems >::to_vector ( ) const
inline

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

◆ to_vector() [2/2]

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T >
vector< T, Elems > aie::accum< MinAccumTag, Elems >::to_vector ( int  shift = 0) const
inline

Applies shift-round-saturate to the elements of the accumulator and stores the result into a vector of the requested type, keeping the original values unchanged.

Parameters
shiftNumber of bits that need to be downshifted.

◆ to_vector_sign()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T >
vector< T, Elems > aie::accum< MinAccumTag, Elems >::to_vector_sign ( bool  v_sign,
int  shift = 0 
) const
inline

Applies shift-round-saturate to the elements of the accumulator and stores the result into a vector of the type and signedness requested.

The original values are left unchanged.

Note
Currently functional on AIE-ML or later architectures only.
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<AccumElemBaseType MinAccumTag, unsigned Elems>
template<typename T >
vector< T, Elems > aie::accum< MinAccumTag, Elems >::to_vector_zip ( int  shift = 0) const
inline

Permutes and applies shift-round-saturate to the elements of the accumulator.

Then, it stores the result into a vector of the requested type.

The original values are left unchanged.

The values are interleaved as if the accumulator were split in two parts and zipped.

Parameters
shiftNumber of bits that need to be downshifted.

◆ upd_all()

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<AccumElemBaseType Tag2, unsigned E2, unsigned... Es>
requires (Elems == (E2 + (Es + ...)) && ((Elems / E2 == Elems / Es) && ...))
void aie::accum< MinAccumTag, Elems >::upd_all ( const accum< Tag2, E2 > &  subacc,
const accum< Tag2, Es > &...  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
subaccFirst sub-accumulator.
subaccumsRemaining sub-accumulators.

◆ value_class()

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

Returns the class of the accumulator elements.

Friends And Related Symbol Documentation

◆ accum

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<AccumElemBaseType Tag2, unsigned E2>
friend class accum
friend

◆ accum_base

template<AccumElemBaseType MinAccumTag, unsigned Elems>
template<detail::AccumClass Class, unsigned MinBits, unsigned E2>
friend class accum_base
friend

◆ aie::mask

class aie::mask
template<unsigned Elems>
class aie::mask< Elems >

Type for vector element masks.

This type is returned by logical operations and used as input in selection operations.

Template Parameters
ElemsNumber of elements represented in the mask.

Public Member Functions

constexpr mask (bool initial_set=false)
 Creates a mask.
 
template<typename... T>
constexpr mask (unsigned w, T &&... words)
 Construct from unsigned (32b) words.
 
constexpr void clear (unsigned i)
 Sets the value of the element in the given index to 0.
 
constexpr unsigned clz () const
 Returns the count of consecutive elements, starting at the high part of the mask, whose value is 0.
 
constexpr unsigned count () const
 Returns the count of elements whose value is 1.
 
constexpr const std::array< unsigned, num_words > & data () const
 
constexpr bool empty () const
 Returns a bool that says whether the value of all the elements in the mask is 0.
 
constexpr bool full () const
 Returns a bool that says whether the value of all the elements in the mask is 1.
 
template<unsigned ElemsOut>
constexpr mask< ElemsOut > get_submask (unsigned i) const
 Returns the contents of a section of the mask into a smaller mask.
 
constexpr mask operator& (const mask &a) const
 Returns the result of merging the current and the given masks using the AND operation.
 
constexpr maskoperator&= (const mask &a)
 Updates the mask with the result of merging the current with the given masks using the AND operation.
 
constexpr mask operator<< (unsigned shift) const
 Returns the result of a binary left shift of the mask.
 
constexpr maskoperator<<= (unsigned shift)
 Returns the result of a binary left shift of the mask.
 
constexpr bool operator== (const mask &a) const
 Compares whether two masks are equal.
 
constexpr mask operator>> (unsigned shift) const
 Returns the result of a binary right shift of the mask.
 
constexpr maskoperator>>= (unsigned shift)
 Returns the result of a binary right shift of the mask.
 
constexpr mask operator| (const mask &a) const
 Returns the result of merging the current and the given masks using the OR operation.
 
constexpr maskoperator|= (const mask &a)
 Updates the mask with the result of merging the current and the given masks using the OR operation.
 
constexpr mask operator~ () const
 Returns a mask that contains the negation of the values of all the elements in the mask (0->1, 1->0).
 
constexpr void set (unsigned i)
 Sets the value of the element in the given index to 1.
 
constexpr bool test (unsigned i) const
 Returns the value of the element in the given index.
 
template<unsigned Elems2 = Elems>
requires (Elems2 <= 32)
constexpr unsigned to_uint32 () const
 Returns the contents of the mask in a 32b unsigned integer.
 
constexpr unsigned to_uint32 (unsigned i) const
 Returns the contents of a section of the mask in a 32b unsigned integer.
 
template<unsigned Elems2 = Elems>
requires (Elems2 == 64)
constexpr uint64_t to_uint64 () const
 Returns the contents of the mask in a 64b unsigned integer.
 
constexpr uint64_t to_uint64 (unsigned i) const
 Returns the contents of a section of the mask in a 64b unsigned integer.
 

Static Public Member Functions

template<unsigned E, unsigned... Es>
requires (Elems == (E + (Es + ...)) && ((E == Es) && ...))
static constexpr mask< Elems > from_masks (const mask< E > &m, const mask< Es > &... masks)
 Construct from concatenating multiple smaller masks.
 
template<typename... T>
static constexpr mask< Elems > from_uint32 (unsigned w, T &&... words)
 Construct from unsigned (32b) words.
 
template<typename... T>
static constexpr mask< Elems > from_uint64 (uint64_t w, T &&... words)
 Construct from unsigned (64b) words.
 
static constexpr unsigned size ()
 Returns the number of elements in the mask.
 

Friends

template<unsigned Elems2>
class mask
 

Constructor & Destructor Documentation

◆ mask() [1/2]

template<unsigned Elems>
constexpr aie::mask< Elems >::mask ( bool  initial_set = false)
inlineexplicitconstexpr

Creates a mask.

Parameters
initial_setIf true, the mask is initialized with 1s, otherise it is initialized with 0s.

◆ mask() [2/2]

template<unsigned Elems>
template<typename... T>
constexpr aie::mask< Elems >::mask ( unsigned  w,
T &&...  words 
)
inlineexplicitconstexpr

Construct from unsigned (32b) words.

Each bit in the input words is used to initialize one of the elements in the mask.

Parameters
wFirst word used to initialize the mask.
wordsRest of words used to initialize the mask.

Member Function Documentation

◆ clear()

template<unsigned Elems>
constexpr void aie::mask< Elems >::clear ( unsigned  i)
inlineconstexpr

Sets the value of the element in the given index to 0.

Parameters
iElement index.

◆ clz()

template<unsigned Elems>
constexpr unsigned aie::mask< Elems >::clz ( ) const
inlineconstexpr

Returns the count of consecutive elements, starting at the high part of the mask, whose value is 0.

◆ count()

template<unsigned Elems>
constexpr unsigned aie::mask< Elems >::count ( ) const
inlineconstexpr

Returns the count of elements whose value is 1.

◆ data()

template<unsigned Elems>
constexpr const std::array< unsigned, num_words > & aie::mask< Elems >::data ( ) const
inlineconstexpr
Deprecated:
Use alternative functions to access the elements of a mask.
See also
to_uint32, to_uint64, get_submask

◆ empty()

template<unsigned Elems>
constexpr bool aie::mask< Elems >::empty ( ) const
inlineconstexpr

Returns a bool that says whether the value of all the elements in the mask is 0.

◆ from_masks()

template<unsigned Elems>
template<unsigned E, unsigned... Es>
requires (Elems == (E + (Es + ...)) && ((E == Es) && ...))
static constexpr mask< Elems > aie::mask< Elems >::from_masks ( const mask< E > &  m,
const mask< Es > &...  masks 
)
inlinestaticconstexpr

Construct from concatenating multiple smaller masks.

Parameters
wFirst mask used to initialize least significant elements in the new mask.
masksOther masks used to initialize the rest of the elements.

◆ from_uint32()

template<unsigned Elems>
template<typename... T>
static constexpr mask< Elems > aie::mask< Elems >::from_uint32 ( unsigned  w,
T &&...  words 
)
inlinestaticconstexpr

Construct from unsigned (32b) words.

Each bit in the input words is used to initialize one of the elements in the mask.

Parameters
wFirst word used to initialize the mask.
wordsRest of words used to initialize the mask.

◆ from_uint64()

template<unsigned Elems>
template<typename... T>
static constexpr mask< Elems > aie::mask< Elems >::from_uint64 ( uint64_t  w,
T &&...  words 
)
inlinestaticconstexpr

Construct from unsigned (64b) words.

Each bit in the input words is used to initialize one of the elements in the mask.

Parameters
wFirst word used to initialize the mask.
wordsRest of words used to initialize the mask.

◆ full()

template<unsigned Elems>
constexpr bool aie::mask< Elems >::full ( ) const
inlineconstexpr

Returns a bool that says whether the value of all the elements in the mask is 1.

◆ get_submask()

template<unsigned Elems>
template<unsigned ElemsOut>
constexpr mask< ElemsOut > aie::mask< Elems >::get_submask ( unsigned  i) const
inlineconstexpr

Returns the contents of a section of the mask into a smaller mask.

Template Parameters
ElemsOutSize of the returned mask
Parameters
iIndex of the section within th mask (in chunks of ElemsOut elements)

◆ operator&()

template<unsigned Elems>
constexpr mask aie::mask< Elems >::operator& ( const mask< Elems > &  a) const
inlineconstexpr

Returns the result of merging the current and the given masks using the AND operation.

Parameters
aMask to merge with.

◆ operator&=()

template<unsigned Elems>
constexpr mask & aie::mask< Elems >::operator&= ( const mask< Elems > &  a)
inlineconstexpr

Updates the mask with the result of merging the current with the given masks using the AND operation.

Returns a reference to the updated mask.

Parameters
aMask to merge with.

◆ operator<<()

template<unsigned Elems>
constexpr mask aie::mask< Elems >::operator<< ( unsigned  shift) const
inlineconstexpr

Returns the result of a binary left shift of the mask.

Parameters
shiftNumber of positions to shift the mask.

◆ operator<<=()

template<unsigned Elems>
constexpr mask & aie::mask< Elems >::operator<<= ( unsigned  shift)
inlineconstexpr

Returns the result of a binary left shift of the mask.

Returns a reference to the updated mask.

Parameters
shiftNumber of positions to shift the mask.

◆ operator==()

template<unsigned Elems>
constexpr bool aie::mask< Elems >::operator== ( const mask< Elems > &  a) const
inlineconstexpr

Compares whether two masks are equal.

Parameters
aMask to compare against.

◆ operator>>()

template<unsigned Elems>
constexpr mask aie::mask< Elems >::operator>> ( unsigned  shift) const
inlineconstexpr

Returns the result of a binary right shift of the mask.

Parameters
shiftNumber of positions to shift the mask.

◆ operator>>=()

template<unsigned Elems>
constexpr mask & aie::mask< Elems >::operator>>= ( unsigned  shift)
inlineconstexpr

Returns the result of a binary right shift of the mask.

Returns a reference to the updated mask.

Parameters
shiftNumber of positions to shift the mask.

◆ operator|()

template<unsigned Elems>
constexpr mask aie::mask< Elems >::operator| ( const mask< Elems > &  a) const
inlineconstexpr

Returns the result of merging the current and the given masks using the OR operation.

Parameters
aMask to merge with.

◆ operator|=()

template<unsigned Elems>
constexpr mask & aie::mask< Elems >::operator|= ( const mask< Elems > &  a)
inlineconstexpr

Updates the mask with the result of merging the current and the given masks using the OR operation.

Returns a reference to the updated mask.

Parameters
aMask to merge with.

◆ operator~()

template<unsigned Elems>
constexpr mask aie::mask< Elems >::operator~ ( ) const
inlineconstexpr

Returns a mask that contains the negation of the values of all the elements in the mask (0->1, 1->0).

◆ set()

template<unsigned Elems>
constexpr void aie::mask< Elems >::set ( unsigned  i)
inlineconstexpr

Sets the value of the element in the given index to 1.

Parameters
iElement index.

◆ size()

template<unsigned Elems>
static constexpr unsigned aie::mask< Elems >::size ( )
inlinestaticconstexpr

Returns the number of elements in the mask.

◆ test()

template<unsigned Elems>
constexpr bool aie::mask< Elems >::test ( unsigned  i) const
inlineconstexpr

Returns the value of the element in the given index.

Parameters
iElement index.

◆ to_uint32() [1/2]

template<unsigned Elems>
template<unsigned Elems2 = Elems>
requires (Elems2 <= 32)
constexpr unsigned aie::mask< Elems >::to_uint32 ( ) const
inlineconstexpr

Returns the contents of the mask in a 32b unsigned integer.

◆ to_uint32() [2/2]

template<unsigned Elems>
constexpr unsigned aie::mask< Elems >::to_uint32 ( unsigned  i) const
inlineconstexpr

Returns the contents of a section of the mask in a 32b unsigned integer.

Parameters
iIndex of the section within the mask (in chunks of 32 elements)

◆ to_uint64() [1/2]

template<unsigned Elems>
template<unsigned Elems2 = Elems>
requires (Elems2 == 64)
constexpr uint64_t aie::mask< Elems >::to_uint64 ( ) const
inlineconstexpr

Returns the contents of the mask in a 64b unsigned integer.

◆ to_uint64() [2/2]

template<unsigned Elems>
constexpr uint64_t aie::mask< Elems >::to_uint64 ( unsigned  i) const
inlineconstexpr

Returns the contents of a section of the mask in a 64b unsigned integer.

Parameters
iIndex of the section within th mask (in chunks of 64 elements)

Friends And Related Symbol Documentation

◆ mask

template<unsigned Elems>
template<unsigned Elems2>
friend class mask
friend

◆ aie::vector

class aie::vector
template<ElemBaseType T, unsigned Elems>
class aie::vector< T, Elems >

Type for vector registers.

Template Parameters
TType of the elements contained in the vector. It must meet ElemBaseType.
ElemsNumber of elements in the vector.

Public Types

using native_type = typename base_type::native_type
 Equivalent intrinsic type for the same element type and size.
 
using storage_t = typename base_type::storage_t
 Type that holds the actual vector's data.
 
using value_type = typename base_type::value_type
 Type of the elements in the vector.
 

Public Member Functions

 vector ()
 Default constructor.
 
 vector (const native_type &v)
 Construct from internal types.
 
 vector (storage_t v)
 Construct a vector from internal native types.
 
template<typename... Values>
 vector (value_type v, Values &&... values)
 Construct from a list of values.
 
template<typename DstT >
auto cast_to () const
 Reinterprets the current vector as a vector of the given type.
 
constexpr vector_elem_const_ref< value_type, Elems > elem_const_ref (unsigned idx) const
 Returns a constant reference object to the element on the given index.
 
constexpr vector_elem_ref< value_type, Elems > elem_ref (unsigned idx)
 Returns a reference object to the element on the given index.
 
constexpr vector_elem_const_ref< value_type, Elems > elem_ref (unsigned idx) const
 Returns a constant reference object to the element on the given index.
 
template<unsigned ElemsOut>
vector< value_type, ElemsOut > extract (unsigned idx) const
 Returns a subvector with the contents of a region of the vector.
 
value_type get (unsigned idx) const
 Returns the value of the element on the given index.
 
template<unsigned ElemsOut>
constexpr vector< T, ElemsOut > grow (unsigned idx=0) const
 Returns a copy of the current vector in a larger vector.
 
template<unsigned ElemsOut>
vector< value_type, ElemsOut > grow_extract (unsigned idx) const
 Returns a copy of the current vector in a new size.
 
template<unsigned ElemsOut>
constexpr vector< T, ElemsOut > grow_replicate () const
 Returns a copy of the current vector in a larger vector.
 
template<unsigned ElemsIn>
vectorinsert (unsigned idx, const vector< T, ElemsIn > &v)
 Updates the contents of a region of the vector.
 
template<unsigned ElemsIn>
vectorinsert (unsigned idx, typename vector< T, ElemsIn >::native_type v)
 Updates the contents of a region of the vector using.
 
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2 >
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void load (const T2 *ptr)
 Replaces the contents of the vector with the values pointed by the given memory address.
 
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2 >
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void load_unaligned (const T2 *ptr, unsigned aligned_elems)
 Replaces the contents of the vector with the values pointed by the given memory address.
 
 operator native_type () const
 Operator for conversion to the native type.
 
constexpr vector_elem_ref< value_type, Elems > operator[] (unsigned idx)
 Returns a reference object to the element on the given index.
 
constexpr vector_elem_const_ref< value_type, Elems > operator[] (unsigned idx) const
 Returns a constant reference object to the element on the given index.
 
template<typename T2 = typename detail::packed_type<T>::type>
auto pack () const -> vector< T2, Elems >
 Returns a copy of the vector's elements represented in half their number of bits.
 
template<typename T2 = typename detail::packed_type<T>::type>
auto pack_sign (bool v_sign) const -> vector< T2, Elems >
 Returns a copy of the vector's elements represented in half their number of bits.
 
vectorpush (value_type v)
 Adds a new element to the vector, moving existing elements one position up.
 
void set (value_type v, unsigned idx)
 Updates the value of the element on the given index.
 
template<unsigned ElemsOut>
auto split () const -> auto
 Returns the contents of the current vector stored in a std::tuple of subvectors.
 
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2 >
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void store (T2 *ptr) const
 Writes the contents of the vector into the given memory address.
 
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2 >
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void store_unaligned (T2 *ptr, unsigned aligned_elems) const
 Writes the contents of the vector into the given memory address.
 
native_type to_native () const
 Returns the value of the vector using its native type.
 
template<typename T2 = typename detail::unpacked_type<T>::type>
auto unpack () const -> vector< T2, Elems >
 Returns a copy of the vector's elements represented in twice their number of bits.
 
template<typename T2 = typename detail::unpacked_type<T>::type>
auto unpack_sign (bool v_sign) const -> vector< T2, Elems >
 FIXME: AIE1 vs AIE2.
 
template<typename... SubVectors>
vectorupd_all (SubVectors &&...subvectors)
 Updates the contents of the vector using the values in the given subvectors.
 

Static Public Member Functions

static constexpr unsigned bits ()
 Returns the total size of the vector in bits.
 
static constexpr bool is_complex ()
 Returns true if the element type is a complex number.
 
static constexpr bool is_floating_point ()
 Returns true if the element type is floating-point.
 
static constexpr bool is_integral ()
 Returns true if the element type is an integer.
 
static constexpr bool is_real ()
 Returns true if the element type is a real number.
 
static constexpr bool is_signed ()
 Returns true if the element type is signed.
 
static constexpr unsigned size ()
 Returns the number of elements in the vector.
 

Friends

template<ElemBaseType T2, unsigned E2>
class vector
 
template<typename T2 , unsigned E2>
class detail::vector_base
 

Member Typedef Documentation

◆ native_type

template<ElemBaseType T, unsigned Elems>
using aie::vector< T, Elems >::native_type = typename base_type::native_type

Equivalent intrinsic type for the same element type and size.

◆ storage_t

template<ElemBaseType T, unsigned Elems>
using aie::vector< T, Elems >::storage_t = typename base_type::storage_t

Type that holds the actual vector's data.

May be different to its native type.

◆ value_type

template<ElemBaseType T, unsigned Elems>
using aie::vector< T, Elems >::value_type = typename base_type::value_type

Type of the elements in the vector.

Constructor & Destructor Documentation

◆ vector() [1/4]

template<ElemBaseType T, unsigned Elems>
aie::vector< T, Elems >::vector ( )
inline

Default constructor.

The value of the elements is undefined.

◆ vector() [2/4]

template<ElemBaseType T, unsigned Elems>
aie::vector< T, Elems >::vector ( storage_t  v)
inline

Construct a vector from internal native types.

Parameters
vData used to construct the vector from.

◆ vector() [3/4]

template<ElemBaseType T, unsigned Elems>
aie::vector< T, Elems >::vector ( const native_type v)
inline

Construct from internal types.

This is a special case for 1024b internal vector types, which need to be broken into two 512b vectors

Parameters
vData used to construct the vector from

◆ vector() [4/4]

template<ElemBaseType T, unsigned Elems>
template<typename... Values>
aie::vector< T, Elems >::vector ( value_type  v,
Values &&...  values 
)
inlineexplicit

Construct from a list of values.

Parameters
vFirst value in the list
valuesRest of values in the list

Member Function Documentation

◆ bits()

template<ElemBaseType T, unsigned Elems>
static constexpr unsigned aie::vector< T, Elems >::bits ( )
inlinestaticconstexpr

Returns the total size of the vector in bits.

◆ cast_to()

template<ElemBaseType T, unsigned Elems>
template<typename DstT >
auto aie::vector< T, Elems >::cast_to ( ) const
inline

Reinterprets the current vector as a vector of the given type.

The number of elements is automatically computed by the function

Template Parameters
DstTType the vector will be cast to

◆ elem_const_ref()

template<ElemBaseType T, unsigned Elems>
constexpr vector_elem_const_ref< value_type, Elems > aie::vector< T, Elems >::elem_const_ref ( unsigned  idx) const
inlineconstexpr

Returns a constant reference object to the element on the given index.

Parameters
idxIndex of the element.

◆ elem_ref() [1/2]

template<ElemBaseType T, unsigned Elems>
constexpr vector_elem_ref< value_type, Elems > aie::vector< T, Elems >::elem_ref ( unsigned  idx)
inlineconstexpr

Returns a reference object to the element on the given index.

Parameters
idxIndex of the element.

◆ elem_ref() [2/2]

template<ElemBaseType T, unsigned Elems>
constexpr vector_elem_const_ref< value_type, Elems > aie::vector< T, Elems >::elem_ref ( unsigned  idx) const
inlineconstexpr

Returns a constant reference object to the element on the given index.

Parameters
idxIndex of the element.

◆ extract()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsOut>
vector< value_type, ElemsOut > aie::vector< T, Elems >::extract ( unsigned  idx) const
inline

Returns a subvector with the contents of a region of the vector.

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

◆ get()

template<ElemBaseType T, unsigned Elems>
value_type aie::vector< T, Elems >::get ( unsigned  idx) const
inline

Returns the value of the element on the given index.

Parameters
idxIndex of the element.

◆ grow()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsOut>
constexpr vector< T, ElemsOut > aie::vector< T, Elems >::grow ( unsigned  idx = 0) const
inlineconstexpr

Returns a copy of the current vector in a larger vector.

The value of the new elements is undefined.

Template Parameters
ElemsOutSize of the output vector.
Parameters
idxLocation of the subvector within the output vector

◆ grow_extract()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsOut>
vector< value_type, ElemsOut > aie::vector< T, Elems >::grow_extract ( unsigned  idx) const
inline

Returns a copy of the current vector in a new size.

  • Performs an extract(idx) operation when the new size is smaller.
  • Performs a grow(idx) operation when the new size is bigger.
See also
grow<ElemsOut>(unsigned) const
extract<ElemsOut>(unsigned) const

◆ grow_replicate()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsOut>
constexpr vector< T, ElemsOut > aie::vector< T, Elems >::grow_replicate ( ) const
inlineconstexpr

Returns a copy of the current vector in a larger vector.

The contents of the vector are replicated as many times as required to fill the output vector

Template Parameters
ElemsOutSize of the output vector.

◆ insert() [1/2]

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsIn>
vector & aie::vector< T, Elems >::insert ( unsigned  idx,
const vector< T, ElemsIn > &  v 
)
inline

Updates the contents of a region of the vector.

The updated region will contain the values in the given subvector.

Parameters
idxIndex of the subvector to be replaced.
vSubvector to be written into the region.
Returns
a reference to the updated vector.

◆ insert() [2/2]

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsIn>
vector & aie::vector< T, Elems >::insert ( unsigned  idx,
typename vector< T, ElemsIn >::native_type  v 
)
inline

Updates the contents of a region of the vector using.

The updated region will contain the values in the given native subvector.

Parameters
idxIndex of the subvector to be replaced.
vNative subvector to be written into the region.
Returns
a reference to the updated vector.

◆ is_complex()

template<ElemBaseType T, unsigned Elems>
static constexpr bool aie::vector< T, Elems >::is_complex ( )
inlinestaticconstexpr

Returns true if the element type is a complex number.

◆ is_floating_point()

template<ElemBaseType T, unsigned Elems>
static constexpr bool aie::vector< T, Elems >::is_floating_point ( )
inlinestaticconstexpr

Returns true if the element type is floating-point.

◆ is_integral()

template<ElemBaseType T, unsigned Elems>
static constexpr bool aie::vector< T, Elems >::is_integral ( )
inlinestaticconstexpr

Returns true if the element type is an integer.

◆ is_real()

template<ElemBaseType T, unsigned Elems>
static constexpr bool aie::vector< T, Elems >::is_real ( )
inlinestaticconstexpr

Returns true if the element type is a real number.

◆ is_signed()

template<ElemBaseType T, unsigned Elems>
static constexpr bool aie::vector< T, Elems >::is_signed ( )
inlinestaticconstexpr

Returns true if the element type is signed.

◆ load()

template<ElemBaseType T, unsigned Elems>
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2 >
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void aie::vector< T, Elems >::load ( const T2 *  ptr)
inline

Replaces the contents of the vector with the values pointed by the given memory address.

Address is assumed to meet the alignment requirements for vector loads (>= 32 bytes).

Parameters
ptrPointer to the location of the values in memory.

◆ load_unaligned()

template<ElemBaseType T, unsigned Elems>
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2 >
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void aie::vector< T, Elems >::load_unaligned ( const T2 *  ptr,
unsigned  aligned_elems 
)
inline

Replaces the contents of the vector with the values pointed by the given memory address.

Address is assumed to be aligned to the given amount of elements.

Parameters
ptrPointer to the location of the values in memory.
aligned_elemsNumber of elements ptr is aligned to.

◆ operator native_type()

template<ElemBaseType T, unsigned Elems>
aie::vector< T, Elems >::operator native_type ( ) const
inline

Operator for conversion to the native type.

◆ operator[]() [1/2]

template<ElemBaseType T, unsigned Elems>
constexpr vector_elem_ref< value_type, Elems > aie::vector< T, Elems >::operator[] ( unsigned  idx)
inlineconstexpr

Returns a reference object to the element on the given index.

Parameters
idxIndex of the element.

◆ operator[]() [2/2]

template<ElemBaseType T, unsigned Elems>
constexpr vector_elem_const_ref< value_type, Elems > aie::vector< T, Elems >::operator[] ( unsigned  idx) const
inlineconstexpr

Returns a constant reference object to the element on the given index.

Parameters
idxIndex of the element.

◆ pack()

template<ElemBaseType T, unsigned Elems>
template<typename T2 = typename detail::packed_type<T>::type>
auto aie::vector< T, Elems >::pack ( ) const -> vector<T2, Elems>
inline

Returns a copy of the vector's elements represented in half their number of bits.

For example, unpacking a vector of 16b elements will produce a vector of 8b elements.

◆ pack_sign()

template<ElemBaseType T, unsigned Elems>
template<typename T2 = typename detail::packed_type<T>::type>
auto aie::vector< T, Elems >::pack_sign ( bool  v_sign) const -> vector<T2, Elems>
inline

Returns a copy of the vector's elements represented in half their number of bits.

It can specify the sign of the returned type.

Note
Not currently functional on AIE1 architecture
Parameters
v_signReturned vector is signed or not, regardless of the underlying type.

◆ push()

template<ElemBaseType T, unsigned Elems>
vector & aie::vector< T, Elems >::push ( value_type  v)
inline

Adds a new element to the vector, moving existing elements one position up.

Shifts all elements in the vector up and writes the given value into the first position of the vector. The element in the last position of the vector is lost).

Parameters
vValue to be written into the first position of the vector

◆ set()

template<ElemBaseType T, unsigned Elems>
void aie::vector< T, Elems >::set ( value_type  v,
unsigned  idx 
)
inline

Updates the value of the element on the given index.

Parameters
vValue to write.
idxIndex of the element whose value is updated.

◆ size()

template<ElemBaseType T, unsigned Elems>
static constexpr unsigned aie::vector< T, Elems >::size ( )
inlinestaticconstexpr

Returns the number of elements in the vector.

◆ split()

template<ElemBaseType T, unsigned Elems>
template<unsigned ElemsOut>
auto aie::vector< T, Elems >::split ( ) const -> auto
inline

Returns the contents of the current vector stored in a std::tuple of subvectors.

Template Parameters
ElemsOutSize of each subvector.

◆ store()

template<ElemBaseType T, unsigned Elems>
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2 >
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void aie::vector< T, Elems >::store ( T2 *  ptr) const
inline

Writes the contents of the vector into the given memory address.

Address is assumed to meet the alignment requirements for vector stores (>= 32 bytes).

Parameters
ptrPointer to the location where the vector contents must be written in memory.

◆ store_unaligned()

template<ElemBaseType T, unsigned Elems>
template<aie_dm_resource Resource = aie_dm_resource::none, typename T2 >
requires (std::is_same_v<aie_dm_resource_remove_t<T2>, value_type>)
void aie::vector< T, Elems >::store_unaligned ( T2 *  ptr,
unsigned  aligned_elems 
) const
inline

Writes the contents of the vector into the given memory address.

Address is assumed to be aligned to the given amount of elements.

Parameters
ptrPointer to the location where the vector contents must be written in memory.
aligned_elemsNumber of elements ptr is aligned to.

◆ to_native()

template<ElemBaseType T, unsigned Elems>
native_type aie::vector< T, Elems >::to_native ( ) const
inline

Returns the value of the vector using its native type.

◆ unpack()

template<ElemBaseType T, unsigned Elems>
template<typename T2 = typename detail::unpacked_type<T>::type>
auto aie::vector< T, Elems >::unpack ( ) const -> vector<T2, Elems>
inline

Returns a copy of the vector's elements represented in twice their number of bits.

For example, unpacking a vector of 8b elements will produce a vector of 16b elements.

◆ unpack_sign()

template<ElemBaseType T, unsigned Elems>
template<typename T2 = typename detail::unpacked_type<T>::type>
auto aie::vector< T, Elems >::unpack_sign ( bool  v_sign) const -> vector<T2, Elems>
inline

FIXME: AIE1 vs AIE2.

Returns a copy of the vector's elements represented in twice their number of bits. It can specify the sign of the returned type.

Parameters
v_signReturned vector is signed or not, regardless of the underlying type.

◆ upd_all()

template<ElemBaseType T, unsigned Elems>
template<typename... SubVectors>
vector & aie::vector< T, Elems >::upd_all ( SubVectors &&...  subvectors)
inline

Updates the contents of the vector using the values in the given subvectors.

Subvectors must be of the same type and size.

Parameters
subvectorsList of subvectors.

Friends And Related Symbol Documentation

◆ vector

template<ElemBaseType T, unsigned Elems>
template<ElemBaseType T2, unsigned E2>
friend class vector
friend

◆ detail::vector_base

template<ElemBaseType T, unsigned Elems>
template<typename T2 , unsigned E2>
friend class detail::vector_base
friend

◆ aie::vector_elem_const_ref

class aie::vector_elem_const_ref
template<ElemBaseType T, unsigned N>
class aie::vector_elem_const_ref< T, N >

Constant reference to vector element.

This is similar to aie::vector_elem_ref, but the element cannot be modified.

Template Parameters
TType of the elements contained in the referenced vector. It must meet ElemBaseType.
ElemsNumber of elements in the referenced vector.

Public Types

using parent_type = vector_type
 
using value_type = T
 
using vector_type = vector< T, N >
 

Public Member Functions

constexpr vector_elem_const_ref (const vector_elem_ref< T, N > &ref)
 
value_type get () const
 
 operator value_type () const
 
template<typename T2 >
constexpr bool operator!= (T2 v) const
 
template<typename T2 >
constexpr bool operator< (T2 v) const
 
template<typename T2 >
constexpr bool operator<= (T v) const
 
template<typename T2 >
constexpr bool operator== (T2 v) const
 
template<typename T2 >
constexpr bool operator> (T2 v) const
 
template<typename T2 >
constexpr bool operator>= (T2 v) const
 

Public Attributes

unsigned offset
 
const vector_typeparent
 

Member Typedef Documentation

◆ parent_type

template<ElemBaseType T, unsigned N>
using aie::vector_elem_const_ref< T, N >::parent_type = vector_type

◆ value_type

template<ElemBaseType T, unsigned N>
using aie::vector_elem_const_ref< T, N >::value_type = T

◆ vector_type

template<ElemBaseType T, unsigned N>
using aie::vector_elem_const_ref< T, N >::vector_type = vector<T, N>

Constructor & Destructor Documentation

◆ vector_elem_const_ref()

template<ElemBaseType T, unsigned N>
constexpr aie::vector_elem_const_ref< T, N >::vector_elem_const_ref ( const vector_elem_ref< T, N > &  ref)
inlineconstexpr

Member Function Documentation

◆ get()

template<ElemBaseType T, unsigned N>
value_type aie::vector_elem_const_ref< T, N >::get ( ) const
inline

◆ operator value_type()

template<ElemBaseType T, unsigned N>
aie::vector_elem_const_ref< T, N >::operator value_type ( ) const
inline

◆ operator!=()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_const_ref< T, N >::operator!= ( T2  v) const
inlineconstexpr

◆ operator<()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_const_ref< T, N >::operator< ( T2  v) const
inlineconstexpr

◆ operator<=()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_const_ref< T, N >::operator<= ( v) const
inlineconstexpr

◆ operator==()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_const_ref< T, N >::operator== ( T2  v) const
inlineconstexpr

◆ operator>()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_const_ref< T, N >::operator> ( T2  v) const
inlineconstexpr

◆ operator>=()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_const_ref< T, N >::operator>= ( T2  v) const
inlineconstexpr

Member Data Documentation

◆ offset

template<ElemBaseType T, unsigned N>
unsigned aie::vector_elem_const_ref< T, N >::offset

◆ parent

template<ElemBaseType T, unsigned N>
const vector_type& aie::vector_elem_const_ref< T, N >::parent

◆ aie::vector_elem_ref

class aie::vector_elem_ref
template<ElemBaseType T, unsigned N>
class aie::vector_elem_ref< T, N >

Reference to vector element.

This type is returned by element access functions and represents a proxy to the actual element, which allows for optimizations in the API such as accessing the element from its vector without extracting it. This is common in element / vector operations. Otherwise, the element value is extracted when assigned to a variable of type T.

Template Parameters
TType of the elements contained in the referenced vector. It must meet ElemBaseType.
ElemsNumber of elements in the referenced vector.

Public Types

using parent_type = vector_type
 
using value_type = T
 
using vector_type = vector< T, N >
 

Public Member Functions

value_type get () const
 
 operator value_type () const
 
template<typename T2 >
constexpr bool operator!= (T2 v) const
 
template<typename T2 >
constexpr bool operator< (T2 v) const
 
template<typename T2 >
constexpr bool operator<= (T v) const
 
vector_elem_refoperator= (const value_type &v)
 
vector_elem_refoperator= (const vector_elem_const_ref< T, N > &v)
 
vector_elem_refoperator= (const vector_elem_ref< T, N > &v)
 
template<typename T2 >
constexpr bool operator== (T2 v) const
 
template<typename T2 >
constexpr bool operator> (T2 v) const
 
template<typename T2 >
constexpr bool operator>= (T2 v) const
 

Public Attributes

unsigned offset
 
vector_typeparent
 

Member Typedef Documentation

◆ parent_type

template<ElemBaseType T, unsigned N>
using aie::vector_elem_ref< T, N >::parent_type = vector_type

◆ value_type

template<ElemBaseType T, unsigned N>
using aie::vector_elem_ref< T, N >::value_type = T

◆ vector_type

template<ElemBaseType T, unsigned N>
using aie::vector_elem_ref< T, N >::vector_type = vector<T, N>

Member Function Documentation

◆ get()

template<ElemBaseType T, unsigned N>
value_type aie::vector_elem_ref< T, N >::get ( ) const
inline

◆ operator value_type()

template<ElemBaseType T, unsigned N>
aie::vector_elem_ref< T, N >::operator value_type ( ) const
inline

◆ operator!=()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_ref< T, N >::operator!= ( T2  v) const
inlineconstexpr

◆ operator<()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_ref< T, N >::operator< ( T2  v) const
inlineconstexpr

◆ operator<=()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_ref< T, N >::operator<= ( v) const
inlineconstexpr

◆ operator=() [1/3]

template<ElemBaseType T, unsigned N>
vector_elem_ref & aie::vector_elem_ref< T, N >::operator= ( const value_type v)
inline

◆ operator=() [2/3]

template<ElemBaseType T, unsigned N>
vector_elem_ref & aie::vector_elem_ref< T, N >::operator= ( const vector_elem_const_ref< T, N > &  v)
inline

◆ operator=() [3/3]

template<ElemBaseType T, unsigned N>
vector_elem_ref & aie::vector_elem_ref< T, N >::operator= ( const vector_elem_ref< T, N > &  v)
inline

◆ operator==()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_ref< T, N >::operator== ( T2  v) const
inlineconstexpr

◆ operator>()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_ref< T, N >::operator> ( T2  v) const
inlineconstexpr

◆ operator>=()

template<ElemBaseType T, unsigned N>
template<typename T2 >
constexpr bool aie::vector_elem_ref< T, N >::operator>= ( T2  v) const
inlineconstexpr

Member Data Documentation

◆ offset

template<ElemBaseType T, unsigned N>
unsigned aie::vector_elem_ref< T, N >::offset

◆ parent

template<ElemBaseType T, unsigned N>
vector_type& aie::vector_elem_ref< T, N >::parent

Typedef Documentation

◆ sparse_vector

template<ElemBaseType T, unsigned Elems = native_vector_length_v<T>>
using aie::sparse_vector = typedef detail::sparse_vector<T, Elems>

Type for sparse vector registers.

The documentation of this class and its members can be found at detail::sparse_vector.

Template Parameters
TType of the elements contained in the sparse vector. It must meet ElemBaseType.
ElemsNumber of elements in the sparse vector.