Skip to content

matrix addition

Module: Matrix Functions

More...

Modules

Name
matrix addition Kernels

Functions

Name
void plp_mat_add_f32(const float restrict pSrcA, const float restrict pSrcB, uint32_t M, uint32_t N, float *restrict pDst)
Glue code for matrix addition of 32-bit floating-point matrices.
void plp_mat_add_f32_parallel(const float restrict pSrcA, const float restrict pSrcB, uint32_t M, uint32_t N, uint32_t nPE, float *restrict pDst)
Glue code for parallel matrix addition of 32-bit floating-point matrices.
void plp_mat_add_i16(const int16_t restrict pSrcA, const int16_t restrict pSrcB, uint32_t M, uint32_t N, int16_t *restrict pDst)
Glue code for matrix addition of 16-bit integer matrices.
void plp_mat_add_i16_parallel(const int16_t restrict pSrcA, const int16_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t nPE, int16_t *restrict pDst)
Glue code for parallel matrix addition of 16-bit integer matrices.
void plp_mat_add_i32(const int32_t restrict pSrcA, const int32_t restrict pSrcB, uint32_t M, uint32_t N, int32_t *restrict pDst)
Glue code for matrix addition of 16-bit integer matrices.
void plp_mat_add_i32_parallel(const int32_t restrict pSrcA, const int32_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t nPE, int32_t *restrict pDst)
Glue code for parallel matrix addition of 16-bit integer matrices.
void plp_mat_add_i8(const int8_t restrict pSrcA, const int8_t restrict pSrcB, uint32_t M, uint32_t N, int8_t *restrict pDst)
Glue code for matrix addition of 16-bit integer matrices.
void plp_mat_add_i8_parallel(const int8_t restrict pSrcA, const int8_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t nPE, int8_t *restrict pDst)
Glue code for parallel matrix addition of 16-bit integer matrices.

Detailed Description

This module contains the glue code for matrix addition. The kernel codes (kernels) are in the Module strided matrix addition Kernels.

The Matrx Addition adds two matrices, element wise. Both matrices, and the output matrix have dimension MxN.

`pDst[m, n] = pSrcA[m, n] + pSrcB[m, n]`

There are functions for integer 32- 16- and 8-bit data types, as well as for floating-point. These functions can also be used for fix-point matrices, if they have their fix-point at the same location. The outpt matrix will then also have the fix-point at the same location.

The naming scheme of the functions follows the following pattern (for example plp_mat_add_i32):

`plp_<function name>_<data type><precision>[_parallel]`
name description
function_name mat_add
data type {f, i, q} respectively for floats, integers, fixed points
precision {32, 16, 8} bits

Functions Documentation

function plp_mat_add_f32

void plp_mat_add_f32(
    const float *__restrict__ pSrcA,
    const float *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    float *__restrict__ pDst
)

Glue code for matrix addition of 32-bit floating-point matrices.

Parameters:

  • pSrcA Points to the first input matrix
  • pSrcB Points to the second input matrix
  • M Height of all matrices
  • N Width of all matrices
  • pDst Points to the output matrix

Return: none

Glue code for matrix addition of a 32-bit floating-point matrices.

function plp_mat_add_f32_parallel

void plp_mat_add_f32_parallel(
    const float *__restrict__ pSrcA,
    const float *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t nPE,
    float *__restrict__ pDst
)

Glue code for parallel matrix addition of 32-bit floating-point matrices.

Parameters:

  • pSrcA Points to the first input matrix
  • pSrcB Points to the second input matrix
  • M Height of all matrices
  • N Width of all matrices
  • nPE Number of cores to use for computation
  • pDst Points to the output matrix

Return: none

Glue code for parallel matrix addition of a 32-bit floating-point matrices.

function plp_mat_add_i16

void plp_mat_add_i16(
    const int16_t *__restrict__ pSrcA,
    const int16_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    int16_t *__restrict__ pDst
)

Glue code for matrix addition of 16-bit integer matrices.

Parameters:

  • pSrcA Points to the first input matrix
  • pSrcB Points to the second input matrix
  • M Height of all matrices
  • N Width of all matrices
  • pDst Points to the output matrix

Return: none

Glue code for matrix addition of a 16-bit integer matrices.

function plp_mat_add_i16_parallel

void plp_mat_add_i16_parallel(
    const int16_t *__restrict__ pSrcA,
    const int16_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t nPE,
    int16_t *__restrict__ pDst
)

Glue code for parallel matrix addition of 16-bit integer matrices.

Parameters:

  • pSrcA Points to the first input matrix
  • pSrcB Points to the second input matrix
  • M Height of all matrices
  • N Width of all matrices
  • nPE Number of cores to use for computation
  • pDst Points to the output matrix

Return: none

Glue code for parallel matrix addition of a 16-bit integer matrices.

function plp_mat_add_i32

void plp_mat_add_i32(
    const int32_t *__restrict__ pSrcA,
    const int32_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    int32_t *__restrict__ pDst
)

Glue code for matrix addition of 16-bit integer matrices.

Parameters:

  • pSrcA Points to the first input matrix
  • pSrcB Points to the second input matrix
  • M Height of all matrices
  • N Width of all matrices
  • pDst Points to the output matrix

Return: none

function plp_mat_add_i32_parallel

void plp_mat_add_i32_parallel(
    const int32_t *__restrict__ pSrcA,
    const int32_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t nPE,
    int32_t *__restrict__ pDst
)

Glue code for parallel matrix addition of 16-bit integer matrices.

Parameters:

  • pSrcA Points to the first input matrix
  • pSrcB Points to the second input matrix
  • M Height of all matrices
  • N Width of all matrices
  • nPE Number of cores to use for computation
  • pDst Points to the output matrix

Return: none

Glue code for parallel matrix addition of a 32-bit integer matrices.

function plp_mat_add_i8

void plp_mat_add_i8(
    const int8_t *__restrict__ pSrcA,
    const int8_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    int8_t *__restrict__ pDst
)

Glue code for matrix addition of 16-bit integer matrices.

Parameters:

  • pSrcA Points to the first input matrix
  • pSrcB Points to the second input matrix
  • M Height of all matrices
  • N Width of all matrices
  • pDst Points to the output matrix

Return: none

Glue code for matrix addition of a 8-bit integer matrices.

function plp_mat_add_i8_parallel

void plp_mat_add_i8_parallel(
    const int8_t *__restrict__ pSrcA,
    const int8_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t nPE,
    int8_t *__restrict__ pDst
)

Glue code for parallel matrix addition of 16-bit integer matrices.

Parameters:

  • pSrcA Points to the first input matrix
  • pSrcB Points to the second input matrix
  • M Height of all matrices
  • N Width of all matrices
  • nPE Number of cores to use for computation
  • pDst Points to the output matrix

Return: none

Glue code for parallel matrix addition of a 8-bit integer matrices.


Updated on 2023-03-01 at 16:16:32 +0000