Strided Matrix Transposed Matrix Multiplication
Module: Strided Matrix operations
Modules
Name |
---|
Strided Matrix Transpose Matrix Multiplication Kernels |
Functions
Name | |
---|---|
void | plp_mat_mult_trans_stride_f32(const float restrict pSrcA, const float restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, float *restrict pDstC) Glue code for strided matrix multiplication of 32-bit floating-point matrices. |
void | plp_mat_mult_trans_stride_f32_parallel(const float restrict pSrcA, const float restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, uint32_t nPE, float *restrict pDstC) Glue code for parallel strided matrix multiplication of 32-bit floating-point matrices. |
void | plp_mat_mult_trans_stride_i16(const int16_t restrict pSrcA, const int16_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, int32_t *restrict pDstC) Glue code for strided matrix multiplication of 16-bit integer matrices. |
void | plp_mat_mult_trans_stride_i16_parallel(const int16_t restrict pSrcA, const int16_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, uint32_t nPE, int32_t *restrict pDstC) Glue code for parallel strided matrix multiplication of 16-bit integer matrices. |
void | plp_mat_mult_trans_stride_i32(const int32_t restrict pSrcA, const int32_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, int32_t *restrict pDstC) Glue code for strided matrix multiplication of 32-bit integer matrices. |
void | plp_mat_mult_trans_stride_i32_parallel(const int32_t restrict pSrcA, const int32_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, uint32_t nPE, int32_t *restrict pDstC) Glue code for parallel strided matrix multiplication of 32-bit integer matrices. |
void | plp_mat_mult_trans_stride_i8(const int8_t restrict pSrcA, const int8_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, int32_t *restrict pDstC) Glue code for strided matrix multiplication of 8-bit integer matrices. |
void | plp_mat_mult_trans_stride_i8_parallel(const int8_t restrict pSrcA, const int8_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, uint32_t nPE, int32_t *restrict pDstC) Glue code for parallel strided matrix multiplication of 8-bit integer matrices. |
void | plp_mat_mult_trans_stride_q16(const int16_t restrict pSrcA, const int16_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, uint32_t shift, int16_t *restrict pDstC) Glue code for strided matrix multiplication of 16-bit fix-point matrices. |
void | plp_mat_mult_trans_stride_q16_parallel(const int16_t restrict pSrcA, const int16_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, uint32_t shift, uint32_t nPE, int16_t *restrict pDstC) Glue code for parallel strided matrix multiplication of 16-bit fix-point matrices. |
void | plp_mat_mult_trans_stride_q32(const int32_t restrict pSrcA, const int32_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, uint32_t shift, int32_t *restrict pDstC) Glue code for strided matrix multiplication of 32-bit fix-point matrices. |
void | plp_mat_mult_trans_stride_q32_parallel(const int32_t restrict pSrcA, const int32_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, uint32_t shift, uint32_t nPE, int32_t *restrict pDstC) Glue code for parallel strided matrix multiplication of 32-bit fix-point matrices. |
void | plp_mat_mult_trans_stride_q8(const int8_t restrict pSrcA, const int8_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, uint32_t shift, int8_t *restrict pDstC) Glue code for strided matrix multiplication of 8-bit fix-point matrices. |
void | plp_mat_mult_trans_stride_q8_parallel(const int8_t restrict pSrcA, const int8_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t O, uint32_t strideA, uint32_t strideB, uint32_t strideC, uint32_t shift, uint32_t nPE, int8_t *restrict pDstC) Glue code for parallel strided matrix multiplication of 8-bit fix-point matrices. |
Detailed Description
This module contains the glue code for Matrix Transposed Matrix Multiplication. The kernel codes (kernels) are in the Moducle Matrix Transposed Matrix Multiplication Kernels.
The Matrix Transpose Matrix Multiplication computes the product of two matrices with dimensions MxN and OxN. Both matrices is accessed row wise, all values form the first are multiplied with the values of the second and then sum of the result gives the value for the result matrix. The resulting matrix has shape MxO.
'pDst[m,o] = pSrcA[m,0]*pSrcB[o,0] + pSrcA[m,1]*pSrcB[o,1] + ... + pSrcA[m,N-1]*pSrcB[o,N-1]`
There are functions for integer 32- 16- and 8-bit data types. For lower precision integers (16- and 8-bit), functions exploiting SIMD instructions are provided.
The naming scheme of the functions follows the following pattern (for example plp_mat_mult_stride_i32
):
`plp_<function name>_<data type><precision>[_parallel]`
name | description |
---|---|
function_name | mat_mult_trans_stride |
data type | {f, i, q} respectively for floats, integers, fixed points |
precision | {32, 16, 8} bits |
The strideX
argument tells how many elements are in between the start of each row of the matrix. In other words, it is the width of the original matrix. Strided Matrix operations
Functions Documentation
function plp_mat_mult_trans_stride_f32
void plp_mat_mult_trans_stride_f32(
const float *__restrict__ pSrcA,
const float *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
float *__restrict__ pDstC
)
Glue code for strided matrix multiplication of 32-bit floating-point matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- pDstC points to the output matrix
Return: none
Glue code for strided matrix transposed matrix multiplication of a 32-bit floating-point matrices.
function plp_mat_mult_trans_stride_f32_parallel
void plp_mat_mult_trans_stride_f32_parallel(
const float *__restrict__ pSrcA,
const float *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
uint32_t nPE,
float *__restrict__ pDstC
)
Glue code for parallel strided matrix multiplication of 32-bit floating-point matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- nPE Number of cores to use
- pDstC points to the output matrix
Return: none
Glue code for parallel strided matrix transposed matrix multiplication of a 32-bit floating-point matrices.
function plp_mat_mult_trans_stride_i16
void plp_mat_mult_trans_stride_i16(
const int16_t *__restrict__ pSrcA,
const int16_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
int32_t *__restrict__ pDstC
)
Glue code for strided matrix multiplication of 16-bit integer matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- pDstC points to the output matrix
Return: none
Glue code for strided matrix transposed matrix multiplication of a 16-bit integer matrices.
function plp_mat_mult_trans_stride_i16_parallel
void plp_mat_mult_trans_stride_i16_parallel(
const int16_t *__restrict__ pSrcA,
const int16_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
uint32_t nPE,
int32_t *__restrict__ pDstC
)
Glue code for parallel strided matrix multiplication of 16-bit integer matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- nPE Number of cores to use
- pDstC points to the output matrix
Return: none
Glue code for parallel strided matrix transposed matrix multiplication of a 16-bit integer matrices.
function plp_mat_mult_trans_stride_i32
void plp_mat_mult_trans_stride_i32(
const int32_t *__restrict__ pSrcA,
const int32_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
int32_t *__restrict__ pDstC
)
Glue code for strided matrix multiplication of 32-bit integer matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- pDstC points to the output matrix
Return: none
Glue code for strided matrix transposed matrix multiplication of a 32-bit integer matrices.
function plp_mat_mult_trans_stride_i32_parallel
void plp_mat_mult_trans_stride_i32_parallel(
const int32_t *__restrict__ pSrcA,
const int32_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
uint32_t nPE,
int32_t *__restrict__ pDstC
)
Glue code for parallel strided matrix multiplication of 32-bit integer matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- nPE Number of cores to use
- pDstC points to the output matrix
Return: none
Glue code for parallel strided matrix matrix multiplication of a 32-bit integer matrices.
function plp_mat_mult_trans_stride_i8
void plp_mat_mult_trans_stride_i8(
const int8_t *__restrict__ pSrcA,
const int8_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
int32_t *__restrict__ pDstC
)
Glue code for strided matrix multiplication of 8-bit integer matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- pDstC points to the output matrix
Return: none
Glue code for strided matrix transposed matrix multiplication of a 8-bit integer matrices.
function plp_mat_mult_trans_stride_i8_parallel
void plp_mat_mult_trans_stride_i8_parallel(
const int8_t *__restrict__ pSrcA,
const int8_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
uint32_t nPE,
int32_t *__restrict__ pDstC
)
Glue code for parallel strided matrix multiplication of 8-bit integer matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- nPE Number of cores to use
- pDstC points to the output matrix
Return: none
Glue code for parallel strided matrix transposed matrix multiplication of a 8-bit integer matrices.
function plp_mat_mult_trans_stride_q16
void plp_mat_mult_trans_stride_q16(
const int16_t *__restrict__ pSrcA,
const int16_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
uint32_t shift,
int16_t *__restrict__ pDstC
)
Glue code for strided matrix multiplication of 16-bit fix-point matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- shift Amount to shift the result of each multiplication.
- pDstC points to the output matrix
Return: none
Par: Fix-Point and Shifting
The result will be shifted by the parameter shift
to the right (multiplied by 2^-shift). Assume that matrix A is represented as pSrcA * 2^-x, and matrix B as pSrcB * 2^-y (in other words, A has it's x last digits after the binary point). Then, the output is represented as pDstC * 2^-(x + y - shift).
Glue code for strided matrix transposed matrix multiplication of a 16-bit fix-point matrices.
The output of the strided matrix multiplication will also be stored as an 16-bit array. Set the shift
parameter such that no overflow ocurrs.
function plp_mat_mult_trans_stride_q16_parallel
void plp_mat_mult_trans_stride_q16_parallel(
const int16_t *__restrict__ pSrcA,
const int16_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
uint32_t shift,
uint32_t nPE,
int16_t *__restrict__ pDstC
)
Glue code for parallel strided matrix multiplication of 16-bit fix-point matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- shift Amount to shift the result of each multiplication.
- nPE Number of cores to use
- pDstC points to the output matrix
Return: none
Par: Fix-Point and Shifting
The result will be shifted by the parameter shift
to the right (multiplied by 2^-shift). Assume that matrix A is represented as pSrcA * 2^-x, and matrix B as pSrcB * 2^-y (in other words, A has it's x last digits after the binary point). Then, the output is represented as pDstC * 2^-(x + y - shift).
Glue code for parallel strided matrix transposed matrix multiplication of a 16-bit fix-point matrices.
The output of the strided matrix multiplication will also be stored as an 16-bit array. Set the shift
parameter such that no overflow ocurrs.
function plp_mat_mult_trans_stride_q32
void plp_mat_mult_trans_stride_q32(
const int32_t *__restrict__ pSrcA,
const int32_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
uint32_t shift,
int32_t *__restrict__ pDstC
)
Glue code for strided matrix multiplication of 32-bit fix-point matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- shift Amount to shift the result of each multiplication.
- pDstC points to the output matrix
Return: none
Par: Fix-Point and Shifting
The result will be shifted by the parameter shift
to the right (multiplied by 2^-shift). Assume that matrix A is represented as pSrcA * 2^-x, and matrix B as pSrcB * 2^-y (in other words, A has it's x last digits after the binary point). Then, the output is represented as pDstC * 2^-(x + y - shift).
Glue code for strided matrix transposed matrix multiplication of a 32-bit fix-point matrices.
function plp_mat_mult_trans_stride_q32_parallel
void plp_mat_mult_trans_stride_q32_parallel(
const int32_t *__restrict__ pSrcA,
const int32_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
uint32_t shift,
uint32_t nPE,
int32_t *__restrict__ pDstC
)
Glue code for parallel strided matrix multiplication of 32-bit fix-point matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- shift Amount to shift the result of each multiplication.
- nPE Number of cores to use
- pDstC points to the output matrix
Return: none
Par: Fix-Point and Shifting
The result will be shifted by the parameter shift
to the right (multiplied by 2^-shift). Assume that matrix A is represented as pSrcA * 2^-x, and matrix B as pSrcB * 2^-y (in other words, A has it's x last digits after the binary point). Then, the output is represented as pDstC * 2^-(x + y - shift).
Glue code for parallel strided matrix transposed matrix multiplication of a 32-bit fix-point matrices.
function plp_mat_mult_trans_stride_q8
void plp_mat_mult_trans_stride_q8(
const int8_t *__restrict__ pSrcA,
const int8_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
uint32_t shift,
int8_t *__restrict__ pDstC
)
Glue code for strided matrix multiplication of 8-bit fix-point matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- shift Amount to shift the result of each multiplication.
- pDstC points to the output matrix
Return: none
Par: Fix-Point and Shifting
The result will be shifted by the parameter shift
to the right (multiplied by 2^-shift). Assume that matrix A is represented as pSrcA * 2^-x, and matrix B as pSrcB * 2^-y (in other words, A has it's x last digits after the binary point). Then, the output is represented as pDstC * 2^-(x + y - shift).
Glue code for strided matrix transposed matrix multiplication of a 8-bit fix-point matrices.
The output of the strided matrix multiplication will also be stored as an 8-bit array. Set the shift
parameter such that no overflow ocurrs.
function plp_mat_mult_trans_stride_q8_parallel
void plp_mat_mult_trans_stride_q8_parallel(
const int8_t *__restrict__ pSrcA,
const int8_t *__restrict__ pSrcB,
uint32_t M,
uint32_t N,
uint32_t O,
uint32_t strideA,
uint32_t strideB,
uint32_t strideC,
uint32_t shift,
uint32_t nPE,
int8_t *__restrict__ pDstC
)
Glue code for parallel strided matrix multiplication of 8-bit fix-point matrices.
Parameters:
- pSrcA points to the first input matrix
- pSrcB points to the second input matrix
- M height of the first input matrix
- N width of the first input matrix and hight of the second
- O width of the second input matrix
- strideA Stride of matrix A (elements between each row)
- strideB Stride of matrix B (elements between each row)
- strideC Stride of output matrix (elements between each row)
- shift Amount to shift the result of each multiplication.
- nPE Number of cores to use
- pDstC points to the output matrix
Return: none
Par: Fix-Point and Shifting
The result will be shifted by the parameter shift
to the right (multiplied by 2^-shift). Assume that matrix A is represented as pSrcA * 2^-x, and matrix B as pSrcB * 2^-y (in other words, A has it's x last digits after the binary point). Then, the output is represented as pDstC * 2^-(x + y - shift).
Glue code for parallel strided matrix transposed matrix multiplication of a 8-bit fix-point matrices.
The output of the strided matrix multiplication will also be stored as an 8-bit array. Set the shift
parameter such that no overflow ocurrs.
Updated on 2023-03-01 at 16:16:32 +0000