AI Engine API User Guide (AIE) 2022.2
Arithmetic

Overview

AIE API provides a set of functions that implement arithmetic operations on vector types. Operands may be vectors, values or vector element references and the supported operand combinations are:

The following code snippet shows an example that adds two input arrays into an output array using vectors. For simplicity count must be divisible by 8.

void add(int32 * __restrict out,
const int32 * __restrict in1, const int32 * __restrict in2, unsigned count)
{
for (unsigned i = 8; i < count; i += 8) {
aie::vector<int32, 8> vec = aie::add(aie::load_v<8>(in1 + i),
aie::load_v<8>(in2 + i));
aie::store_v(out, vec);
}
}
auto add(const Vec1 &v1, const Vec2 &v2) -> aie_dm_resource_remove_t< Vec1 >
Definition: aie.hpp:2816
T1 * store_v(T1 *ptr, const vector< T2, Elems > &v)
Definition: aie.hpp:842
add_sub_bits< type_bits_v< T >, T, Elems, AddSubOperation::Add > add
Definition: add.hpp:296
Definition: aie_declaration.hpp:68
int32_t int32
Definition: types.hpp:64

Operations that include a multiplication return an accumulator. The API defines a default accumulation for each combination of types, but users may specify a larger number of accumulation bits by explicitly passing an accumulator tag.

// Default accumulation will be used
auto acc = aie::mul(v1, v2);
// 64b accumulation, at least, will be used
auto acc = aie::mul<acc64>(v1, v2);
// For multiply-add operations, the API uses the same accumulation as the given accumulator (cannot be overriden)
auto acc2 = aie::mac(acc, v1, v2);
constexpr auto mac(const Acc &acc, const Vec1 &v1, const Vec2 &v2) -> operand_base_type_t< Acc >
Definition: aie.hpp:3712
constexpr auto mul(const Vec1 &v1, const Vec2 &v2) -> accum< AccumTag, Vec1::size()>
Definition: aie.hpp:3445

Functions

template<Elem E>
constexpr auto aie::abs (const E &a) -> operand_base_type_t< E >
  More...
 
template<Vector Vec>
constexpr auto aie::abs (const Vec &v) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<typename TR = int32, ComplexVector Vec>
constexpr auto aie::abs_square (const Vec &v, int shift=0)
  More...
 
template<unsigned Elems>
constexpr vector< float, Elems > aie::abs_square (const vector< cfloat, Elems > &v)
  More...
 
template<Accum Acc, Vector Vec>
Acc aie::add (const Acc &acc, const Vec &v)
  More...
 
template<Accum Acc, Elem E>
Acc aie::add (const Acc &acc, E a)
  More...
 
template<Vector Vec, Elem E>
auto aie::add (const Vec &v, E a) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<Vector Vec1, Vector Vec2>
auto aie::add (const Vec1 &v1, const Vec2 &v2) -> aie_dm_resource_remove_t< Vec1 >
  More...
 
template<Elem E, Vector Vec>
auto aie::add (E a, const Vec &v) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<Elem E, Vector Vec>
auto aie::bit_and (E a, const Vec &v) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<Elem E, Vector Vec>
auto aie::bit_or (E a, const Vec &v) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<Elem E, Vector Vec>
auto aie::bit_xor (E a, const Vec &v) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<ComplexElem E>
constexpr auto aie::conj (const E &a) -> operand_base_type_t< E >
  More...
 
template<ComplexVector Vec>
auto aie::conj (const Vec &v) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<AccumOrOp Acc, VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::mac (const Acc &acc, const Vec &v, E a) -> operand_base_type_t< Acc >
  More...
 
template<AccumOrOp Acc, VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::mac (const Acc &acc, const Vec1 &v1, const Vec2 &v2) -> operand_base_type_t< Acc >
  More...
 
template<AccumOrOp Acc, ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::mac (const Acc &acc, E a, const Vec &v) -> operand_base_type_t< Acc >
  More...
 
template<AccumOrOp Acc, Vector Vec>
constexpr auto aie::mac_square (const Acc &acc, const Vec &v)
  More...
 
template<Accum Acc, VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::msc (const Acc &acc, const Vec &v, E a) -> aie_dm_resource_remove_t< Acc >
  More...
 
template<Accum Acc, VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::msc (const Acc &acc, const Vec1 &v1, const Vec2 &v2) -> aie_dm_resource_remove_t< Acc >
  More...
 
template<Accum Acc, ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::msc (const Acc &acc, E a, const Vec &v) -> aie_dm_resource_remove_t< Acc >
  More...
 
template<Accum Acc, Vector Vec>
constexpr auto aie::msc_square (const Acc &acc, const Vec &v)
  More...
 
template<VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::mul (const Vec &v, E a)
  More...
 
template<AccumElemBaseType AccumTag, VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::mul (const Vec &v, E a) -> accum< AccumTag, Vec::size()>
  More...
 
template<VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::mul (const Vec1 &v1, const Vec2 &v2)
  More...
 
template<AccumElemBaseType AccumTag, VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::mul (const Vec1 &v1, const Vec2 &v2) -> accum< AccumTag, Vec1::size()>
  More...
 
template<ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::mul (E a, const Vec &v)
  More...
 
template<AccumElemBaseType AccumTag, ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::mul (E a, const Vec &v) -> accum< AccumTag, Vec::size()>
  More...
 
template<Vector Vec>
constexpr auto aie::mul_square (const Vec &v)
  More...
 
template<AccumElemBaseType AccumTag, Vector Vec>
constexpr auto aie::mul_square (const Vec &v) -> accum< AccumTag, Vec::size()>
  More...
 
template<Elem E>
constexpr auto aie::neg (const E &a) -> operand_base_type_t< E >
  More...
 
template<Vector Vec>
constexpr auto aie::neg (const Vec &v) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::negmul (const Vec &v, E a)
  More...
 
template<AccumElemBaseType AccumTag, VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::negmul (const Vec &v, E a) -> accum< AccumTag, Vec::size()>
  More...
 
template<VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::negmul (const Vec1 &v1, const Vec2 &v2)
  More...
 
template<AccumElemBaseType AccumTag, VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::negmul (const Vec1 &v1, const Vec2 &v2) -> accum< AccumTag, Vec1::size()>
  More...
 
template<ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::negmul (E a, const Vec &v)
  More...
 
template<AccumElemBaseType AccumTag, ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::negmul (E a, const Vec &v) -> accum< AccumTag, Vec::size()>
  More...
 
template<Vector Vec, Vector... Others>
auto aie::reduce_add_v (const Vec &v, const Others &... others) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<Accum Acc, Vector Vec>
constexpr auto aie::sub (const Acc &acc, const Vec &v) -> aie_dm_resource_remove_t< Acc >
  More...
 
template<Accum Acc, Elem E>
auto aie::sub (const Acc &acc, E a) -> aie_dm_resource_remove_t< Acc >
  More...
 
template<Vector Vec, Elem E>
auto aie::sub (const Vec &v, E a) -> aie_dm_resource_remove_t< Vec >
  More...
 
template<Vector Vec1, Vector Vec2>
auto aie::sub (const Vec1 &v1, const Vec2 &v2) -> aie_dm_resource_remove_t< Vec1 >
  More...
 
template<Elem E, Vector Vec>
auto aie::sub (E a, const Vec &v) -> aie_dm_resource_remove_t< Vec >
  More...
 

Function Documentation

◆ abs() [1/2]

template<Elem E>
constexpr auto aie::abs ( const E &  a) -> operand_base_type_t<E>
constexpr

Compute the absolute value of a value.

Parameters
aInput value

◆ abs() [2/2]

template<Vector Vec>
constexpr auto aie::abs ( const Vec &  v) -> aie_dm_resource_remove_t<Vec>
constexpr

Compute the absolute value for each element in the given vector.

Parameters
vInput vector

◆ abs_square() [1/2]

template<typename TR = int32, ComplexVector Vec>
constexpr auto aie::abs_square ( const Vec &  v,
int  shift = 0 
)
constexpr

Compute the absolute square of each element in the given complex vector.

For a vector of N complex elements, returns a vector of N integers

for (unsigned i = 0; i < Elems; ++i)
out[i] = v[i].real² + v[i].imag²;
Parameters
vInput complex vector
shiftOptional parameter to control the shift value used in the srs internally
Template Parameters
TRType of returned integer vector, default to int32 but can be set to int16

◆ abs_square() [2/2]

template<unsigned Elems>
constexpr vector<float, Elems> aie::abs_square ( const vector< cfloat, Elems > &  v)
constexpr

Compute the absolute square of each element in the given complex vector.

For a vector of N complex elements, returns a vector of N integers

for (unsigned i = 0; i < Elems; ++i)
out[i] = v[i].real² + v[i].imag²;
Parameters
vInput complex vector

◆ add() [1/5]

template<Accum Acc, Vector Vec>
Acc aie::add ( const Acc &  acc,
const Vec &  v 
)

Returns an accumulator with the element-wise addition of the input accumulator and vector.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] + v[i];
Parameters
accInput accumulator
vInput vector

◆ add() [2/5]

template<Accum Acc, Elem E>
Acc aie::add ( const Acc &  acc,
a 
)

Returns an accumulator with the addition of a value to all the elements of the input vector.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] + a;
Parameters
accInput accumulator
aValue. The type must meet Elem.

◆ add() [3/5]

template<Vector Vec, Elem E>
auto aie::add ( const Vec &  v,
a 
) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the addition of a value to all the elements of the input vector. The type of the value and the type of the vector elements must be the same.

for (unsigned i = 0; i < Elems; ++i)
out[i] = v[i] + a;
Parameters
vInput vector. The type must meet Vector.
aValue. The type must meet Elem.

◆ add() [4/5]

template<Vector Vec1, Vector Vec2>
auto aie::add ( const Vec1 &  v1,
const Vec2 &  v2 
) -> aie_dm_resource_remove_t<Vec1>

Returns a vector with the element-wise addition of the two input vectors. The vectors must have the same type and size.

for (unsigned i = 0; i < Elems; ++i)
out[i] = v1[i] + v2[i];
Parameters
v1First input vector. The type must meet Vector.
v2Second input vector. The type must meet Vector.

◆ add() [5/5]

template<Elem E, Vector Vec>
auto aie::add ( a,
const Vec &  v 
) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the addition of a value to all the elements of the input vector. The type of the value and the type of the vector elements must be the same.

for (unsigned i = 0; i < Elems; ++i)
out[i] = a + v[i];
Parameters
aValue. The type must meet Elem.
vInput vector. The type must meet Vector.

◆ bit_and()

template<Elem E, Vector Vec>
auto aie::bit_and ( a,
const Vec &  v 
) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the bit-wise AND of a value and all the elements of the input vector. The type of the value and the type of the vector elements must be the same.

for (unsigned i = 0; i < Elems; ++i)
out[i] = a & v[i];
Parameters
aValue. The type must meet Elem.
vInput vector. The type must meet Vector.

◆ bit_or()

template<Elem E, Vector Vec>
auto aie::bit_or ( a,
const Vec &  v 
) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the bit-wise OR of a value and all the elements of the input vector. The type of the value and the type of the vector elements must be the same.

for (unsigned i = 0; i < Elems; ++i)
out[i] = a | v[i];
Parameters
aValue. The type must meet Elem.
vInput vector. The type must meet Vector.

◆ bit_xor()

template<Elem E, Vector Vec>
auto aie::bit_xor ( a,
const Vec &  v 
) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the bit-wise XOR of a value and all the elements of the input vector. The type of the value and the type of the vector elements must be the same.

for (unsigned i = 0; i < Elems; ++i)
out[i] = a ^ v[i];
Parameters
aValue. The type must meet Elem.
vInput vector. The type must meet Vector.

◆ conj() [1/2]

template<ComplexElem E>
constexpr auto aie::conj ( const E &  a) -> operand_base_type_t<E>
constexpr

Compute the conjugate in the given complex value.

Parameters
aInput value

◆ conj() [2/2]

template<ComplexVector Vec>
auto aie::conj ( const Vec &  v) -> aie_dm_resource_remove_t<Vec>

Compute the conjugate for each element in the given vector of complex elements.

Parameters
vInput vector

◆ mac() [1/3]

template<AccumOrOp Acc, VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::mac ( const Acc &  acc,
const Vec &  v,
a 
) -> operand_base_type_t<Acc>
constexpr

Returns an accumulator with the element-wise multiply-add of input vector, value and accumulator. The vector and the accumulator must have the same size and the types of all operands must be compatible. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] + op1(v[i]) * op2(a);
Parameters
accAccumulator to which the result of the multiplication is added (or subtracted). The type must meet AccumOrOp.
vInput vector. The type must meet VectorOrOp.
aInput value. The type must meet ElemOrOp.

◆ mac() [2/3]

template<AccumOrOp Acc, VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::mac ( const Acc &  acc,
const Vec1 &  v1,
const Vec2 &  v2 
) -> operand_base_type_t<Acc>
constexpr

Returns an accumulator with the element-wise multiply-add of the two input vectors and accumulator. The vectors and the accumulator must have the same size and their types must be compatible. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] + op1(v1[i]) * op2(v2[i]);
Parameters
accAccumulator to which the result of the multiplication is added (or subtracted). The type must meet AccumOrOp.
v1First input vector. The type must meet VectorOrOp.
v2Second input vector. The type must meet VectorOrOp.

◆ mac() [3/3]

template<AccumOrOp Acc, ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::mac ( const Acc &  acc,
a,
const Vec &  v 
) -> operand_base_type_t<Acc>
constexpr

Returns an accumulator with the element-wise multiply-add of value, input vector and accumulator. The vector and the accumulator must have the same size and the types of all operands must be compatible. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] + op1(a) * op2(v[i]);
Parameters
accAccumulator to which the result of the multiplication is added (or subtracted). The type must meet AccumOrOp.
aInput value. The type must meet ElemOrOp.
vInput vector. The type must meet VectorOrOp.

◆ mac_square()

template<AccumOrOp Acc, Vector Vec>
constexpr auto aie::mac_square ( const Acc &  acc,
const Vec &  v 
)
constexpr

Returns an accumulator with the addition or subtraction of the given accumulator and the element-wise square of the input vector. The vector and the accumulator must have the same size and their types must be compatible.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] + v[i] * v[i];
Parameters
accInput accumulator. The type must meet AccumOrOp.
vInput vector. The type must meet Vector.

◆ msc() [1/3]

template<Accum Acc, VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::msc ( const Acc &  acc,
const Vec &  v,
a 
) -> aie_dm_resource_remove_t<Acc>
constexpr

Returns an accumulator with the element-wise multiply-add of input vector, value and accumulator. The vector and the accumulator must have the same size and their types must be compatible. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] - op1(v[i]) * op2(a);
Parameters
accAccumulator from which the result of the multiplication is subtracted. The type must meet Accum.
vInput vector. The type must meet VectorOrOp.
aInput value. The type must meet ElemOrOp.

◆ msc() [2/3]

template<Accum Acc, VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::msc ( const Acc &  acc,
const Vec1 &  v1,
const Vec2 &  v2 
) -> aie_dm_resource_remove_t<Acc>
constexpr

Returns an accumulator with the element-wise multiply-add of the two input vectors and accumulator. The vectors and the accumulator must have the same size and the types of all operands must be compatible. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] - op1(v1[i]) * op2(v2[i]);
Parameters
accAccumulator from which the result of the multiplication is subtracted. The type must meet Accum.
v1First input vector. The type must meet VectorOrOp.
v2Second input vector. The type must meet VectorOrOp.

◆ msc() [3/3]

template<Accum Acc, ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::msc ( const Acc &  acc,
a,
const Vec &  v 
) -> aie_dm_resource_remove_t<Acc>
constexpr

Returns an accumulator with the element-wise multiply-add of value, input vector and accumulator. The vector and the accumulator must have the same size and their types must be compatible. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] - op1(a) * op2(v[i]);
Parameters
accAccumulator from which the result of the multiplication is subtracted. The type must meet Accum.
aInput value. The type must meet ElemOrOp.
vInput vector. The type must meet VectorOrOp.

◆ msc_square()

template<Accum Acc, Vector Vec>
constexpr auto aie::msc_square ( const Acc &  acc,
const Vec &  v 
)
constexpr

Returns an accumulator with the subtraction of the given accumulator and the element-wise square of the input vector. The vector and the accumulator must have the same size and their types must be compatible.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] - v[i] * v[i];
Parameters
accInput accumulator. The type must meet Accum.
vInput vector. The type must meet Vector.

◆ mul() [1/6]

template<VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::mul ( const Vec &  v,
a 
)
constexpr

Returns an accumulator with the element-wise multiplication of a value and all the elements of a vector. The default accumulator accuracy is used of the input vector. The type of the value and the type of the vector elements must be compatible. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = op1(v[i]) * op2(a);
Parameters
aValue. The type must meet ElemOrOp.
vInput vector. The type must meet VectorOrOp.

◆ mul() [2/6]

template<AccumElemBaseType AccumTag, VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::mul ( const Vec &  v,
a 
) -> accum<AccumTag, Vec::size()>
constexpr

Returns an accumulator of the requested type with the element-wise multiplication of a value and all the elements of the input vector. The type of the value and the type of the vector elements must be compatible. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = op1(v[i]) * op2(a);
Template Parameters
AccumTagAccumulator tag that specifies the required accumulation bits. The class must be compatible with the vector types (real/complex).
Parameters
vInput vector. The type must meet VectorOrOp.
aValue. The type must meet ElemOrOp.

◆ mul() [3/6]

template<VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::mul ( const Vec1 &  v1,
const Vec2 &  v2 
)
constexpr

Returns an accumulator with the element-wise multiplication of the two input vectors. The default accumulator accuracy is used. The vectors must have the same size and compatible types. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = op1(v1[i]) * op2(v2[i]);
Parameters
v1First input vector. The type must meet VectorOrOp.
v2Second input vector. The type must meet VectorOrOp.

◆ mul() [4/6]

template<AccumElemBaseType AccumTag, VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::mul ( const Vec1 &  v1,
const Vec2 &  v2 
) -> accum<AccumTag, Vec1::size()>
constexpr

Returns an accumulator of the requested type with the element-wise multiplication of the two input vectors. The vectors must have the same size and compatible types. Vectors can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = op1(v1[i]) * op2(v2[i]);
Template Parameters
AccumTagAccumulator tag that specifies the required accumulation bits. The class must be compatible with the vector types (real/complex).
Parameters
v1First input vector. The type must meet VectorOrOp.
v2Second input vector. The type must meet VectorOrOp.

◆ mul() [5/6]

template<ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::mul ( a,
const Vec &  v 
)
constexpr

Returns an accumulator with the element-wise multiplication of a value and all the elements of a vector. The default accumulator accuracy is used of the input vector. The type of the value and the type of the vector elements must be compatible. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = op1(a) * op2(v[i]);
Parameters
aValue. The type must meet ElemOrOp.
vInput vector. The type must meet VectorOrOp.

◆ mul() [6/6]

template<AccumElemBaseType AccumTag, ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::mul ( a,
const Vec &  v 
) -> accum<AccumTag, Vec::size()>
constexpr

Returns an accumulator of the requested type with the element-wise multiplication of a value and all the elements of the input vector. The type of the value and the type of the vector elements must be compatible. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = op1(a) * op2(v[i]);
Template Parameters
AccumTagAccumulator tag that specifies the required accumulation bits. The class must be compatible with the vector types (real/complex).
Parameters
aValue. The type must meet ElemOrOp.
vInput vector. The type must meet VectorOrOp.

◆ mul_square() [1/2]

template<Vector Vec>
constexpr auto aie::mul_square ( const Vec &  v)
constexpr

Returns an accumulator with the element-wise square of the input vector. The default accumulator accuracy is used.

for (unsigned i = 0; i < Elems; ++i)
out[i] = v[i] * v[i];
Parameters
vInput vector. The type must meet Vector.

◆ mul_square() [2/2]

template<AccumElemBaseType AccumTag, Vector Vec>
constexpr auto aie::mul_square ( const Vec &  v) -> accum<AccumTag, Vec::size()>
constexpr

Returns an accumulator of the requested type with the element-wise square of the input vector.

for (unsigned i = 0; i < Elems; ++i)
out[i] = v[i] * v[i];
Template Parameters
AccumTagAccumulator tag that specifies the required accumulation bits. The class must be compatible with the vector types (real/complex).
Parameters
vInput vector. The type must meet Vector.

◆ neg() [1/2]

template<Elem E>
constexpr auto aie::neg ( const E &  a) -> operand_base_type_t<E>
constexpr

For values with signed types, return the input value with the sign flipped. If the input type is unsigned, the input value is returned.

Parameters
aInput value

◆ neg() [2/2]

template<Vector Vec>
constexpr auto aie::neg ( const Vec &  v) -> aie_dm_resource_remove_t<Vec>
constexpr

For vectors with signed types, return a vector whose elements are the same as in the given vector but with the sign flipped. If the input type is unsigned, the input vector is returned.

Parameters
vInput vector

◆ negmul() [1/6]

template<VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::negmul ( const Vec &  v,
a 
)
constexpr

Returns an accumulator with the negate of the element-wise multiplication of all the elements of the input vector and a value. The default accumulator accuracy is used. The vectors must have the same size and compatible types. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = -(op1(v[i]) * op2(a)));
Parameters
vInput vector. The type must meet VectorOrOp.
aValue. The type must meet ElemOrOp.

◆ negmul() [2/6]

template<AccumElemBaseType AccumTag, VectorOrOp Vec, ElemOrOp E>
constexpr auto aie::negmul ( const Vec &  v,
a 
) -> accum<AccumTag, Vec::size()>
constexpr

Returns an accumulator of the requested type with the negate of the element-wise multiplication of all the elements of the input vector and a value. The type of the value and the type of the vector elements must be compatible. The input arguments can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = -(op1(v[i]) * op2(a));
Template Parameters
AccumTagAccumulator tag that specifies the required accumulation bits. The class must be compatible with the vector types (real/complex).
Parameters
vInput vector. The type must meet VectorOrOp.
aValue. The type must meet ElemOrOp.

◆ negmul() [3/6]

template<VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::negmul ( const Vec1 &  v1,
const Vec2 &  v2 
)
constexpr

Returns an accumulator with the negate of the element-wise multiplication of the two input vectors. The default accumulator accuracy is used. The vectors must have the same size and compatible types. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = -(op1(v1[i]) * op2(v2[i]));
Parameters
v1First input vector. The type must meet VectorOrOp.
v2Second input vector. The type must meet VectorOrOp.

◆ negmul() [4/6]

template<AccumElemBaseType AccumTag, VectorOrOp Vec1, VectorOrOp Vec2>
constexpr auto aie::negmul ( const Vec1 &  v1,
const Vec2 &  v2 
) -> accum<AccumTag, Vec1::size()>
constexpr

Returns an accumulator of the requested type with the negate of the element-wise multiplication of the two input vectors. The vectors must have the same size and compatible types. Vectors can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = -(op1(v1[i]) * op1(v2[i]));
Template Parameters
AccumTagAccumulator tag that specifies the required accumulation bits. The class must be compatible with the vector types (real/complex).
Parameters
v1First input vector. The type must meet VectorOrOp.
v2Second input vector. The type must meet VectorOrOp.

◆ negmul() [5/6]

template<ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::negmul ( a,
const Vec &  v 
)
constexpr

Returns an accumulator with the negate of the element-wise multiplication of a value and all the elements of the input vector. The default accumulator accuracy is used. The vectors must have the same size and compatible types. Operands can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = -(op1(a) * op2(v[i]));
Parameters
aValue. The type must meet ElemOrOp.
vInput vector. The type must meet VectorOrOp.

◆ negmul() [6/6]

template<AccumElemBaseType AccumTag, ElemOrOp E, VectorOrOp Vec>
constexpr auto aie::negmul ( a,
const Vec &  v 
) -> accum<AccumTag, Vec::size()>
constexpr

Returns an accumulator of the requested type with the negate of the element-wise multiplication of a value and all the elements of the input vector. The type of the value and the type of the vector elements must be compatible. The input arguments can also be lazy operations (see Lazy Operations). On some AIE architectures certain operations can be collapsed with the multiplication into a single instruction.

for (unsigned i = 0; i < Elems; ++i)
out[i] = -(op1(a) * op2(v[i]));
Template Parameters
AccumTagAccumulator tag that specifies the required accumulation bits. The class must be compatible with the vector types (real/complex).
Parameters
aValue. The type must meet ElemOrOp.
vInput vector. The type must meet VectorOrOp.

◆ reduce_add_v()

template<Vector Vec, Vector... Others>
auto aie::reduce_add_v ( const Vec &  v,
const Others &...  others 
) -> aie_dm_resource_remove_t<Vec>

Returns the sums of the elements in the input vectors. The sum of each input vector is stored in an element of the output vector.

Parameters
vFirst input vector. The type must meet Vector.
othersRemaining input vectors. The type must meet Vector.

◆ sub() [1/5]

template<Accum Acc, Vector Vec>
constexpr auto aie::sub ( const Acc &  acc,
const Vec &  v 
) -> aie_dm_resource_remove_t<Acc>
constexpr

Returns an accumulator with the element-wise subtraction of the input accumulator and vector.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] - v[i];
Parameters
accInput accumulator (minuend)
vInput vector (subtrahend)

◆ sub() [2/5]

template<Accum Acc, Elem E>
auto aie::sub ( const Acc &  acc,
a 
) -> aie_dm_resource_remove_t<Acc>

Returns an accumulator with the subtraction of all the elements of the input accumulator and a value.

for (unsigned i = 0; i < Elems; ++i)
out[i] = acc[i] - a;
Parameters
accInput accumulator (minuend)
aValue (subtrahend). The type must meet Elem.

◆ sub() [3/5]

template<Vector Vec, Elem E>
auto aie::sub ( const Vec &  v,
a 
) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the subtraction of the elements of the input vector and a value. The type of the value and the type of the vector elements must be the same.

for (unsigned i = 0; i < Elems; ++i)
out[i] = v[i] - a;
Parameters
vInput vector (minuend)
aValue (subtrahend)

◆ sub() [4/5]

template<Vector Vec1, Vector Vec2>
auto aie::sub ( const Vec1 &  v1,
const Vec2 &  v2 
) -> aie_dm_resource_remove_t<Vec1>

Returns a vector with the element-wise subtraction of the two input vectors. The vectors must have the same type and size.

for (unsigned i = 0; i < Elems; ++i)
out[i] = v1[i] - v2[i];
Parameters
v1First input vector (minuend). The type must meet Vector.
v2Second input vector (subtrahend). The type must meet Vector.

◆ sub() [5/5]

template<Elem E, Vector Vec>
auto aie::sub ( a,
const Vec &  v 
) -> aie_dm_resource_remove_t<Vec>

Returns a vector with the subtraction of a value and all the elements of the input vector. The type of the value and the type of the vector elements must be the same.

for (unsigned i = 0; i < Elems; ++i)
out[i] = a - v[i];
Parameters
aValue (minuend). The type must meet Elem.
vInput vector (subtrahend). The type must meet Vector.