Block Floating Type Operations - 2025.1 English - UG1603

AI Engine-ML Kernel and Graph Programming Guide (UG1603)

Document ID
UG1603
Release Date
2025-05-29
Version
2025.1 English

The AI Engine API supports block floating-point operations for matrix multiplication for AI Engine-ML v2 only. The result of a block floating-point operation is always a single-precision floating-point accumulator (accfloat). It is possible to convert back a floating-point accumulator to an MX type vector.

There is no element-by-element operator for block-floating-point operations. This would be inefficient considering the size of the input vectors and the number of multipliers.

Following is an example of accfloat type converted to mx9 block floating-point data type:

aie::block_vector<mx9,64> matA;
aie::block_vector<mx9,256> matB;
aie::accum<accfloat,64> acc;

aie::mmul<4, 16, 16, mx9, mx9, accfloat> m;

// Get/Compute A and B
...
// Multiply the 2 matrices
m.mul(va, aie::op_transpose(vb));

aie::block_vector<mx9,64> vc = m.to_vector<mx9>();