|
AI Engine API User Guide (AIE-API) 2025.2
|
Loading...
Searching...
No Matches
Initialization
Overview
Operations to initialize vectors and accumulators.
Functions | |
| template<ElemBaseType T, unsigned Elems = native_vector_length_v<T>, unsigned N> requires (arch::is(arch::Gen2) && detail::utils::is_powerof2(N) && (detail::type_bits_v<T> * N) <= 64) | |
| vector< T, Elems > | aie::broadcast (const T(&a)[N]) |
| Returns a vector whose elements are initialized to a repeating set of values. | |
| template<Elem E, unsigned Elems = native_vector_length_v<E>> | |
| vector< operand_base_type_t< E >, Elems > | aie::broadcast (E a) |
| Returns a vector whose elements are initialized to the given value. | |
| template<unsigned N, ElemBaseType T, unsigned Elems = native_vector_length_v<T>, unsigned Elems2> requires (arch::is(arch::Gen2) && detail::utils::is_powerof2(N) && N <= Elems) | |
| vector< T, Elems > | aie::broadcast_vector (const vector< T, Elems2 > &v, unsigned index) |
| Returns a vector whose elements are initialized to a repeating set of values. | |
| template<Accum Acc, Accum... Accums> requires ((is_same_accum_v<Acc, Accums> && ...)) | |
| auto | aie::concat (const Acc &acc, const Accums &...accums) -> accum< typename Acc::value_type, Acc::size() *(1+sizeof...(Accums))> |
| Concatenate the contents of all input accumulators into a larger accumulator. | |
| template<Vector Vec, Vector... Vectors> requires ((is_same_vector_v<Vec, Vectors> && ...)) | |
| auto | aie::concat (const Vec &v, const Vectors &...vectors) -> vector< typename Vec::value_type, Vec::size() *(1+sizeof...(Vectors))> |
| Concatenate the contents of all input vectors into a larger vector. | |
| template<ElemBaseType T, unsigned Elems = native_vector_length_v<T>> | |
| vector< T, Elems > | aie::zeros () |
| Returns a vector whose elements are initialized to zero. | |
Function Documentation
◆ broadcast() [1/2]
template<ElemBaseType T, unsigned Elems = native_vector_length_v<T>, unsigned N>
requires (arch::is(arch::Gen2) && detail::utils::is_powerof2(N) && (detail::type_bits_v<T> * N) <= 64)
requires (arch::is(arch::Gen2) && detail::utils::is_powerof2(N) && (detail::type_bits_v<T> * N) <= 64)
| vector< T, Elems > aie::broadcast | ( | const T(&) | a[N] | ) |
Returns a vector whose elements are initialized to a repeating set of values.
- Template Parameters
-
T Element type of the result vector. Elems Size of the result vector. N Number of repeating elements. The combined number of bits must be small to fit in a scalar value (64bit or smaller).
- Parameters
-
a Set of values. Its elements must meet aie::ElemBaseType.
◆ broadcast() [2/2]
template<Elem E, unsigned Elems = native_vector_length_v<E>>
| vector< operand_base_type_t< E >, Elems > aie::broadcast | ( | E | a | ) |
◆ broadcast_vector()
template<unsigned N, ElemBaseType T, unsigned Elems = native_vector_length_v<T>, unsigned Elems2>
requires (arch::is(arch::Gen2) && detail::utils::is_powerof2(N) && N <= Elems)
requires (arch::is(arch::Gen2) && detail::utils::is_powerof2(N) && N <= Elems)
| vector< T, Elems > aie::broadcast_vector | ( | const vector< T, Elems2 > & | v, |
| unsigned | index ) |
Returns a vector whose elements are initialized to a repeating set of values.
unsigned i = 0;
while (i < Elems)
for (unsigned j = index * N; j < (index + 1) * N; ++j)
out[i++] = v[j];
- Template Parameters
-
N Number of repeating elements. T Element type of the result vector. Elems Size of the result vector. Elems2 Size of the vector where to get values to be broadcast from
- Parameters
-
v Vector with the values to be broadcast index Index of the sequence of N elements to be broadcast
◆ concat() [1/2]
template<Accum Acc, Accum... Accums>
requires ((is_same_accum_v<Acc, Accums> && ...))
requires ((is_same_accum_v<Acc, Accums> && ...))
| auto aie::concat | ( | const Acc & | acc, |
| const Accums &... | accums ) -> accum<typename Acc::value_type, Acc::size() * (1 + sizeof...(Accums))> |
Concatenate the contents of all input accumulators into a larger accumulator.
All input accumulators must have the same type and size.
- Parameters
-
acc First input accumulator. accums Rest of input accumulators.
◆ concat() [2/2]
template<Vector Vec, Vector... Vectors>
requires ((is_same_vector_v<Vec, Vectors> && ...))
requires ((is_same_vector_v<Vec, Vectors> && ...))
| auto aie::concat | ( | const Vec & | v, |
| const Vectors &... | vectors ) -> vector<typename Vec::value_type, Vec::size() * (1 + sizeof...(Vectors))> |
Concatenate the contents of all input vectors into a larger vector.
All input vectors must have the same type and size.
- Parameters
-
v First input vector. vectors Rest of input vectors.
◆ zeros()
template<ElemBaseType T, unsigned Elems = native_vector_length_v<T>>
| vector< T, Elems > aie::zeros | ( | ) |
Returns a vector whose elements are initialized to zero.
for(unsigned i = 0; i < Elems; ++i)
out[i] = 0;
- Template Parameters
-
E. Element type of the returned vector. Elems. Size of the vector.