|
AI Engine API User Guide (AIE-API) 2026.1
|
The AIE API encapsulates the matrix multiplication functionality in the aie::mmul class template.
This class template is parametrized with the matrix multiplication shape (MxKxN), the data types and, optionally, the requested accmululation precision. This class defines a function that performs the multiplication and a result data type that can be converted to an accumulator or a vector. The function interprets the input vectors as matrices as described by the shape parameters.
The following code snippet shows a portable matrix multiplication using aie::mmul class. The implementation assumes that input matrices are pre-arranged in blocks (tiled layout) following the shape in aie::mmul template parameters (MxK for A, KxN for B, and MxN for C). See Tiled matrix layout for an explanation of tiled matrix layouts.
Tiling is known as partitioning a matrix into smaller sub-matrices, or tiles, where all elements in each given tile are contiguous in memory. AI Engine matrices are usually arranged in row-major order (any exceptions to this norm are marked explicitly as column-major or transposed).
The optimal tile shape depends on the specific architecture and input datatypes of the multiplication. In AIE API, we usually refer to the multiplication of matrices A and B with shapes (M, K) and (K, N) respectively as M x K x N.
For example, a multiplication of matrices Aint32 and Bint16 with a tile shape of 2x2x4 has the following implications:
Matrix multiply interface takes input blocks as aie::vector and produces results as aie::accum. The figure below shows an example of how two matrices A and B with shape (4, 4) would be tiled:
The tiled memory layout of the two input matrices could be described in C++ code as:
Classes | |
| struct | aie::mmac_callbacks< Fn1, Fn2 > |
| MMAC Callbacks. More... | |
| struct | aie::mmac_opts |
| MMAC Options. More... | |
| struct | aie::mmac_prime_opts |
| MMAC Prime Options. More... | |
| struct | aie::mmul< M_Elems, K_Elems, N_Elems, TypeA, TypeB, AccumTag, Ownership > |
| Type that encapsulates a blocked matrix multiplication C = A x B. More... | |
Enumerations | |
| enum class | aie::mmac_callback_conf |
| MMAC Callback Configuration. More... | |
| enum class | aie::mmac_mode |
| Oneshot MMAC modes. More... | |
The following matrix multiplication shapes are supported.
| Arch. | 8b x 4b | 8b x 8b | 16b x 8b | 8b x 16b | 16b x 16b | 32b x 16b | 16b x 32b | 32b x 32bc | f8 x f8 | bfloat16 x bfloat16 | f16 x f16 | float x floatd | bfp16 x bfp16 | mx4 x mx4 | mx6 x mx6 | mx9 x mx9 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AIE | 4x8x4 4x16x4a 8x8x4a 2x8x8 4x8x8a 1x16x8 2x16x8a 4x16x8a | 4x4x4 8x4x4a 4x8x4a 4x4x8a | 4x4x8a 4x4x4a 8x8x1ab | 4x4x4a 2x4x8a 4x4x8a 4x2x8a 8x8x1ab | 2x4x8a 4x4x4a 4x2x4a 2x2x4 2x4x4a 4x4x2a 2x2x8a | 4x2x2 2x4x8a 4x4x4a | 4x2x4a 2x2x2 2x4x2a 2x8x2a 4x2x2a 4x4x2a 2x4x4a 4x4x1a | 4x2x4a 2x2x2a 2x4x2ab 2x8x2ab 4x2x2a 4x4x2a 2x4x4a 4x4x1ab | ||||||||
| AIE-ML/XDNA1 | 4x16x8 8x16x8a 4x32x8ab | 4x8x4ab 4x16x4ab 8x8x4ab 2x8x8 4x8x8 8x8x8a 1x16x8ab 2x16x8ab 4x16x8ab | 4x4x4ab 8x4x4ab 4x8x4 4x4x8 8x4x8ab 2x8x8 | 4x4x8ab 4x4x4ab | 4x4x4 2x4x8 4x4x8ab 4x2x8 8x2x8a 8x1x8ab | 2x4x8 4x4x8ab 4x4x4 4x2x4 4x1x8ab | 2x4x8 4x4x4 | 4x2x4a 4x4x4ab 8x2x4a 4x1x8ab 8x1x8ab | 4x8x4 8x8x4a 4x16x8ab 8x8x8ab | 4x8x4 4x1x4b 4x1x8ab | ||||||
| XDNA2 | 4x16x16 | 4x8x8 8x8x8 | 4x4x8 8x4x8 4x8x8 2x8x8b | 8x2x8b 4x4x8b | 4x2x832 8x2x832 2x4x864 4x4x864 8x1x8b, 32 | 4x2x8 2x4x8ab 4x4x8ab 4x1x8b | 4x4x8ab | 4x2x8ab 4x4x4ab 4x4x8ab 8x2x8ab 4x1x8b | 8x8x4ab 4x8x8abc 4x8x4ab 8x8x8e 8x1x8b | 4x8x4ab | 8x8x8 8x8x16ab | |||||
| AIE-MLv2 | 4x16x16ab 8x8x8 | 4x8x832 8x8x832 | 8x2x8b 8x4x8ab 4x4x8b 4x8x8ab | 8x2x8b 4x4x8b | 4x2x8c, 32 8x2x832 2x4x864 4x4x864 8x1x8b, 32 | 4x2x8 2x4x8ab 4x4x8ab 4x1x8b | 4x4x8ab | 4x2x8ab 4x4x4ab 4x4x8ab 8x2x8ab 4x1x8b | 8x8x8 | 4x8x4ab 4x8x8 8x8x8a 8x1x8b | 4x8x4ab 4x8x8 8x8x8a 8x1x8b | 4x8x4ab | 4x16x16 8x16x16a | 4x16x16 8x16x16a | 4x16x16b |
| Arch. | 16b x c16b | 16b x c32b | c16b x 16b | c16b x c16b | c16b x 32b | c16b x c32b | 32b x c16b | 32b x c32bc | c32b x 16b | c32b x c16b | c32b x 32bc | c32b x c32bc | bfloat16 x cbfloat16 | cbfloat16 x bfloat16 | cbfloat16 x cbfloat16 | float x cfloatd | cfloat x floatd | cfloat x cfloatd |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AIE | 4x2x2 4x4x4a 4x4x1 | 2x4x2a 2x4x4a 2x8x2a 4x4x2a 4x4x1a | 2x2x4 2x2x8a 2x4x4a 2x4x8a 4x2x4a 4x4x2a 4x4x4a | 2x2x2 2x4x2a 2x8x2a 2x4x4a 4x2x2a 4x4x2a 4x2x4a 4x4x1a | 2x2x2 2x4x2a 2x8x2a 2x4x4a 4x2x2a 4x4x2a 4x2x4a 4x4x1a | 2x2x2a 2x4x2a 4x2x1a | 2x2x2 2x4x2a 2x8x2a 2x4x4a 4x2x2a 4x4x2a 4x2x4a 4x4x1a | 2x2x2a 2x4x2a 4x2x1a | 2x4x2a 2x8x2a 2x4x4a 4x4x2a | 2x2x2a 2x4x2a 4x4x1a | 1x2x2 2x2x2a 2x4x2a 4x4x1a | 1x2x2a 2x2x1a 2x2x1 | 2x2x2a 2x4x2a 4x2x1a | 2x2x2a 2x4x2a 4x4x1a 2x4x1ab | 2x2x2a 2x2x4a 2x4x2a 4x2x2a 4x2x1a | |||
| AIE-ML/XDNA1 | 2x4x8ab 4x4x4ab | 1x4x8ab 2x4x8ab | 4x4x4ab | 4x2x4ab 4x4x4ab | 1x2x4ab 1x2x8ab 2x2x8ab 1x4x8ab 2x4x8ab | 4x2x4ab | 1x2x8ab | 2x8x2ab | 2x8x2ab | 2x8x2ab | 2x8x2ab | 2x8x2ab | 2x8x2ab | |||||
| XDNA2 | 4x4x8ab 2x4x8ab | 1x4x8ab 2x2x16ab | 1x2x4ab 1x2x8ab 1x2x16ab | 1x2x8ab | ||||||||||||||
| AIE-MLv2 | 4x4x8abd 2x4x8abd | 1x4x8ab 2x2x16ab | 1x2x4ab 1x2x8ab 1x2x16ab | 1x2x8ab | 2x8x4ab | 2x8x4ab | 2x8x4ab | 2x8x4ab | 2x8x4ab | 2x8x4ab |
Below is an example of an optimized bfloat16 GEMM kernel in which both input matrices, A and B, are addressed in the following 4D patterns (see Tensor Buffer Streams):
It is assumed that the data for both input matrices are pre-tiled and that the tiles are laid out in column-major order in memory.
AIE-ML/XDNA1 introduced hardware support for sparse matrix multiplication. For an M x K x N matrix multiplication with A being M x K, B being K x N, and C being M x N, a sparse B matrix may be stored in memory using a data layout which avoids storing zero values.
| Arch. | 8b x 4b | 8b x 8b | 16b x 8b | 16b x 16b | bfloat16 x bfloat16 |
|---|---|---|---|---|---|
| AIE-ML/XDNA1 | 4x32x8 | 4x16x8 8x16x8a 4x16x16ab | 2x16x8 4x16x8a | 2x8x8 4x8x8a 2x8x16ab | 4x16x4 4x16x8ab |
| XDNA2 | 4x16x8 8x16x8 | 2x16x8 4x16x8 | 2x8x8 4x8x8 | ||
| AIE-MLv2 | 4x16x8 8x16x8 | 2x8x8 4x8x8 | 4x16x8 |
The following example shows an optimized int8 * sparse int8 GEMM:
| struct aie::mmac_callbacks |
| struct aie::mmac_opts |
MMAC Options.
| Class Members | ||
|---|---|---|
| mmac_callback_conf | callback_conf = mmac_callback_conf::one_per_op | Callback configuration. |
| bool | commit_b = true | Before executing the MMAC, copy the B matrix from the staging matrix register to the MMAC unit register for use in the next MMAC operation. |
| bool | invoke_callback = true | Invoke callback after executing the MMAC. |
| bool | invoke_pre_callback = false | Invoke callback before executing the MMAC. |
| bool | load_b = true | Load the B matrix eagerly into the staging matrix register then copy it to the MMAC unit register prior to the MMAC operation. |
| bool | prefetch_b = false | While executing the MMAC, load the following B matrix into the staging matrix register and move it to the MMAC unit register after the MMAC operation. |
| struct aie::mmac_prime_opts |
MMAC Prime Options.
| Class Members | ||
|---|---|---|
| mmac_callback_conf | callback_conf = mmac_callback_conf::one_per_op | Callback configuration. |
| bool | invoke_callback = false | Invoke callback while priming the B matrix. |
| struct aie::mmul |
Type that encapsulates a blocked matrix multiplication C = A x B.
Objects of this type encapsulate the current result of the multiplication. The first result is computed with the mul method. New multiplications can be accumulated using the mac method.
| M_Elems | Rows in matrix A. |
| K_Elems | Columns in matrix A / Rows in matrix B. |
| N_Elems | Columns in matrix B. |
| TypeA | Type of the elements in matrix A. It must meet aie::ElemBaseType. |
| TypeB | Optional. Type of the elements in matrix B. By default is the same as TypeA. It must meet aie::ElemBaseType. |
| AccumTag | Optional. Type of the elements of the accumulator that contains the results to be written in matrix C. It must meet aie::AccumElemBaseType. If not specified, it uses the default accumulation type for multiplications of TypeA x TypeB. |
| Ownership | Optional. If set to owned, the mmul object references a user-provided accumulator instead of owning one. When set as ref, the object must be constructed with an accumulator reference. Defaults to owned. |
Public Types | |
| using | accum_type = typename mmul_impl::accum_type |
| using | mmul_impl |
Public Member Functions | |
| mmul () | |
| Default constructor. | |
| mmul (bool to_zero) | |
| Constructor. | |
| mmul (const accum_type &acc) | |
| Constructor. | |
| mmul (const binary_op< accum_type, bool, Operation::Zero > &op) | |
| Constructor. | |
| mmul (const unary_op< accum_type, Operation::Acc_Add > &op) | |
| Constructor. | |
| template<typename T> requires (Ownership == accum_ownership::owned) | |
| mmul (const vector< T, size_C > &v, int shift=0) | |
| Constructor. | |
| mmul (indexed_accum_ref_type data, bool to_zero) | |
| Constructor. | |
| void | clear (bool to_zero=true) |
| Clear the mmac object's accumulation state. | |
| template<mmac_mode Mode = mmac_mode::default_mode> requires (arch::is(arch::Gen4) && is_oneshot) | |
| void | commit_b (void) |
| Move the contents of the staging register to the matrix register. | |
| indexed_accum_block_type & | get_accum_block (unsigned block) |
| template<RegularOrBlockVector VecB> requires (arch::is(arch::Gen4) && is_oneshot && VecB::size() == staging_elems) | |
| void | load_b (const VecB &b, uint5_t idx) |
| Insert the input vector into the staging matrix at the given index. | |
| template<TensorBufferStreamOrOp< TypeA > Asource, TensorBufferStreamOrOp< TypeB > Bsource, typename Fn1, typename Fn2> | |
| mmul & | mac (Asource &a, Bsource &b, const mmac_opts &opts, const mmac_callbacks< Fn1, Fn2 > &callbacks={[]() {}, []() {}}) |
| Multiply the two given matrices and add it to the result using the MMAC. | |
| template<TensorBufferStreamOrOp< TypeA > Asource, TensorBufferStreamOrOp< TypeB > Bsource> | |
| mmul & | mac (Asource &a, Bsource &b, const mmac_opts &opts={}) |
| Multiply the two given matrices and add it to the result using the MMAC. | |
| template<TensorBufferStreamOrOp< TypeA > Asource, TensorBufferStreamOrOp< TypeB > Bsource> | |
| mmul & | mac (Asource &a, Bsource &b, const mmac_opts &opts={}, auto callback=[]() {}) |
| Multiply the two given matrices and add it to the result using the MMAC. | |
| template<mmac_mode Mode = mmac_mode::default_mode, RegularOrBlockVectorOrOp VecA> requires (arch::is(arch::Gen4) && is_oneshot && std::is_same_v<typename VecA::value_type, TypeA>) | |
| mmul & | mac (const VecA &a, bool b_sign=detail::is_signed_v< TypeB >) |
| Multiply the input vector with the contents of the matrix register and add it to the result. | |
| template<VectorOrOp VecA, SparseVectorOrOp VecB> requires (arch::is(arch::Gen2) && VecA::size() == size_A && VecB::size() == size_B && std::is_same_v<typename VecA::value_type, TypeA> && std::is_same_v<typename VecB::value_type, TypeB>) | |
| mmul & | mac (const VecA &a, const VecB &b) |
| Multiply the two given matrices and add it to the result. | |
| template<VectorOrOp VecA, VectorOrOp VecB> requires (VecA::size() == size_A && VecB::size() == size_B && std::is_same_v<typename VecA::value_type, TypeA> && std::is_same_v<typename VecB::value_type, TypeB>) | |
| mmul & | mac (const VecA &a, const VecB &b) |
| Multiply the two given matrices and add it to the result. | |
| template<TensorBufferStreamOrOp< TypeA > Asource, TensorBufferStreamOrOp< TypeB > Bsource> | |
| mmul & | mul (Asource &a, Bsource &b, const mmac_opts &opts={}) |
| Initialize the result value with the multiplication of the two given matrices using the MMAC. | |
| template<TensorBufferStreamOrOp< TypeA > Asource, TensorBufferStreamOrOp< TypeB > Bsource> | |
| mmul & | mul (Asource &a, Bsource &b, const mmac_opts &opts={}, auto callback=[]() {}) |
| Initialize the result value with the multiplication of the two given matrices using the MMAC. | |
| template<TensorBufferStreamOrOp< TypeA > Asource, TensorBufferStreamOrOp< TypeB > Bsource, typename Fn1, typename Fn2> | |
| mmul & | mul (Asource &a, Bsource &b, const mmac_opts &opts={}, const mmac_callbacks< Fn1, Fn2 > &callbacks={[]() {}, []() {}}) |
| Initialize the result value with the multiplication of the two given matrices using the MMAC. | |
| template<mmac_mode Mode = mmac_mode::default_mode, RegularOrBlockVectorOrOp VecA> requires (arch::is(arch::Gen4) && is_oneshot && std::is_same_v<typename VecA::value_type, TypeA>) | |
| mmul & | mul (const VecA &a, bool b_sign=detail::is_signed_v< TypeB >) |
| Initialize the result value with the multiplication of the given vector and the contents of the matrix register using the MMAC. | |
| template<VectorOrOp VecA, SparseVectorOrOp VecB> requires (arch::is(arch::Gen2) && VecA::size() == size_A && VecB::size() == size_B && std::is_same_v<typename VecA::value_type, TypeA> && std::is_same_v<typename VecB::value_type, TypeB>) | |
| mmul & | mul (const VecA &a, const VecB &b) |
| Initialize the result value with the multiplication of the two given matrices. | |
| template<VectorOrOp VecA, VectorOrOp VecB> requires (VecA::size() == size_A && VecB::size() == size_B && std::is_same_v<typename VecA::value_type, TypeA> && std::is_same_v<typename VecB::value_type, TypeB>) | |
| mmul & | mul (const VecA &a, const VecB &b) |
| Initialize the result value with the multiplication of the two given matrices. | |
| operator accum_type () const | |
| Conversion operator to accumulator. | |
| mmul & | operator= (const accum_type &acc) |
| Reinitialize the mmul object using the given accumulator. | |
| template<TensorBufferStreamOrOp< TypeB > Bsource> requires (is_indexed_accum) | |
| void | prime (Bsource &b) |
| Prime the mmac object with the B input matrix. | |
| template<TensorBufferStreamOrOp< TypeB > Bsource> requires (is_indexed_accum) | |
| void | prime (Bsource &b, const mmac_prime_opts &opts, auto callback=[]() {}) |
| Prime the mmac object with the B input matrix. | |
| template<TensorBufferStreamOrOp< TypeB > Bsource> requires (arch::is(arch::Gen4) && is_oneshot) | |
| void | set_b (Bsource &b) |
| Fill the staging register with data from the given tensor buffer stream. | |
| template<mmac_mode Mode, Vector VecB1, Vector... VecB2> requires (arch::is(arch::Gen4) && is_oneshot && Mode != mmac_mode::default_mode) | |
| void | set_b (const VecB1 &b1, const VecB2 &... b2) |
| Insert the input vector into the staging matrix applying a transformation dictated by the Mode. | |
| accum_type | to_accum () const |
| Return the result of the multiplication as an accumulator. | |
| template<typename T> | |
| vector< T, size_C > | to_vector (int shift=0) const |
| Return the result of the multiplication as a vector of the requested type. | |
Static Public Member Functions | |
| static constexpr unsigned | size () |
| Returns number of elements in matrix C. | |
Static Public Attributes | |
| static constexpr unsigned | K = K_Elems |
| Number of columns in matrix A, and number of rows in matrix B. | |
| static constexpr unsigned | M = M_Elems |
| Number of rows in matrix A. | |
| static constexpr unsigned | N = N_Elems |
| Number of columns in matrix B. | |
| static constexpr unsigned | size_A = M * K |
| Number of elements in matrix A. | |
| static constexpr unsigned | size_B = K * N |
| Number of elements in matrix B. | |
| static constexpr unsigned | size_C = M * N |
| Number of elements in matrix C. | |
| static constexpr unsigned | staging_elems = mmul_impl::staging_elems |
| Size of vector that can be staged. | |
| using aie::mmul< M_Elems, K_Elems, N_Elems, TypeA, TypeB, AccumTag, Ownership >::accum_type = typename mmul_impl::accum_type |
| using aie::mmul< M_Elems, K_Elems, N_Elems, TypeA, TypeB, AccumTag, Ownership >::mmul_impl |
|
inline |
|
inline |
Constructor.
Data will qualify as zero/non zero initialised for the first operation.
| to_zero | Indicates whether to zero initialize the accumulator data. |
|
inline |
Constructor.
Data is initialized from the given accumulator in row-major order.
| acc | Accumulator data is initialized from. |
|
inline |
Constructor.
Wraps an existing indexed accumulator proxy.
| data | Indexed accumulator proxy (e.g., from block[idx]) |
| to_zero | Indicates whether to zero initialize the accumulator data. |
|
inline |
Constructor.
Data is initialized from the given operation modifier.
| op | aie::op_add operation. |
|
inline |
Constructor.
Data is initialized from the given operation modifier.
This modifier conditionally qualifies the data to be represented as if it were zero for the first operation.
| op | aie::op_zero operation. |
|
inline |
Constructor.
Data is initialized from the given vector.
Data is expected to be row-major layout.
| v | Vector data is initialized from. |
| shift | Upshift in bits to be applied to input data. This parameter is ignored for floating-point types. |
|
inline |
Clear the mmac object's accumulation state.
Data will qualify as zero/non zero initialised for the following operation.
| to_zero | Indicates whether to zeroize the accumulator data. |
|
inline |
Move the contents of the staging register to the matrix register.
|
inline |
|
inline |
Insert the input vector into the staging matrix at the given index.
This operation will not update the matrix register and the move needs to be carried out explicitly.
| b | Vector to insert into the staging register. |
| idx | Index in the staging register to insert into. |
|
inline |
Multiply the two given matrices and add it to the result using the MMAC.
| a | Tensor buffer stream for the A input matrix with row-major data layout. |
| b | Tensor buffer stream for the B input matrix with column-major data layout. |
| opts | Options for the MMAC. |
| callbacks | structure with callback functions to be called before and after the operation. |
|
inline |
Multiply the two given matrices and add it to the result using the MMAC.
| a | Tensor buffer stream for the A input matrix with row-major data layout. |
| b | Tensor buffer stream for the B input matrix with column-major data layout. |
| opts | Options for the MMAC. |
|
inline |
Multiply the two given matrices and add it to the result using the MMAC.
| a | Tensor buffer stream for the A input matrix with row-major data layout. |
| b | Tensor buffer stream for the B input matrix with column-major data layout. |
| opts | Options for the MMAC. |
| callback | Callback function to be called at the end of the operation. |
|
inline |
Multiply the input vector with the contents of the matrix register and add it to the result.
| a | Input vector for the vector * matrix calculation. |
| b_sign | Flag controlling whether the data in the matrix register should be treated as signed. |
| Mode | The mode in which to carry out the operation. See mmac_mode. |
|
inline |
Multiply the two given matrices and add it to the result.
Matrix B is sparse.
| a | Vector that represents the A input matrix. The number of elements must be mmul::size_A (M * K). It must meet aie::VectorOrOp. |
| b | Sparse vector that represents the B input matrix. The number of elements must be mmul::size_B (K * N). |
|
inline |
Multiply the two given matrices and add it to the result.
| a | Represents the A input matrix with row-major data layout. The number of elements must be mmul::size_A (M * K). It must meet aie::VectorOrOp. |
| b | Represents the B input matrix with row-major data layout. The number of elements must be mmul::size_B (K * N). It must meet aie::VectorOrOp. |
|
inline |
Initialize the result value with the multiplication of the two given matrices using the MMAC.
Data is overwritten regardless how it was initialised.
| a | Tensor buffer stream for the A input matrix with row-major data layout. |
| b | Tensor buffer stream for the B input matrix with column-major data layout. |
| opts | Options for the MMAC. |
|
inline |
Initialize the result value with the multiplication of the two given matrices using the MMAC.
Data is overwritten regardless how it was initialised.
| a | Tensor buffer stream for the A input matrix with row-major data layout. |
| b | Tensor buffer stream for the B input matrix with column-major data layout. |
| opts | Options for the MMAC. |
| callback | Callback function to be called at the end of the operation. |
|
inline |
Initialize the result value with the multiplication of the two given matrices using the MMAC.
Data is overwritten regardless how it was initialised.
| a | Tensor buffer stream for the A input matrix with row-major data layout. |
| b | Tensor buffer stream for the B input matrix with column-major data layout. |
| opts | Options for the MMAC. |
| callbacks | structure with callback functions to be called before and after the operation. |
|
inline |
Initialize the result value with the multiplication of the given vector and the contents of the matrix register using the MMAC.
| a | Input vector for the vector * matrix calculation. |
| b_sign | Flag controlling whether the data in the matrix register should be treated as signed. |
| Mode | The mode in which to carry out the operation. See mmac_mode. |
|
inline |
Initialize the result value with the multiplication of the two given matrices.
Matrix B is sparse.
Data is overwritten regardless how it was initialised.
| a | Vector that represents the A input matrix. The number of elements must be mmul::size_A (M * K). It must meet aie::VectorOrOp. |
| b | Sparse vector that represents the B input matrix. The number of elements must be mmul::size_B (K * N). |
|
inline |
Initialize the result value with the multiplication of the two given matrices.
Data is overwritten regardless how it was initialised.
| a | Represents the A input matrix with row-major data layout. The number of elements must be mmul::size_A (M * K). It must meet aie::VectorOrOp. |
| b | Represents the B input matrix with row-major data layout. The number of elements must be mmul::size_B (K * N). It must meet aie::VectorOrOp. |
|
inline |
Conversion operator to accumulator.
|
inline |
Reinitialize the mmul object using the given accumulator.
| acc | Accumulator data is initialized from. |
|
inline |
Prime the mmac object with the B input matrix.
The matrix B is loaded internally and kept for subsequent mul/mac operations.
| b | Tensor buffer stream for the B input matrix with column-major data layout. |
|
inline |
Prime the mmac object with the B input matrix.
The matrix B is loaded internally and kept for subsequent mul/mac operations.
| b | Tensor buffer stream for the B input matrix with column-major data layout. |
| opts | Options for the MMAC prime operation. |
| callback | Callback function to be called while priming the B matrix. |
|
inline |
Fill the staging register with data from the given tensor buffer stream.
This operation includes an implicit commit and will update the matrix register.
| b | Tensor buffer stream for the B input matrix with column-major data layout. |
|
inline |
Insert the input vector into the staging matrix applying a transformation dictated by the Mode.
This operation includes an implicit commit and will update the matrix register.
| b1 | Vector to broadcast into the staging register, reshaping to facilitate emulated convolution mode. |
| b2 | Optional second vector. Only required for convolution mode. |
| Mode | The mode in which to carry out the operation. See mmac_mode. |
|
inlinestaticconstexpr |
Returns number of elements in matrix C.
|
inline |
Return the result of the multiplication as an accumulator.
|
inline |
Return the result of the multiplication as a vector of the requested type.
| shift | Downshift in bits to be applied to output data. This parameter is ignored for floating-point types. |
|
staticconstexpr |
Number of columns in matrix A, and number of rows in matrix B.
|
staticconstexpr |
Number of rows in matrix A.
|
staticconstexpr |
Number of columns in matrix B.
|
staticconstexpr |
Number of elements in matrix A.
|
staticconstexpr |
Number of elements in matrix B.
|
staticconstexpr |
Number of elements in matrix C.
|
staticconstexpr |
Size of vector that can be staged.
|
strong |
|
strong |