![]() |
MMALIB User Guide
|
Go to the source code of this file.
Data Structures | |
| struct | MMALIB_CNN_fullyConnected_ixX_ixX_oxX_InitArgs |
| struct | MMALIB_CNN_fullyConnected_ixX_ixX_oxX_ExecArgs |
Enumerations | |
| enum | MMALIB_CNN_FULLYCONNECTED_IXX_IXX_OXX_STATUS_NAME { MMALIB_CNN_FULLYCONNECTED_IXX_IXX_OXX_ERR_SMALL_K = MMALIB_ERROR_MAX , MMALIB_CNN_FULLYCONNECTED_IXX_IXX_OXX_ERR_MAX } |
| Enumeration of different error codes for the MMALIB_CNN_FULLYCONNECTED kernel. More... | |
Functions | |
| int32_t | MMALIB_CNN_fullyConnected_ixX_ixX_oxX_getHandleSize (MMALIB_CNN_fullyConnected_ixX_ixX_oxX_InitArgs *pKerInitArgs) |
| This is a query function to return the size of internal handle. More... | |
| MMALIB_STATUS | MMALIB_CNN_fullyConnected_ixX_ixX_oxX_init (MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams2D_t *dst_addr, const MMALIB_CNN_fullyConnected_ixX_ixX_oxX_InitArgs *pKerInitArgs) |
| This function call is required to initialize the handle. In this function most of the one time operations are performed and results are stored in the handle. More... | |
| MMALIB_STATUS | MMALIB_CNN_fullyConnected_ixX_ixX_oxX_init_checkParams (MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams2D_t *dst_addr, const MMALIB_CNN_fullyConnected_ixX_ixX_oxX_InitArgs *pKerInitArgs) |
| This function checks the parameters and should be called before kernel execution. It can be called once. More... | |
| MMALIB_STATUS | MMALIB_CNN_fullyConnected_ixX_ixX_oxX_exec (MMALIB_kernelHandle handle, const void *src0, const void *src1, void *dst, const MMALIB_CNN_fullyConnected_ixX_ixX_oxX_ExecArgs *pKerExecArgs) |
| This function is the main compute function, and performs matrix-matrix multiplication. More... | |
| MMALIB_STATUS | MMALIB_CNN_fullyConnected_ixX_ixX_oxX_exec_checkParams (MMALIB_kernelHandle handle, const void *src0, const void *src1, const void *dst) |
| This function checks the parameters and should be called before kernel executuon. It can be called once. More... | |
| int32_t | MMALIB_CNN_generateFillBiasPredicateRegisters (MMALIB_kernelHandle handle, int32_t inputWidth, int32_t processWidth, uint32_t mmaWidth) |
| This function generates the predicate buffer for feature matrix. More... | |
| MMALIB_STATUS | MMALIB_CNN_fullyConnected_ixX_ixX_oxX_reorderWeights (int32_t mmaSize, int32_t NiBias, int32_t No, uint32_t strideOut, const void *restrict pWeights, void *restrict pReorderWeights) |
| This function re-orders the input weights (kernel matrix). Reordering of data is required to alleviate potential bank conflicts arising when the kernel matrix is accessed in L2 via SE1 in conjunction with data transfer from MSMC to L2 via DMA. The current re-ordering scheme results in a bank-acess pattern of {0,0,1,1,2,2,3,3,0,0,1,1,2,2,3,3, ...} for SE1. More... | |
| void | MMALIB_CNN_fullyConnected_ixX_ixX_oxX_perfEst (MMALIB_kernelHandle handle, const MMALIB_bufParams2D_t *src0_addr, const MMALIB_bufParams2D_t *src1_addr, const MMALIB_bufParams2D_t *dst_addr, uint64_t *archCycles, uint64_t *estCycles, int32_t *caseNumber) |
| This function estimates the cycles consumed for the kernel execution. More... | |
Enumeration of different error codes for the MMALIB_CNN_FULLYCONNECTED kernel.
| Enumerator | |
|---|---|
| MMALIB_CNN_FULLYCONNECTED_IXX_IXX_OXX_ERR_SMALL_K | |
| MMALIB_CNN_FULLYCONNECTED_IXX_IXX_OXX_ERR_MAX | |
Definition at line 189 of file MMALIB_CNN_fullyConnected_ixX_ixX_oxX.h.
| int32_t MMALIB_CNN_fullyConnected_ixX_ixX_oxX_getHandleSize | ( | MMALIB_CNN_fullyConnected_ixX_ixX_oxX_InitArgs * | pKerInitArgs | ) |
This is a query function to return the size of internal handle.
| [in] | pKerInitArgs | : Pointer to structure holding init parameters |
| MMALIB_STATUS MMALIB_CNN_fullyConnected_ixX_ixX_oxX_init | ( | MMALIB_kernelHandle | handle, |
| const MMALIB_bufParams2D_t * | src0_addr, | ||
| const MMALIB_bufParams2D_t * | src1_addr, | ||
| const MMALIB_bufParams2D_t * | dst_addr, | ||
| const MMALIB_CNN_fullyConnected_ixX_ixX_oxX_InitArgs * | pKerInitArgs | ||
| ) |
This function call is required to initialize the handle. In this function most of the one time operations are performed and results are stored in the handle.
| [in] | handle | : Active handle to the kernel |
| [in] | src0_addr | : Pointer to the structure containing dimensional information of src0, which is the feature map matrix |
| [in] | src1_addr | : Pointer to the structure containing dimensional information of src1, which is the kernel matrix |
| [out] | dst_addr | : Pointer to the structure containing dimensional information of dst |
| [in] | pKerInitArgs | : Pointer to the structure holding init parameters |
| MMALIB_STATUS MMALIB_CNN_fullyConnected_ixX_ixX_oxX_init_checkParams | ( | MMALIB_kernelHandle | handle, |
| const MMALIB_bufParams2D_t * | src0_addr, | ||
| const MMALIB_bufParams2D_t * | src1_addr, | ||
| const MMALIB_bufParams2D_t * | dst_addr, | ||
| const MMALIB_CNN_fullyConnected_ixX_ixX_oxX_InitArgs * | pKerInitArgs | ||
| ) |
This function checks the parameters and should be called before kernel execution. It can be called once.
| [in] | handle | : Active handle to the kernel |
| [in] | src0_addr | : Pointer to the structure containing dimensional information of src0, which is the feature map |
| [in] | src1_addr | : Pointer to the structure containing dimensional information of src1, which is the kernel |
| [out] | dst_addr | : Pointer to the structure containing dimensional information of dst |
| [in] | pKerInitArgs | : Pointer to the structure holding init parameters |
| MMALIB_STATUS MMALIB_CNN_fullyConnected_ixX_ixX_oxX_exec | ( | MMALIB_kernelHandle | handle, |
| const void * | src0, | ||
| const void * | src1, | ||
| void * | dst, | ||
| const MMALIB_CNN_fullyConnected_ixX_ixX_oxX_ExecArgs * | pKerExecArgs | ||
| ) |
This function is the main compute function, and performs matrix-matrix multiplication.
The flow and the expectations of this function are as follows
| [in] | handle | : Active handle to the kernel |
| [in] | src0[] | : Pointer to buffer holding the first matrix input [ A matrix], which is the feature map |
| [in] | src1[] | : Pointer to buffer holding the second matrix input [ B matrix], which is the pre-processed kernel matrix with bias values |
| [out] | dst[] | : Pointer to buffer holding the output matrix [ C matrix] |
| [in] | pKerExecArgs | : Pointer to the structure holding exec parameters |
| MMALIB_STATUS MMALIB_CNN_fullyConnected_ixX_ixX_oxX_exec_checkParams | ( | MMALIB_kernelHandle | handle, |
| const void * | src0, | ||
| const void * | src1, | ||
| const void * | dst | ||
| ) |
This function checks the parameters and should be called before kernel executuon. It can be called once.
| [in] | handle | : Active handle to the kernel |
| [in] | src0[] | : Pointer to buffer holding the first matrix input [ A matrix], which is the feature map |
| [in] | src1[] | : Pointer to buffer holding the second matrix input [ B matrix], which is the pre-processed kernel matrix |
| [out] | dst[] | : Pointer to buffer holding the output matrix [ C matrix] |
| int32_t MMALIB_CNN_generateFillBiasPredicateRegisters | ( | MMALIB_kernelHandle | handle, |
| int32_t | inputWidth, | ||
| int32_t | processWidth, | ||
| uint32_t | mmaWidth | ||
| ) |
This function generates the predicate buffer for feature matrix.
| [in] | handle | : Active handle to the kernel |
| [in] | inputWidth | : Width of Feature map |
| [in] | processWidth | : Total width of feature map augmented with bias |
| [in] | mmaWidth | : MMA width |
| MMALIB_STATUS MMALIB_CNN_fullyConnected_ixX_ixX_oxX_reorderWeights | ( | int32_t | mmaSize, |
| int32_t | NiBias, | ||
| int32_t | No, | ||
| uint32_t | strideOut, | ||
| const void *restrict | pWeights, | ||
| void *restrict | pReorderWeights | ||
| ) |
This function re-orders the input weights (kernel matrix). Reordering of data is required to alleviate potential bank conflicts arising when the kernel matrix is accessed in L2 via SE1 in conjunction with data transfer from MSMC to L2 via DMA. The current re-ordering scheme results in a bank-acess pattern of {0,0,1,1,2,2,3,3,0,0,1,1,2,2,3,3, ...} for SE1.
| [in] | mmaSize | : Size of MMA for given test case
|
| [in] | NiBias | : Ni (number of input channels) + Bias columns |
| [in] | No | : Number of output features |
| [in] | strideOut | : Stride of matrix after re-ordering |
| [in] | pWeights | : Pointer for input weights |
| [in] | pReorderWeights | : Pointer for ouput weights after re-ordering |
| void MMALIB_CNN_fullyConnected_ixX_ixX_oxX_perfEst | ( | MMALIB_kernelHandle | handle, |
| const MMALIB_bufParams2D_t * | src0_addr, | ||
| const MMALIB_bufParams2D_t * | src1_addr, | ||
| const MMALIB_bufParams2D_t * | dst_addr, | ||
| uint64_t * | archCycles, | ||
| uint64_t * | estCycles, | ||
| int32_t * | caseNumber | ||
| ) |
This function estimates the cycles consumed for the kernel execution.
| [in] | handle | : Active handle to the kernel |
| [in] | src0_addr | : Pointer to the structure containing dimensional information of src0 |
| [in] | src1_addr | : Pointer to the structure containing dimensional information of src1 |
| [out] | dst_addr | : Pointer to the structure containing dimensional information of dst |
| [out] | archCycles | : Cycles estimated for the compute, startup and teardown |
| [out] | estCycles | : Cycles estimated for the compute, startup, teardown and any associated overhead |
| [out] | caseNumber | : The case (execution path) taken insided the execution of the kernel |