The two main types offered by the AIE API are vectors (aie::vector) and accumulators (aie::accum).
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
int8 | uint8 | int16 | int32 | float | cint16 | cint32 | cfloat |
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 |
An accumulator represents a collection of elements of the same class, typically obtained as a result of a multiplication operation, which is 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 may exceed the range of regular vector types. Accumulators are parametrized by the element class, the required accumulation bits and the number of elements. Element class and accumulation bits are specified via type tags (see Accumulator Element Tags). The accumulation bits define the minimum amount of bits and the AIE API maps them to the nearest native accumulator type that supports the requirement.
Supported accumulator types and sizes
| acc32 | acc40 | acc48 | acc56 | acc64 | acc72 | acc80 | accfloat | cacc32 | cacc40 | cacc48 | cacc56 | cacc64 | cacc72 | cacc80 | caccfloat |
Sizes | 8/16/32/64/128 | 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/64 | 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 |
Native accumulation | 48b | 48b | 48b | 80b | 80b | 80b | 80b | 32b | 48b | 48b | 48b | 80b | 80b | 80b | 80b | 32b |
Portable | Yes | Yes | Yes | Yes | Yes | No | No | Yes | Yes | Yes | Yes | Yes | Yes | No | No | No |
Some comparison operations return masks. A mask is a collection of values that can be 0 or 1.
|
template<AccumElemBaseType MinAccumTag, unsigned Elems> |
using | aie::accum = detail::accum< detail::accum_class_for_tag_v< MinAccumTag >, detail::accum_bits_for_tag_v< MinAccumTag >, Elems > |
| More...
|
|
template<unsigned Elems> |
using | aie::mask = detail::mask< Elems > |
| More...
|
|
template<ElemBaseType T, unsigned Elems = native_vector_length_v<T>, aie_dm_resource Resource = aie_dm_resource::none> |
using | aie::unaligned_vector_ref = detail::unaligned_vector_ref< T, Elems, Resource > |
| More...
|
|
template<ElemBaseType T, unsigned Elems = native_vector_length_v<T>> |
using | aie::vector = detail::vector< T, Elems > |
| More...
|
|
template<ElemBaseType T, unsigned N> |
using | aie::vector_elem_const_ref = detail::vector_elem_const_ref< T, N > |
| More...
|
|
template<ElemBaseType T, unsigned N> |
using | aie::vector_elem_ref = detail::vector_elem_ref< T, N > |
| More...
|
|
template<ElemBaseType T, unsigned Elems = native_vector_length_v<T>, aie_dm_resource Resource = aie_dm_resource::none> |
using | aie::vector_ref = detail::vector_ref< T, Elems, Resource > |
| More...
|
|
◆ accum
using aie::accum = typedef detail::accum<detail::accum_class_for_tag_v<MinAccumTag>, detail::accum_bits_for_tag_v<MinAccumTag>, Elems> |
Type for vector accumulators. The documentation of this class and its members can be found at detail::accum.
- Template Parameters
-
MinAccumTag | Type 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. |
Elems | Number of elements in the accumulator. |
◆ mask
Type for vector element masks. The documentation of this class and its members can be found at detail::mask.
This type is returned by logical operations and used as input in selection operations.
- Template Parameters
-
Elems | Number of elements represented in the mask. |
◆ unaligned_vector_ref
Type for references to vector registers. The documentation of this class and its members can be found at detail::unaligned_vector_ref.
- Template Parameters
-
T | Type of the elements contained in the vector. It must meet ElemBaseType. |
Elems | Number of elements in the vector. |
◆ vector
template<
ElemBaseType T, unsigned Elems = native_vector_length_v<T>>
Type for vector registers. The documentation of this class and its members can be found at detail::vector.
- Template Parameters
-
T | Type of the elements contained in the vector. It must meet ElemBaseType. |
Elems | Number of elements in the vector. |
◆ vector_elem_const_ref
Constant reference to vector element. This is similar to aie::vector_elem_ref, but the element cannot be modified.
- Template Parameters
-
T | Type of the elements contained in the referenced vector. It must meet ElemBaseType. |
Elems | Number of elements in the referenced vector. |
◆ vector_elem_ref
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
-
T | Type of the elements contained in the referenced vector. It must meet ElemBaseType. |
Elems | Number of elements in the referenced vector. |
◆ vector_ref
Type for references to vector registers. The documentation of this class and its members can be found at detail::vector_ref.
- Template Parameters
-
T | Type of the elements contained in the vector. It must meet ElemBaseType. |
Elems | Number of elements in the vector. |