| AI Engine API User Guide (AIE-API) 2026.1

Loading...
Searching...
No Matches
Reshaping

## Overview

AIE API provides operations to change the location of the elements within a vector and to combine the elements from two or more vectors.

## Classes
class | aie::filter_mode< T, Elems >
| Enables precomputation of the filter element selection. More...
class | aie::interleave_unzip_mode< T, Elems >
| Enables precomputation of the interleave element selection. More...
class | aie::interleave_zip_mode< T, Elems >
| Enables precomputation of the interleave element selection. More...

## Functions
template<Vector Vec, ElemBaseType T, unsigned Elems> requires (std::is_same_v<typename Vec::value_type, T> && Vec::size() == Elems)
auto | aie::filter (const Vec &v, filter_mode< T, Elems > mode) -> vector< T, Elems/2 >
| Returns a vector of half the size.
template<Vector Vec>
auto | aie::filter_even (const Vec &v, unsigned chunk_size=1) -> vector< typename Vec::value_type, Vec::size()/2 >
| Returns a vector of half the size whose contents follow the following pattern.
template<Vector Vec>
auto | aie::filter_odd (const Vec &v, unsigned chunk_size=1) -> vector< typename Vec::value_type, Vec::size()/2 >
| Returns a vector of half the size whose contents follow the following pattern.
template<ComplexVector Vec>
auto | aie::imag (const Vec &v) -> detail::remove_complex_t< Vec >
| Gather and return the imaginary components of a complex vector.
template<ComplexElem Elem>
auto | aie::imag (Elem e) -> detail::remove_complex_t< operand_base_type_t< Elem > >
| Return the imaginary component of a complex value.
template<Vector Vec1, Vector Vec2> requires (is_same_vector_v<Vec1, Vec2>)
auto | aie::interleave_unzip (const Vec1 &v, const Vec2 &w, unsigned chunk_size) -> std::pair< aie_dm_resource_remove_t< Vec1 >, aie_dm_resource_remove_t< Vec1 > >
| Picks elements sequentially from the input vectors and writes them alternatively into the output vectors.
template<Vector Vec1, Vector Vec2, ElemBaseType T, unsigned Elems> requires (arch::is(arch::Gen2) && is_same_vector_v<Vec1, Vec2> && std::is_same_v<typename Vec1::value_type, T> && Vec1::size() == Elems)
auto | aie::interleave_unzip (const Vec1 &v1, const Vec2 &v2, const interleave_unzip_mode< T, Elems > &mode) -> std::pair< aie_dm_resource_remove_t< Vec1 >, aie_dm_resource_remove_t< Vec1 > >
| Picks elements sequentially from the input vectors and writes them alternatively into the output vectors.
template<Vector Vec1, Vector Vec2, ElemBaseType T, unsigned Elems> requires (arch::is(arch::Gen2) && is_same_vector_v<Vec1, Vec2> && std::is_same_v<typename Vec1::value_type, T> && Vec1::size() == Elems)
auto | aie::interleave_zip (const Vec1 &v, const Vec2 &w, const interleave_zip_mode< T, Elems > &mode) -> std::pair< aie_dm_resource_remove_t< Vec1 >, aie_dm_resource_remove_t< Vec1 > >
| Picks elements alternatively from the input vectors and writes them sequentially into the output vectors.
template<Vector Vec1, Vector Vec2> requires (is_same_vector_v<Vec1, Vec2>)
auto | aie::interleave_zip (const Vec1 &v, const Vec2 &w, unsigned chunk_size) -> std::pair< aie_dm_resource_remove_t< Vec1 >, aie_dm_resource_remove_t< Vec1 > >
| Picks elements alternatively from the input vectors and writes them sequentially into the output vectors.
template<ComplexVector Vec>
auto | aie::real (const Vec &v) -> detail::remove_complex_t< Vec >
| Gather and return the real components of a complex vector.
template<ComplexElem Elem>
auto | aie::real (Elem e) -> detail::remove_complex_t< operand_base_type_t< Elem > >
| Return the real component of a complex value.
template<Vector Vec>
auto | aie::reverse (const Vec &v) -> aie_dm_resource_remove_t< Vec >
| Returns a vector whose contents are the same as the input vector, but in reverse order.
template<Elem E1, Elem E2, Mask M> requires (is_valid_elem_op_v<E1, E2>)
vector< operand_base_type_t< E1 >, M::size()> | aie::select (const E1 &a, const E2 &b, const M &m)
| Combines the values of the input vector and value into a vector of the same size by using a mask that specifies which is the source input for each element of the output vector.
template<Vector Vec, Elem E, Mask M> requires (is_valid_elem_op_v<E, typename Vec::value_type> && Vec::size() == M::size())
auto | aie::select (const Vec &v, E a, const M &m) -> aie_dm_resource_remove_t< Vec >
| Combines the values of the input vector and value into a vector of the same size by using a mask that specifies which is the source input for each element of the output vector.
template<Vector Vec1, Vector Vec2, Mask M> requires (is_same_vector_v<Vec1, Vec2> && Vec1::size() == M::size())
auto | aie::select (const Vec1 &v1, const Vec2 &v2, const M &m) -> aie_dm_resource_remove_t< Vec1 >
| Combines the values of the two input vectors into a vector of the same size by using a mask that specifies which is the source input for each element of the output vector.
template<Elem E, Vector Vec, Mask M> requires (is_valid_elem_op_v<E, typename Vec::value_type> && Vec::size() == M::size())
auto | aie::select (E a, const Vec &v, const M &m) -> aie_dm_resource_remove_t< Vec >
| Combines the values of the input value and vector into a vector of the same size by using a mask that specifies which is the source input for each element of the output vector.
template<Vector Vec>
auto | aie::shuffle_down (const Vec &v, unsigned n) -> aie_dm_resource_remove_t< Vec >
| Returns a vector whose contents are the same as the input vector, but shifted down by n.
template<Vector Vec>
auto | aie::shuffle_down_fill (const Vec &v, const Vec &fill, unsigned n) -> aie_dm_resource_remove_t< Vec >
| Returns a vector whose contents are the same as the input vector, but shifted down by n.
template<Vector Vec>
auto | aie::shuffle_down_replicate (const Vec &v, unsigned n) -> aie_dm_resource_remove_t< Vec >
| Returns a vector whose contents are the same as the input vector, but shifted down by n.
template<Vector Vec>
auto | aie::shuffle_down_rotate (const Vec &v, unsigned n) -> aie_dm_resource_remove_t< Vec >
| Returns a vector whose contents are the same as the input vector, but shifted down by n (elements wrap around):
template<Vector Vec>
auto | aie::shuffle_up (const Vec &v, unsigned n) -> aie_dm_resource_remove_t< Vec >
| Returns a vector whose contents are the same as the input vector, but shifted up by n.
template<Vector Vec>
auto | aie::shuffle_up_fill (const Vec &v, const Vec &fill, unsigned n) -> aie_dm_resource_remove_t< Vec >
| Returns a vector whose contents are the same as the input vector, but shifted up by n.
template<Vector Vec>
auto | aie::shuffle_up_replicate (const Vec &v, unsigned n) -> aie_dm_resource_remove_t< Vec >
| Returns a vector whose contents are the same as the input vector, but shifted up by n.
template<Vector Vec>
auto | aie::shuffle_up_rotate (const Vec &v, unsigned n) -> aie_dm_resource_remove_t< Vec >
| Returns a vector whose contents are the same as the input vector, but shifted up by n (elements wrap around):
template<Vector Vec>
auto | aie::transpose (const Vec &v, unsigned Row, unsigned Col) -> aie_dm_resource_remove_t< Vec >
| The input vector is interpreted as a row-major matrix of the dimensions specified by Row and Col, the function returns a vector ordered as the transpose of the specified matrix.

## Class Documentation

## ◆ aie::filter_mode

class aie::filter_mode

template<ElemBaseType T, unsigned Elems>
requires (arch::is(arch::Gen2))
class aie::filter_mode< T, Elems >

Enables precomputation of the filter element selection.

Allows to efficiently choose from multiple element selection alternatives at execution time, including odd/even, when performing a filter operation.

Example:

bool condition = evaluated_at_runtime();
auto f = condition? aie::filter_mode<int8, 64>::odd(4)
: aie::filter_mode<int8, 64>::even(2);
aie::vector<int8, 128> v = ...;
aie::vector<int8, 64> w = aie::filter(v, f);
aie::vector
Type for vector registers.
Definition vector.hpp:75
aie::filter_mode::even
static constexpr filter_mode even(unsigned chunk_size) noexcept
Construts a filter_mode object that specifies the same pattern used in filter_even.
Definition aie.hpp:3246
aie::filter_mode::odd
static constexpr filter_mode odd(unsigned chunk_size) noexcept
Construts a filter_mode object that specifies the same pattern used in filter_odd.
Definition aie.hpp:3229
aie::filter
auto filter(const Vec &v, filter_mode< T, Elems > mode) -> vector< T, Elems/2 >
Returns a vector of half the size.
Definition aie.hpp:3273
aie
Base namespace for AIE operations and types.
Definition accum.hpp:34
int8
int8_t int8
Definition types.hpp:20

Template Parameters

  T | Element type of the input vectors to be used in the interleave.
  Elems | Number of elements of the input vectors to be used in the interleave.

See also
  interleave_unzip_mode
  interleave_zip_mode
  filter(const Vec &v, filter_mode<T, Elems> mode)

### Public Member Functions
constexpr | filter_mode (const filter_mode &)=default
| Copy constructor for class filter_mode.
### Static Public Member Functions
static constexpr filter_mode | even (unsigned chunk_size) noexcept
| Construts a filter_mode object that specifies the same pattern used in filter_even.
static constexpr filter_mode | odd (unsigned chunk_size) noexcept
| Construts a filter_mode object that specifies the same pattern used in filter_odd.

#### Constructor & Destructor Documentation

## ◆ filter_mode()

template<ElemBaseType T, unsigned Elems>

aie::filter_mode< T, Elems >::filter_mode | ( | const filter_mode< T, Elems > & |  | ) |
| constexpr default

Copy constructor for class filter_mode.

#### Member Function Documentation

## ◆ even()

template<ElemBaseType T, unsigned Elems>

constexpr filter_mode aie::filter_mode< T, Elems >::even | ( | unsigned | chunk_size | ) |
| inline static constexpr noexcept

Construts a filter_mode object that specifies the same pattern used in filter_even.

Parameters

  chunk_size | Number of contiguous elements taken from the input vector. It must be a power of two.

See also
  filter_even

## ◆ odd()

template<ElemBaseType T, unsigned Elems>

constexpr filter_mode aie::filter_mode< T, Elems >::odd | ( | unsigned | chunk_size | ) |
| inline static constexpr noexcept

Construts a filter_mode object that specifies the same pattern used in filter_odd.

Parameters

  chunk_size | Number of contiguous elements taken from the input vector. It must be a power of two.

See also
  filter_odd

## ◆ aie::interleave_unzip_mode

class aie::interleave_unzip_mode

template<ElemBaseType T, unsigned Elems>
requires (arch::is(arch::Gen2))
class aie::interleave_unzip_mode< T, Elems >

Enables precomputation of the interleave element selection.

Allows to efficiently choose from multiple element selection alternatives at execution time, when performing an interleave_unzip operation.

Example:

bool condition = evaluated_at_runtime();
auto m = condition? aie::interleave_unzip_mode<int8, 64>(4)
: aie::interleave_unzip_mode<int8, 64>(2);
aie::vector<int8, 64> v = ..., w = ...;
auto [even, odd] = aie::interleave_unzip(v, w, m);
aie::interleave_unzip_mode::interleave_unzip_mode
constexpr interleave_unzip_mode(unsigned chunk_size) noexcept
Constructor for class interleave_unzip_mode.
Definition aie.hpp:2983
aie::interleave_unzip_mode
Enables precomputation of the interleave element selection.
Definition aie.hpp:2973
aie::interleave_unzip
auto interleave_unzip(const Vec1 &v, const Vec2 &w, unsigned chunk_size) -> std::pair< aie_dm_resource_remove_t< Vec1 >, aie_dm_resource_remove_t< Vec1 > >
Picks elements sequentially from the input vectors and writes them alternatively into the output vect...
Definition aie.hpp:3069

Template Parameters

  T | Element type of the input vectors to be used in the interleave.
  Elems | Number of elements of the input vectors to be used in the interleave.

See also
  interleave_zip_mode
  filter_mode
  interleave_unzip(const Vec1&, const Vec2&, const interleave_unzip_mode&)

### Public Member Functions
constexpr | interleave_unzip_mode (const interleave_unzip_mode &)=default
| Copy constructor for class interleave_unzip_mode.
constexpr | interleave_unzip_mode (unsigned chunk_size) noexcept
| Constructor for class interleave_unzip_mode.

#### Constructor & Destructor Documentation

## ◆ interleave_unzip_mode() [1/2]

template<ElemBaseType T, unsigned Elems>

aie::interleave_unzip_mode< T, Elems >::interleave_unzip_mode | ( | unsigned | chunk_size | ) |
| inline explicit constexpr noexcept

Constructor for class interleave_unzip_mode.

Parameters

  chunk_size | Number of contiguous elements taken in an interleave_unzip operation. It must be a power of two.

## ◆ interleave_unzip_mode() [2/2]

template<ElemBaseType T, unsigned Elems>

aie::interleave_unzip_mode< T, Elems >::interleave_unzip_mode | ( | const interleave_unzip_mode< T, Elems > & |  | ) |
| constexpr default

Copy constructor for class interleave_unzip_mode.

## ◆ aie::interleave_zip_mode

class aie::interleave_zip_mode

template<ElemBaseType T, unsigned Elems>
requires (arch::is(arch::Gen2))
class aie::interleave_zip_mode< T, Elems >

Enables precomputation of the interleave element selection.

Allows to efficiently choose from multiple element selection alternatives at execution time, when performing an interleave_unzip operation.

Example:

bool condition = evaluated_at_runtime();
auto m = condition? aie::interleave_zip_mode<int8, 64>(4)
: aie::interleave_zip_mode<int8, 64>(2);
aie::vector<int8, 64> v = ..., w = ...;
auto [low, high] = aie::interleave_zip(v, w, m);
aie::interleave_zip_mode::interleave_zip_mode
constexpr interleave_zip_mode(unsigned chunk_size) noexcept
Constructor for class interleave_zip_mode.
Definition aie.hpp:2934
aie::interleave_zip_mode
Enables precomputation of the interleave element selection.
Definition aie.hpp:2924
aie::interleave_zip
auto interleave_zip(const Vec1 &v, const Vec2 &w, unsigned chunk_size) -> std::pair< aie_dm_resource_remove_t< Vec1 >, aie_dm_resource_remove_t< Vec1 > >
Picks elements alternatively from the input vectors and writes them sequentially into the output vect...
Definition aie.hpp:3011

Template Parameters

  T | Element type of the input vectors to be used in the interleave.
  Elems | Number of elements of the input vectors to be used in the interleave.

See also
  interleave_unzip_mode
  interleave_zip(const Vec1&, const Vec2&, const interleave_zip_mode&)

### Public Member Functions
constexpr | interleave_zip_mode (const interleave_zip_mode &)=default
| Copy constructor for class interleave_zip_mode.
constexpr | interleave_zip_mode (unsigned chunk_size) noexcept
| Constructor for class interleave_zip_mode.

#### Constructor & Destructor Documentation

## ◆ interleave_zip_mode() [1/2]

template<ElemBaseType T, unsigned Elems>

aie::interleave_zip_mode< T, Elems >::interleave_zip_mode | ( | unsigned | chunk_size | ) |
| inline explicit constexpr noexcept

Constructor for class interleave_zip_mode.

Parameters

  chunk_size | Number of contiguous elements taken in an interleave_zip operation. It must be a power of two.

## ◆ interleave_zip_mode() [2/2]

template<ElemBaseType T, unsigned Elems>

aie::interleave_zip_mode< T, Elems >::interleave_zip_mode | ( | const interleave_zip_mode< T, Elems > & |  | ) |
| constexpr default

Copy constructor for class interleave_zip_mode.

## Function Documentation

## ◆ filter()

template<Vector Vec, ElemBaseType T, unsigned Elems>
requires (std::is_same_v<typename Vec::value_type, T> && Vec::size() == Elems)

auto aie::filter | ( | const Vec & | v,
|  | filter_mode< T, Elems > | mode )->vector< T, Elems/2 >

Returns a vector of half the size.

The output vector's contents may follow different patterns depending on how filter_mode argument was constructed.

Parameters

  v | Input vector. It must meet aie::Vector.
  mode | Specifies what pattern will be used to pick the contents for the output vector.

See also
  filter_mode
  filter_even
  filter_odd

## ◆ filter_even()

template<Vector Vec>

auto aie::filter_even | ( | const Vec & | v,
|  | unsigned | chunk_size = 1 )->vector< typenameVec::value_type, Vec::size()/2 >

Returns a vector of half the size whose contents follow the following pattern.

out = { v[0:chunk_size), v[2*chunk_size:3*chunk_size), ... }

For example

aie::filter_even(v, 1) = { v[0], v[2], ... }
aie::filter_even(v, 2) = { v[0], v[1], v[4], v[5], ... }
aie::filter_even
auto filter_even(const Vec &v, unsigned chunk_size=1) -> vector< typename Vec::value_type, Vec::size()/2 >
Returns a vector of half the size whose contents follow the following pattern.
Definition aie.hpp:3339

Parameters

  v | Input vector. Must meet aie::Vector.
  chunk_size | Number of contiguous elements taken from the input vector. Must be a power of two.

See also
  filter_mode
  filter(const Vec &v, filter_mode<T, Elems> mode)

## ◆ filter_odd()

template<Vector Vec>

auto aie::filter_odd | ( | const Vec & | v,
|  | unsigned | chunk_size = 1 )->vector< typenameVec::value_type, Vec::size()/2 >

Returns a vector of half the size whose contents follow the following pattern.

out = { v[chunk_size:2*chunk_size), v[3*chunk_size:4*chunk_size), ... }

For example

aie::filter_odd(v, 1) = { v[1], v[3], ... }
aie::filter_odd(v, 2) = { v[2], v[3], v[6], v[7], ... }
aie::filter_odd
auto filter_odd(const Vec &v, unsigned chunk_size=1) -> vector< typename Vec::value_type, Vec::size()/2 >
Returns a vector of half the size whose contents follow the following pattern.
Definition aie.hpp:3302

Parameters

  v | Input vector. Must meet aie::Vector.
  chunk_size | Number of contiguous elements taken from the input vector. Must be a power of two.

See also
  filter_mode
  filter(const Vec &v, filter_mode<T, Elems> mode)

## ◆ imag() [1/2]

template<ComplexVector Vec>

auto aie::imag | ( | const Vec & | v | ) | ->detail::remove_complex_t< Vec >

Gather and return the imaginary components of a complex vector.

Parameters

  v | Complex input vector

## ◆ imag() [2/2]

template<ComplexElem Elem>

auto aie::imag | ( | Elem | e | ) | ->detail::remove_complex_t< operand_base_type_t< Elem > >

Return the imaginary component of a complex value.

Parameters

  e | Complex input

## ◆ interleave_unzip() [1/2]

template<Vector Vec1, Vector Vec2>
requires (is_same_vector_v<Vec1, Vec2>)

auto aie::interleave_unzip | ( | const Vec1 & | v,
|  | const Vec2 & | w,
|  | unsigned | chunk_size )->std::pair< aie_dm_resource_remove_t< Vec1 >, aie_dm_resource_remove_t< Vec1 > >

Picks elements sequentially from the input vectors and writes them alternatively into the output vectors.

out = { v[0:chunk_size], v[2*chunk_size:3*chunk_size], ..., w[0:chunk_size], w[2*chunk_size:3*chunk_size], ..., v[chunk_size:2*chunk_size], v[3*chunk_size:4*chunk_size], ..., w[chunk_size:2*chunk_size], w[3*chunk_size:4*chunk_size], ... }

Parameters

  v | First input vector. Must meet aie::Vector.
  w | Second input vector. Must meet aie::Vector.
  chunk_size | Number of contiguous elements taken from each input vector. It must be a power of two.

## ◆ interleave_unzip() [2/2]

template<Vector Vec1, Vector Vec2, ElemBaseType T, unsigned Elems>
requires (arch::is(arch::Gen2) && is_same_vector_v<Vec1, Vec2> && std::is_same_v<typename Vec1::value_type, T> && Vec1::size() == Elems)

auto aie::interleave_unzip | ( | const Vec1 & | v1,
|  | const Vec2 & | v2,
|  | const interleave_unzip_mode< T, Elems > & | mode )->std::pair< aie_dm_resource_remove_t< Vec1 >, aie_dm_resource_remove_t< Vec1 > >

Picks elements sequentially from the input vectors and writes them alternatively into the output vectors.

In cases where the interleave chunk size is picked at execution time, this overload allows the user to precompute the interleave mode in advance (it is an expensive operation).

Parameters

  v1 | First input vector. Must meet aie::Vector.
  v2 | Second input vector. Must meet aie::Vector.
  mode | Precomputed interleave mode, specifying the number of contiguous elements.

See also
  interleave_unzip_mode
  interleave_unzip(const Vec1&, const Vec2&, unsigned)

## ◆ interleave_zip() [1/2]

template<Vector Vec1, Vector Vec2, ElemBaseType T, unsigned Elems>
requires (arch::is(arch::Gen2) && is_same_vector_v<Vec1, Vec2> && std::is_same_v<typename Vec1::value_type, T> && Vec1::size() == Elems)

auto aie::interleave_zip | ( | const Vec1 & | v,
|  | const Vec2 & | w,
|  | const interleave_zip_mode< T, Elems > & | mode )->std::pair< aie_dm_resource_remove_t< Vec1 >, aie_dm_resource_remove_t< Vec1 > >

Picks elements alternatively from the input vectors and writes them sequentially into the output vectors.

In cases where the interleave chunk size is picked at execution time, this overload allows the user to precompute the interleave mode in advance (it is an expensive operation).

Parameters

  v | First input vector. Must meet aie::Vector.
  w | Second input vector. Must meet aie::Vector.
  mode | Precomputed interleave mode, specifying the number of contiguous elements.

See also
  interleave_zip_mode
  interleave_zip(const Vec1&, const Vec2&, unsigned)

## ◆ interleave_zip() [2/2]

template<Vector Vec1, Vector Vec2>
requires (is_same_vector_v<Vec1, Vec2>)

auto aie::interleave_zip | ( | const Vec1 & | v,
|  | const Vec2 & | w,
|  | unsigned | chunk_size )->std::pair< aie_dm_resource_remove_t< Vec1 >, aie_dm_resource_remove_t< Vec1 > >

Picks elements alternatively from the input vectors and writes them sequentially into the output vectors.

out = { v[0:chunk_size], w[0:chunk_size], v[chunk_size:2*chunk_size], w[chunk_size:2*chunk_size], ... }

Parameters

  v | First input vector. Must meet aie::Vector.
  w | Second input vector. Must meet aie::Vector.
  chunk_size | Number of contiguous elements taken from each input vector. It must be a power of two.

## ◆ real() [1/2]

template<ComplexVector Vec>

auto aie::real | ( | const Vec & | v | ) | ->detail::remove_complex_t< Vec >

Gather and return the real components of a complex vector.

Parameters

  v | Complex input vector

## ◆ real() [2/2]

template<ComplexElem Elem>

auto aie::real | ( | Elem | e | ) | ->detail::remove_complex_t< operand_base_type_t< Elem > >

Return the real component of a complex value.

Parameters

  e | Complex input

## ◆ reverse()

template<Vector Vec>

auto aie::reverse | ( | const Vec & | v | ) | ->aie_dm_resource_remove_t< Vec >

Returns a vector whose contents are the same as the input vector, but in reverse order.

for (unsigned i = 0; i < Elems; ++i)
out[i] = in[Elems - i - 1];

Parameters

  v | Input vector. The type must meet aie::Vector.

## ◆ select() [1/4]

template<Elem E1, Elem E2, Mask M>
requires (is_valid_elem_op_v<E1, E2>)

vector< operand_base_type_t< E1 >, M::size()> aie::select | ( | const E1 & | a,
|  | const E2 & | b,
|  | const M & | m )

Combines the values of the input vector and value into a vector of the same size by using a mask that specifies which is the source input for each element of the output vector.

for (unsigned i = 0; i < Elems; ++i)
out[i] = m[i] == 0? a : b;
aie_dm_resource::a
@ a
Memory access is bound to resource a.
Definition aie_doc.hpp:1380
aie_dm_resource::b
@ b
Memory access is bound to resource b.
Definition aie_doc.hpp:1381

Parameters

  a | Input value. The type must meet aie::Elem.
  b | Input value. The type must meet aie::Elem.
  m | Mask that specifies the source input for each output element. The type must meet aie::Mask.

## ◆ select() [2/4]

template<Vector Vec, Elem E, Mask M>
requires (is_valid_elem_op_v<E, typename Vec::value_type> && Vec::size() == M::size())

auto aie::select | ( | const Vec & | v,
|  | E | a,
|  | const M & | m )->aie_dm_resource_remove_t< Vec >

Combines the values of the input vector and value into a vector of the same size by using a mask that specifies which is the source input for each element of the output vector.

for (unsigned i = 0; i < Elems; ++i)
out[i] = m[i] == 0? v[i] : a;

Parameters

  v | Input vector. The type must meet aie::Vector.
  a | Input value. The type must meet aie::Elem.
  m | Mask that specifies the source input for each output element. The type must meet aie::Mask.

## ◆ select() [3/4]

template<Vector Vec1, Vector Vec2, Mask M>
requires (is_same_vector_v<Vec1, Vec2> && Vec1::size() == M::size())

auto aie::select | ( | const Vec1 & | v1,
|  | const Vec2 & | v2,
|  | const M & | m )->aie_dm_resource_remove_t< Vec1 >

Combines the values of the two input vectors into a vector of the same size by using a mask that specifies which is the source input for each element of the output vector.

for (unsigned i = 0; i < Elems; ++i)
out[i] = m[i] == 0? v1[i] : v2[i];

Parameters

  v1 | First input vector. The type must meet aie::Vector.
  v2 | Second input vector. The type must meet aie::Vector.
  m | Mask that specifies the source input for each output element. The type must meet aie::Mask.

## ◆ select() [4/4]

template<Elem E, Vector Vec, Mask M>
requires (is_valid_elem_op_v<E, typename Vec::value_type> && Vec::size() == M::size())

auto aie::select | ( | E | a,
|  | const Vec & | v,
|  | const M & | m )->aie_dm_resource_remove_t< Vec >

Combines the values of the input value and vector into a vector of the same size by using a mask that specifies which is the source input for each element of the output vector.

for (unsigned i = 0; i < Elems; ++i)
out[i] = m[i] == 0? a : v[i];

Parameters

  a | Input value. The type must meet aie::Elem.
  v | Input vector. The type must meet aie::Vector.
  m | Mask that specifies the source input for each output element. The type must meet aie::Mask.

## ◆ shuffle_down()

template<Vector Vec>

auto aie::shuffle_down | ( | const Vec & | v,
|  | unsigned | n )->aie_dm_resource_remove_t< Vec >

Returns a vector whose contents are the same as the input vector, but shifted down by n.

Elements do not wrap around and new elements are undefined.

for (unsigned i = 0; i < Elems - n; ++i)
out[i] = in[i + n]

Parameters

  v | Input vector. The type must meet aie::Vector.
  n | Distance for the elements to be shifted.

## ◆ shuffle_down_fill()

template<Vector Vec>

auto aie::shuffle_down_fill | ( | const Vec & | v,
|  | const Vec & | fill,
|  | unsigned | n )->aie_dm_resource_remove_t< Vec >

Returns a vector whose contents are the same as the input vector, but shifted down by n.

Elements do not wrap around and new elements are filled from a second vector.

for (unsigned i = 0; i < Elems - n; ++i)
out[i] = in[i + n]
for (unsigned i = 0; i < n; ++i)
out[i + Elems - n] = fill[i]

Parameters

  v | Input vector. The type must meet aie::Vector.
  fill | Second input vector used to fill the elements in the upper part of the output vector.
  n | Distance for the elements to be shifted.

## ◆ shuffle_down_replicate()

template<Vector Vec>

auto aie::shuffle_down_replicate | ( | const Vec & | v,
|  | unsigned | n )->aie_dm_resource_remove_t< Vec >

Returns a vector whose contents are the same as the input vector, but shifted down by n.

Elements do not wrap around and new elements are copies of the last element of the input vector.

for (unsigned i = 0; i < Elems - n; ++i)
out[i] = in[i + n]
for (unsigned i = Elems - n; i < Elems; ++i)
out[i] = in[Elems - 1];

Parameters

  v | Input vector. The type must meet aie::Vector.
  n | Distance for the elements to be shifted.

## ◆ shuffle_down_rotate()

template<Vector Vec>

auto aie::shuffle_down_rotate | ( | const Vec & | v,
|  | unsigned | n )->aie_dm_resource_remove_t< Vec >

Returns a vector whose contents are the same as the input vector, but shifted down by n (elements wrap around):

for (unsigned i = 0; i < Elems; ++i)
out[i] = in[(i + n) % Elems]

Parameters

  v | Input vector. The type must meet aie::Vector.
  n | Distance for the elements to be shifted.

## ◆ shuffle_up()

template<Vector Vec>

auto aie::shuffle_up | ( | const Vec & | v,
|  | unsigned | n )->aie_dm_resource_remove_t< Vec >

Returns a vector whose contents are the same as the input vector, but shifted up by n.

Elements do not wrap around and new elements are undefined.

for (unsigned i = 0; i < Elems - n; ++i)
out[i + n] = in[i]

Parameters

  v | Input vector. The type must meet aie::Vector.
  n | Distance for the elements to be shifted.

## ◆ shuffle_up_fill()

template<Vector Vec>

auto aie::shuffle_up_fill | ( | const Vec & | v,
|  | const Vec & | fill,
|  | unsigned | n )->aie_dm_resource_remove_t< Vec >

Returns a vector whose contents are the same as the input vector, but shifted up by n.

Elements do not wrap around and new elements are filled from a second vector.

for (unsigned i = 0; i < Elems - n; ++i)
out[i + n] = in[i]
for (unsigned i = 0; i < n; ++i)
out[i] = fill[i + Elems - n];

Parameters

  v | Input vector. The type must meet aie::Vector.
  fill | Second input vector used to fill the elements in the lower part of the output vector.
  n | Distance for the elements to be shifted.

## ◆ shuffle_up_replicate()

template<Vector Vec>

auto aie::shuffle_up_replicate | ( | const Vec & | v,
|  | unsigned | n )->aie_dm_resource_remove_t< Vec >

Returns a vector whose contents are the same as the input vector, but shifted up by n.

Elements do not wrap around and new elements are copies of the first element of the input vector.

for (unsigned i = 0; i < Elems - n; ++i)
out[i + n] = in[i]
for (unsigned i = 0; i < n; ++i)
out[i] = in[0];

Parameters

  v | Input vector. The type must meet aie::Vector.
  n | Distance for the elements to be shifted.

## ◆ shuffle_up_rotate()

template<Vector Vec>

auto aie::shuffle_up_rotate | ( | const Vec & | v,
|  | unsigned | n )->aie_dm_resource_remove_t< Vec >

Returns a vector whose contents are the same as the input vector, but shifted up by n (elements wrap around):

for (unsigned i = 0; i < Elems; ++i)
out[i] = in[(i - n) % Elems]

Parameters

  v | Input vector. The type must meet aie::Vector.
  n | Distance for the elements to be shifted.

## ◆ transpose()

template<Vector Vec>

auto aie::transpose | ( | const Vec & | v,
|  | unsigned | Row,
|  | unsigned | Col )->aie_dm_resource_remove_t< Vec >

The input vector is interpreted as a row-major matrix of the dimensions specified by Row and Col, the function returns a vector ordered as the transpose of the specified matrix.

For Row equal to 1, the input vector is returned.

Parameters

  v | Input vector. The type must meet aie::Vector, with number of elements equal to Row * Col.
  Row | Number of rows of the input matrix shape.
  Col | Number of cols of the input matrix shape.