AIE architectures offer multiplication instructions that can perform additional operations on on the input arguments. Instead of adding one variant for each possible combination, AIE API offers types that can wrap an existing vector, accumulator of element reference and be passed into the multiplication function. Then the API will merge the operations into a single instruction or apply the operation on the vector before the multiplication, depending on the hardware support,
The following example performs an element-wise multiplication of the absolute of vector a and the conjugate of vector b.
{
returnret;
}
constexpr auto mul(const Vec1 &v1, const Vec2 &v2) -> accum< AccumTag, Vec1::size()>
Definition:aie.hpp:3033
constexpr unary_op< T, Operation::Abs > op_abs(const T &e)
Definition:aie.hpp:480
constexpr unary_op< T, Operation::Conj > op_conj(const T &e)
Definition:aie.hpp:495
Definition:aie_declaration.hpp:71
Definition:aie_declaration.hpp:68
|
template |
constexprunary_op< T,Operation::Abs> |
aie::op_abs(const T &e) |
|
More...
|
|
template<AccumAcc> |
constexprunary_op< Acc,Operation::Acc_Add> |
aie::op_add(const Acc &acc) |
|
More...
|
|
template |
constexprunary_op< T,Operation::Conj> |
aie::op_conj(const T &e) |
|
More...
|
|
template<VectorVec> |
constexprbinary_op< Vec, Vec,Operation::Max> |
aie::op_max(const Vec &a, const Vec &b) |
|
More...
|
|
template<VectorVec> |
constexprbinary_op< Vec, Vec,Operation::Min> |
aie::op_min(const Vec &a, const Vec &b) |
|
More...
|
|
template |
constexprunary_op< T,Operation::None> |
aie::op_none(const T &e) |
|
More...
|
|
template<AccumAcc> |
constexprunary_op< Acc,Operation::Acc_Sub> |
aie::op_sub(const Acc &acc) |
|
More...
|
|
◆op_abs()
template
constexprunary_opOperation::Abs> aie::op_abs |
( |
const T & |
e |
) |
|
|
constexpr |
Returns an absolute operation modifier for the given vector or element. On some architecture versions, this operation can be collapsed with a subsequent multiplication.
-
Parameters
-
e |
Vectoror element to which the operation is performed. The type must meetVectororElem. |
◆op_add()
constexprunary_opOperation::Acc_Add> aie::op_add |
( |
const Acc & |
acc |
) |
|
|
constexpr |
Returns an addition operation modifier for the given accumulator.
-
Parameters
-
acc |
Accumulator to which the operation is performed. |
◆op_conj()
template
constexprunary_opOperation::Conj> aie::op_conj |
( |
const T & |
e |
) |
|
|
constexpr |
Returns a conjugate operation modifier for the given complex vector or element. On some architecture versions, this operation can be collapsed with a subsequent multiplication.
-
Parameters
-
◆op_max()
constexprbinary_opOperation::Max> aie::op_max |
( |
const Vec & |
a, |
|
|
const Vec & |
b |
|
) |
|
|
|
constexpr |
Returns a maximum operation modifier for the given pair of vectors or elements. On some architecture versions, this operation can be collapsed with a subsequent multiplication.
-
Parameters
-
a |
First vector or element passed to the operation. The type must meetVectororElem. |
b |
Second vector or element passed to the operation. The type must be the same as for a. |
◆op_min()
constexprbinary_opOperation::Min> aie::op_min |
( |
const Vec & |
a, |
|
|
const Vec & |
b |
|
) |
|
|
|
constexpr |
Returns a minimum operation modifier for the given pair of vectors or elements. On some architecture versions, this operation can be collapsed with a subsequent multiplication.
-
Parameters
-
a |
First vector or element passed to the operation. The type must meetVectororElem. |
b |
Second vector or element passed to the operation. The type must be the same as for a. |
◆op_none()
template
constexprunary_opOperation::None> aie::op_none |
( |
const T & |
e |
) |
|
|
constexpr |
Returns an empty operation modifier for the given vector or element.
-
Parameters
-
e |
Vectoror element to which the operation is performed. The type must meetVectororElem. |
◆op_sub()
constexprunary_opOperation::Acc_Sub> aie::op_sub |
( |
const Acc & |
acc |
) |
|
|
constexpr |
Returns a subtraction operation modifier for the given accumulator.
-
Parameters
-
acc |
Accumulator to which the operation is performed. |