Skip to content

Strided Matrix Subtraction Kernels

Module: Strided Matrix operations / Strided Matrix Subtraction

More...

Functions

Name
void plp_mat_sub_stride_f32p_xpulpv2(void * args)
Parallel strided matrix subtraction of 32-bit floating-point matrices kernel for XPULPV2 extension.
void plp_mat_sub_stride_f32s_xpulpv2(const float restrict pSrcA, const float restrict pSrcB, uint32_t M, uint32_t N, uint32_t strideA, uint32_t strideB, uint32_t strideY, float *restrict pDst)
strided matrix subtraction of 32-bit floating-point matrices kernel for XPULPV2 extension.
void plp_mat_sub_stride_i16p_xpulpv2(void * args)
Parallel strided matrix subtraction of 16-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_sub_stride_i16s_rv32im(const int16_t restrict pSrcA, const int16_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t strideA, uint32_t strideB, uint32_t strideY, int16_t *restrict pDst)
strided matrix subtraction of 16-bit integer matrices kernel for RV32IM extension.
void plp_mat_sub_stride_i16s_xpulpv2(const int16_t restrict pSrcA, const int16_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t strideA, uint32_t strideB, uint32_t strideY, int16_t *restrict pDst)
strided matrix subtraction of 16-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_sub_stride_i32p_xpulpv2(void * args)
Parallel strided matrix subtraction of 32-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_sub_stride_i32s_rv32im(const int32_t restrict pSrcA, const int32_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t strideA, uint32_t strideB, uint32_t strideY, int32_t *restrict pDst)
strided matrix subtraction of 32-bit integer matrices kernel for RV32IM extension.
void plp_mat_sub_stride_i32s_xpulpv2(const int32_t restrict pSrcA, const int32_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t strideA, uint32_t strideB, uint32_t strideY, int32_t *restrict pDst)
strided matrix subtraction of 32-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_sub_stride_i8p_xpulpv2(void * args)
Parallel strided matrix subtraction of 8-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_sub_stride_i8s_rv32im(const int8_t restrict pSrcA, const int8_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t strideA, uint32_t strideB, uint32_t strideY, int8_t *restrict pDst)
strided matrix subtraction of 8-bit integer matrices kernel for RV32IM extension.
void plp_mat_sub_stride_i8s_xpulpv2(const int8_t restrict pSrcA, const int8_t restrict pSrcB, uint32_t M, uint32_t N, uint32_t strideA, uint32_t strideB, uint32_t strideY, int8_t *restrict pDst)
strided matrix subtraction of 8-bit integer matrices kernel for XPULPV2 extension.

Detailed Description

This module contains the kernels for strided matrix subtraction.

The Matrx Subtraction subtracts 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_sub_stride_i32s_xpulpv2):

`plp_<function name>_<data type><precision><method>_<isa_extension>`
name description
function_name mat_sub_stride
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

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_sub_stride_f32p_xpulpv2

void plp_mat_sub_stride_f32p_xpulpv2(
    void * args
)

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

Parameters:

Return: none

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

function plp_mat_sub_stride_f32s_xpulpv2

void plp_mat_sub_stride_f32s_xpulpv2(
    const float *__restrict__ pSrcA,
    const float *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t strideA,
    uint32_t strideB,
    uint32_t strideY,
    float *__restrict__ pDst
)

strided matrix subtraction 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
  • strideA Stride of matrix A (elements between each row)
  • strideB Stride of matrid B (elements between each row)
  • strideY Stride of output matrix (elements between each row)
  • pDst Points to the output matrix

Return: none

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

function plp_mat_sub_stride_i16p_xpulpv2

void plp_mat_sub_stride_i16p_xpulpv2(
    void * args
)

Parallel strided matrix subtraction 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.

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

function plp_mat_sub_stride_i16s_rv32im

void plp_mat_sub_stride_i16s_rv32im(
    const int16_t *__restrict__ pSrcA,
    const int16_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t strideA,
    uint32_t strideB,
    uint32_t strideY,
    int16_t *__restrict__ pDst
)

strided matrix subtraction 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
  • strideA Stride of matrix A (elements between each row)
  • strideB Stride of matrid B (elements between each row)
  • strideY Stride of output matrix (elements between each row)
  • pDst Points to the output matrix

Return: none

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

function plp_mat_sub_stride_i16s_xpulpv2

void plp_mat_sub_stride_i16s_xpulpv2(
    const int16_t *__restrict__ pSrcA,
    const int16_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t strideA,
    uint32_t strideB,
    uint32_t strideY,
    int16_t *__restrict__ pDst
)

strided matrix subtraction 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
  • strideA Stride of matrix A (elements between each row)
  • strideB Stride of matrid B (elements between each row)
  • strideY Stride of output matrix (elements between each row)
  • pDst Points to the output matrix

Return: none

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

function plp_mat_sub_stride_i32p_xpulpv2

void plp_mat_sub_stride_i32p_xpulpv2(
    void * args
)

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

Parameters:

Return: none

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

function plp_mat_sub_stride_i32s_rv32im

void plp_mat_sub_stride_i32s_rv32im(
    const int32_t *__restrict__ pSrcA,
    const int32_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t strideA,
    uint32_t strideB,
    uint32_t strideY,
    int32_t *__restrict__ pDst
)

strided matrix subtraction 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
  • strideA Stride of matrix A (elements between each row)
  • strideB Stride of matrid B (elements between each row)
  • strideY Stride of output matrix (elements between each row)
  • pDst Points to the output matrix

Return: none

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

function plp_mat_sub_stride_i32s_xpulpv2

void plp_mat_sub_stride_i32s_xpulpv2(
    const int32_t *__restrict__ pSrcA,
    const int32_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t strideA,
    uint32_t strideB,
    uint32_t strideY,
    int32_t *__restrict__ pDst
)

strided matrix subtraction 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
  • strideA Stride of matrix A (elements between each row)
  • strideB Stride of matrid B (elements between each row)
  • strideY Stride of output matrix (elements between each row)
  • pDst Points to the output matrix

Return: none

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

function plp_mat_sub_stride_i8p_xpulpv2

void plp_mat_sub_stride_i8p_xpulpv2(
    void * args
)

Parallel strided matrix subtraction 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.

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

function plp_mat_sub_stride_i8s_rv32im

void plp_mat_sub_stride_i8s_rv32im(
    const int8_t *__restrict__ pSrcA,
    const int8_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t strideA,
    uint32_t strideB,
    uint32_t strideY,
    int8_t *__restrict__ pDst
)

strided matrix subtraction 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
  • strideA Stride of matrix A (elements between each row)
  • strideB Stride of matrid B (elements between each row)
  • strideY Stride of output matrix (elements between each row)
  • pDst Points to the output matrix

Return: none

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

function plp_mat_sub_stride_i8s_xpulpv2

void plp_mat_sub_stride_i8s_xpulpv2(
    const int8_t *__restrict__ pSrcA,
    const int8_t *__restrict__ pSrcB,
    uint32_t M,
    uint32_t N,
    uint32_t strideA,
    uint32_t strideB,
    uint32_t strideY,
    int8_t *__restrict__ pDst
)

strided matrix subtraction 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
  • strideA Stride of matrix A (elements between each row)
  • strideB Stride of matrid B (elements between each row)
  • strideY Stride of output matrix (elements between each row)
  • pDst Points to the output matrix

Return: none

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


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