![]() |
AI Engine API User Guide (AIE) 2022.2
|
Implementation of the vector data type
T | Type of the elements contained in the vector. |
Elems | Number of elements in the vector. |
#include <vector.hpp>
Public Types | |
using | native_type = native_vector_type_t< T, Elems > |
using | value_type = T |
Public Member Functions | |
vector () | |
More... | |
vector (const native_type &v) | |
More... | |
template<typename... Values> | |
vector (value_type v, Values &&... values) | |
More... | |
vector (vector_storage_t< T, Elems > v) | |
More... | |
template<typename DstT > | |
auto | cast_to () const |
More... | |
constexpr vector_elem_const_ref< value_type, Elems > | elem_const_ref (unsigned idx) const |
More... | |
constexpr vector_elem_ref< value_type, Elems > | elem_ref (unsigned idx) |
More... | |
constexpr vector_elem_const_ref< value_type, Elems > | elem_ref (unsigned idx) const |
More... | |
template<unsigned ElemsOut> | |
vector< value_type, ElemsOut > | extract (unsigned idx) const |
More... | |
value_type | get (unsigned idx) const |
More... | |
template<unsigned ElemsOut> | |
constexpr vector< T, ElemsOut > | grow (unsigned idx=0) const |
More... | |
template<unsigned ElemsOut> | |
vector< value_type, ElemsOut > | grow_extract (unsigned idx) const |
template<unsigned ElemsOut> | |
constexpr vector< T, ElemsOut > | grow_replicate () const |
More... | |
template<unsigned ElemsIn> | |
vector & | insert (unsigned idx, const vector< T, ElemsIn > &v) |
More... | |
template<unsigned ElemsIn> | |
vector & | insert (unsigned idx, typename vector< T, ElemsIn >::native_type v) |
More... | |
template<aie_dm_resource Resource, typename T2 > | |
void | load (const T2 *ptr) |
More... | |
template<aie_dm_resource Resource, typename T2 > | |
void | load_unaligned (const T2 *ptr, unsigned aligned_elems) |
More... | |
operator native_type () const | |
More... | |
constexpr vector_elem_ref< value_type, Elems > | operator[] (unsigned idx) |
More... | |
constexpr vector_elem_const_ref< value_type, Elems > | operator[] (unsigned idx) const |
More... | |
template<typename T2 > | |
vector< T2, Elems > | pack () const |
More... | |
template<typename T2 > | |
vector< T2, Elems > | pack_sign (bool v_sign) const |
More... | |
vector & | push (value_type v) |
More... | |
void | set (value_type v, unsigned idx) |
More... | |
template<unsigned ElemsOut> | |
auto | split () const |
More... | |
template<aie_dm_resource Resource, typename T2 > | |
void | store (T2 *ptr) const |
More... | |
template<aie_dm_resource Resource, typename T2 > | |
void | store_unaligned (T2 *ptr, unsigned aligned_elems) const |
More... | |
auto | to_native () const |
vector< int16, Elems > | unpack () const |
More... | |
vector< int16, Elems > | unpack_sign (bool v_sign) const |
More... | |
template<typename... SubVectors> | |
vector & | upd_all (SubVectors &&...subvectors) |
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_integral () |
More... | |
static constexpr bool | is_real () |
More... | |
static constexpr bool | is_signed () |
More... | |
static constexpr unsigned | size () |
More... | |
Friends | |
template<typename T2 , unsigned Elems2> | |
class | vector |
More... | |
|
inline |
Default constructor. The value of the elements is undefined.
|
inline |
Construct from internal native types.
v | Data used to construct the vector from. |
|
inline |
Construct from internal types. This is a special case for 1024b internal vector types, which need to be broken into two 512b vectors
v | Data used to construct the vector from |
|
inlineexplicit |
Construct from a list of values
v | First value in the list |
values | Rest of values in the list |
|
inlinestaticconstexpr |
Returns the total size of the vector in bits.
|
inline |
Reinterprets the current vector as a vector of the given type. The number of elements is automatically computed by the function
DstT | Type the vector will be cast to |
|
inlineconstexpr |
Returns a constant reference object to the element on the given index.
idx | Index of the element. |
|
inlineconstexpr |
Returns a reference object to the element on the given index.
idx | Index of the element. |
|
inlineconstexpr |
Returns a constant reference object to the element on the given index.
idx | Index of the element. |
|
inline |
Returns a subvector with the contents of a region of the vector.
ElemsOut | Size of the returned subvector. |
idx | Index of the subvector to be returned. |
|
inline |
Returns the value of the element on the given index.
idx | Index of the element. |
|
inlineconstexpr |
Returns a copy of the current vector in a larger vector. The value of the new elements is undefined.
ElemsOut | Size of the output vector. |
idx | Location of the subvector within the output vector |
|
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
ElemsOut | Size of the output vector. |
|
inline |
Updates the contents of a region of the vector using the values in the given subvector and returns a reference to the updated vector.
idx | Index of the subvector to be replaced. |
v | Subvector to be written into the region. |
|
inline |
Updates the contents of a region of the vector using the values in the given native subvector and returns a reference to the updated vector.
idx | Index of the subvector to be replaced. |
v | Native subvector to be written into the region. |
|
inlinestaticconstexpr |
Returns a bool that says whether the element type is a complex number.
|
inlinestaticconstexpr |
Returns a bool that says whether the element type is floating-point.
|
inlinestaticconstexpr |
Returns a bool that says whether the element type is an integer.
|
inlinestaticconstexpr |
Returns a bool that says whether the element type is a real number.
|
inlinestaticconstexpr |
Returns a bool that says whether the element type is signed.
|
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).
ptr | Pointer to the location of the values in memory. |
|
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.
ptr | Pointer to the location of the values in memory. |
aligned_elems | Number of elements ptr is aligned to. |
|
inline |
Operator for conversion to the native type
|
inlineconstexpr |
Returns a reference object to the element on the given index.
idx | Index of the element. |
|
inlineconstexpr |
Returns a constant reference object to the element on the given index.
idx | Index of the element. |
|
inline |
Converts the current vector of 16b elements into a vector of 8b elements.
|
inline |
Note: Not currently functional on this architecture Converts the current vector of 16b elements into a vector of 8b elements, with control of the sign of the return type.
v_sign | Returned vector is signed or not, regardless of the underlying type. |
|
inline |
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).
v | Value to be written into the first position of the vector |
|
inline |
Updates the value of the element on the given index.
v | Value to write. |
idx | Index of the element whose value is updated. |
|
inlinestaticconstexpr |
Returns the number of elements in the vector.
|
inline |
Returns the contents of the current vector stored in a std::tuple of subvectors.
ElemsOut | Size of each subvector. |
|
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).
ptr | Pointer to the location where the vector contents must be written in memory. |
|
inline |
Writes the contents of the vector into the given memory address. Address is assumed to be aligned to the given amount of elements.
ptr | Pointer to the location where the vector contents must be written in memory. |
aligned_elems | Number of elements ptr is aligned to. |
|
inline |
Converts the current vector of 8b elements into a vector of 16b elements.
|
inline |
Note: Not currently functional on this architecture Converts the current vector of 8b elements into a vector of 16b elements, with control of the sign of the return type.
v_sign | Returned vector is signed or not, regardless of the underlying type. |
|
inline |
Updates the contents of the vector using the values in the given subvectors. Subvectors must be of the same type and size.
subvectors | List of subvectors. |
|
friend |
Type for vector registers. The documentation of this class and its members can be found at detail::vector.
T | Type of the elements contained in the vector. It must meet ElemBaseType. |
Elems | Number of elements in the vector. |