Skip to content

matrix addition Kernels

Module: Matrix Functions / matrix addition

More...

Functions

Name
void plp_mat_add_f32p_xpulpv2(void * args)
Parallel matrix addition of 32-bit floating-point matrices kernel for XPULPV2 extension.
void plp_mat_add_f32s_xpulpv2(const float restrict pSrcA, const float restrict pSrcB, uint32_t M, uint32_t N, float *restrict pDst)
matrix addition of 32-bit floating-point matrices kernel for XPULPV2 extension.
void plp_mat_add_i16p_xpulpv2(void * args)
Parallel matrix addition of 16-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_add_i16s_rv32im(const int16_t restrict pSrcA, const int16_t restrict pSrcB, uint32_t M, uint32_t N, int16_t *restrict pDst)
matrix addition of 16-bit integer matrices kernel for RV32IM extension.
void plp_mat_add_i16s_xpulpv2(const int16_t restrict pSrcA, const int16_t restrict pSrcB, uint32_t M, uint32_t N, int16_t *restrict pDst)
matrix addition of 16-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_add_i32p_xpulpv2(void * args)
Parallel matrix addition of 32-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_add_i32s_rv32im(const int32_t restrict pSrcA, const int32_t restrict pSrcB, uint32_t M, uint32_t N, int32_t *restrict pDst)
matrix addition of 32-bit integer matrices kernel for RV32IM extension.
void plp_mat_add_i32s_xpulpv2(const int32_t restrict pSrcA, const int32_t restrict pSrcB, uint32_t M, uint32_t N, int32_t *restrict pDst)
matrix addition of 32-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_add_i8p_xpulpv2(void * args)
Parallel matrix addition of 8-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_add_i8s_rv32im(const int8_t restrict pSrcA, const int8_t restrict pSrcB, uint32_t M, uint32_t N, int8_t *restrict pDst)
matrix addition of 8-bit integer matrices kernel for RV32IM extension.
void plp_mat_add_i8s_xpulpv2(const int8_t restrict pSrcA, const int8_t restrict pSrcB, uint32_t M, uint32_t N, int8_t *restrict pDst)
matrix addition of 8-bit integer matrices kernel for XPULPV2 extension.

Detailed Description

This module contains the kernels for matrix addition.

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_i32s_xpulpv2):

`plp_<function name>_<data type><precision><method>_<isa_extension>`
name description
function_name mat_add
data type {f, i, q} respectively for floats, integers, fixed points
precision {32, 16, 8} bits
method {s, v, p} meaning scalar, vectorized (i.e. SIMD) and parallel, respectively
isa_extension {rv32im, xpulpv2} respectively for ibex and riscy

Functions Documentation

function plp_mat_add_f32p_xpulpv2

void plp_mat_add_f32p_xpulpv2(
    void * args
)

Parallel matrix addition of 32-bit floating-point matrices kernel for XPULPV2 extension.

Parameters:

Return: none

function plp_mat_add_f32s_xpulpv2

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

matrix addition of 32-bit floating-point matrices kernel for XPULPV2 extension.

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

matrix addition of a 32-bit floating-point matrices for XPULPV2 extension.

function plp_mat_add_i16p_xpulpv2

void plp_mat_add_i16p_xpulpv2(
    void * args
)

Parallel matrix addition of 16-bit integer matrices kernel for XPULPV2 extension.

Parameters:

Return: none

Par: Exploiting SIMD instructions

The 16 bit values are packed two each into 32 bit vectors and then the two dot products are performed on 32 bit vectors, with 32 bit accumulator.

function plp_mat_add_i16s_rv32im

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

matrix addition of 16-bit integer matrices kernel for RV32IM extension.

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

matrix addition of a 16-bit integer matrices for RV32IM extension.

function plp_mat_add_i16s_xpulpv2

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

matrix addition of 16-bit integer matrices kernel for XPULPV2 extension.

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

matrix addition of a 16-bit integer matrices for XPULPV2 extension.

function plp_mat_add_i32p_xpulpv2

void plp_mat_add_i32p_xpulpv2(
    void * args
)

Parallel matrix addition of 32-bit integer matrices kernel for XPULPV2 extension.

Parameters:

Return: none

Parallel matrix addition of a 32-bit integer matrices for XPULPV2 extension.

function plp_mat_add_i32s_rv32im

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

matrix addition of 32-bit integer matrices kernel for RV32IM extension.

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

matrix addition of a 32-bit integer matrices for RV32IM extension.

function plp_mat_add_i32s_xpulpv2

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

matrix addition of 32-bit integer matrices kernel for XPULPV2 extension.

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

matrix addition of a 32-bit integer matrices for XPULPV2 extension.

function plp_mat_add_i8p_xpulpv2

void plp_mat_add_i8p_xpulpv2(
    void * args
)

Parallel matrix addition of 8-bit integer matrices kernel for XPULPV2 extension.

Parameters:

Return: none

Par: Exploiting SIMD instructions

The 8 bit values are packed four each into 32 bit vectors and then the four dot products are performed on 32 bit vectors, with 32 bit accumulator.

function plp_mat_add_i8s_rv32im

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

matrix addition of 8-bit integer matrices kernel for RV32IM extension.

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

matrix addition of a 8-bit integer matrices for RV32IM extension.

function plp_mat_add_i8s_xpulpv2

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

matrix addition of 8-bit integer matrices kernel for XPULPV2 extension.

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

matrix addition of a 8-bit integer matrices for XPULPV2 extension.


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