Vectors can be reinterpreted as vectors with a different element type, as long as they have the same total size.
v2 = v.cast_to<
int32>(v);
v3 = aie::vector_cast<cint16>(v);
Definition: aie_declaration.hpp:68
int32_t int32
Definition: types.hpp:64
Vectors can be converted into accumulators. Their values can be shifted into a larger magnitude to implement fixed point precision schemes (this does not apply to floating point accumulators).
acc.from_vector(v,
shift);
shift_bits< T, type_bits_v< T >, Elems > shift
Definition: shift.hpp:119
Definition: aie_declaration.hpp:71
Conversely, accumulators can be converted into vectors. Their values can be shifted down before rounding and saturation is applied (this does not apply to floating point accumulators).
int16_t int16
Definition: types.hpp:63
|
template<AccumElemBaseType AccumTag, VectorOrOp Vec> |
accum< AccumTag, Vec::size()> | aie::from_vector (const Vec &v, const int shift=0) |
| More...
|
|
template<VectorOrOp Vec, typename T2 = Utils::get_prev_integer_type_t<typename Vec::value_type>> |
auto | aie::pack (const Vec &v) -> vector< T2, Vec::size()> |
| More...
|
|
template<typename TR , typename T > |
vector< TR, T::size()> | aie::to_vector (const T &acc, const int shift=0) |
| More...
|
|
template<VectorOrOp Vec, typename T2 = Utils::get_next_integer_type_t<typename Vec::value_type>> |
auto | aie::unpack (const Vec &v) -> vector< T2, Vec::size()> |
| More...
|
|
template<ElemBaseType DstT, Vector Vec> |
auto | aie::vector_cast (const Vec &v) |
| More...
|
|
◆ from_vector()
accum<AccumTag, Vec::size()> aie::from_vector |
( |
const Vec & |
v, |
|
|
const int |
shift = 0 |
|
) |
| |
Returns the values of the passed vector in an accumulator of the requested type after applying the requested upshift operation.
- Parameters
-
v | Input vector. The type must meet VectorOrOp. |
shift | Optional upshift in bits to be applied to output accumulator. This parameter is ignored for floating-point types. |
- Template Parameters
-
AccumTag | Accumulator tag that specifies returned accumulator type. The class must be compatible with the vector type (real/complex). |
◆ pack()
template<
VectorOrOp Vec, typename T2 = Utils::get_prev_integer_type_t<typename Vec::value_type>>
auto aie::pack |
( |
const Vec & |
v | ) |
-> vector<T2, Vec::size()>
|
Returns a conversion of the passed vector to the next smaller integer datatype, with the same number of elements.
- Parameters
-
- Template Parameters
-
T2 | Element type for the returned vector. Can only select between int8/uint8 on AIE1. |
◆ to_vector()
template<typename TR , typename T >
vector<TR, T::size()> aie::to_vector |
( |
const T & |
acc, |
|
|
const int |
shift = 0 |
|
) |
| |
Returns the values of the passed accumulator in a vector of the requested type. The values can be shifted down before rounding and saturation are applied (does not apply to floating point accumulators).
- Parameters
-
acc | Input accumulator. The type must meet AccumOrOp or MmulOrOp. |
shift | Optional downshift in bits to be applied to output data. This parameter is ignored for floating-point types. |
- Template Parameters
-
TR | Element type for the returned vector. |
◆ unpack()
template<
VectorOrOp Vec, typename T2 = Utils::get_next_integer_type_t<typename Vec::value_type>>
auto aie::unpack |
( |
const Vec & |
v | ) |
-> vector<T2, Vec::size()>
|
Returns a conversion of the passed vector to the next larger integer datatype, with the same number of elements.
- Parameters
-
◆ vector_cast()
auto aie::vector_cast |
( |
const Vec & |
v | ) |
|
Reinterpret a vector using a different element type. The returned vector has the same size in bits as the input vector.
- Template Parameters
-
DstT | Element type for the returned vector. |
- Parameters
-