Skip to content

Strided Matrix Scale Kernels

Module: Strided Matrix operations / Strided Matrix Scale

More...

Functions

Name
void plp_mat_scale_stride_f32p_xpulpv2(void * args)
Parallel strided matrix scale of 32-bit floating-point matrices kernel for XPULPV2 extension.
void plp_mat_scale_stride_f32s_xpulpv2(const float restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, float scaleFactor, float restrict pDst)
strided matrix scale of 32-bit floating-point matrices kernel for XPULPV2 extension.
void plp_mat_scale_stride_i16p_xpulpv2(void * args)
Parallel strided matrix scale of 16-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_scale_stride_i16s_rv32im(const int16_t restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, int16_t scaleFactor, int32_t shift, int16_t restrict pDst)
strided matrix scale of 16-bit integer matrices kernel for RV32IM extension.
void plp_mat_scale_stride_i16s_xpulpv2(const int16_t restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, int16_t scaleFactor, int32_t shift, int16_t restrict pDst)
strided matrix scale of 16-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_scale_stride_i32p_xpulpv2(void * args)
Parallel strided matrix scale of 32-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_scale_stride_i32s_rv32im(const int32_t restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, int32_t scaleFactor, int32_t shift, int32_t restrict pDst)
strided matrix scale of 32-bit integer matrices kernel for RV32IM extension.
void plp_mat_scale_stride_i32s_xpulpv2(const int32_t restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, int32_t scaleFactor, int32_t shift, int32_t restrict pDst)
strided matrix scale of 32-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_scale_stride_i8p_xpulpv2(void * args)
Parallel strided matrix scale of 8-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_scale_stride_i8s_rv32im(const int8_t restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, int8_t scaleFactor, int32_t shift, int8_t restrict pDst)
strided matrix scale of 8-bit integer matrices kernel for RV32IM extension.
void plp_mat_scale_stride_i8s_xpulpv2(const int8_t restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, int8_t scaleFactor, int32_t shift, int8_t restrict pDst)
strided matrix scale of 8-bit integer matrices kernel for XPULPV2 extension.

Detailed Description

This module contains the kernel functions for strided matrix scale.

The Matrix Scale applies a scalar multiplication, followed by a bitshift operation to every element in the matrix. For floating-point implementations, the bitshift operation is not applied.

`pDst[m,n] = (pSrc[m,n] * scale) >> shift`

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

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

void plp_mat_scale_stride_f32p_xpulpv2(
    void * args
)

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

Parameters:

Return: none

function plp_mat_scale_stride_f32s_xpulpv2

void plp_mat_scale_stride_f32s_xpulpv2(
    const float *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    uint32_t strideSrc,
    uint32_t strideDst,
    float scaleFactor,
    float *__restrict__ pDst
)

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

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • strideSrc Stride of input matrix (elements between each row)
  • strideDst Stride of output matrix (elements between each row)
  • scaleFactor Factor to mulitply all elements
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_stride_i16p_xpulpv2

void plp_mat_scale_stride_i16p_xpulpv2(
    void * args
)

Parallel strided matrix scale 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_scale_stride_i16s_rv32im

void plp_mat_scale_stride_i16s_rv32im(
    const int16_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    uint32_t strideSrc,
    uint32_t strideDst,
    int16_t scaleFactor,
    int32_t shift,
    int16_t *__restrict__ pDst
)

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

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • strideSrc Stride of input matrix (elements between each row)
  • strideDst Stride of output matrix (elements between each row)
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_stride_i16s_xpulpv2

void plp_mat_scale_stride_i16s_xpulpv2(
    const int16_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    uint32_t strideSrc,
    uint32_t strideDst,
    int16_t scaleFactor,
    int32_t shift,
    int16_t *__restrict__ pDst
)

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

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • strideSrc Stride of input matrix (elements between each row)
  • strideDst Stride of output matrix (elements between each row)
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_stride_i32p_xpulpv2

void plp_mat_scale_stride_i32p_xpulpv2(
    void * args
)

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

Parameters:

Return: none

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

function plp_mat_scale_stride_i32s_rv32im

void plp_mat_scale_stride_i32s_rv32im(
    const int32_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    uint32_t strideSrc,
    uint32_t strideDst,
    int32_t scaleFactor,
    int32_t shift,
    int32_t *__restrict__ pDst
)

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

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • strideSrc Stride of input matrix (elements between each row)
  • strideDst Stride of output matrix (elements between each row)
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_stride_i32s_xpulpv2

void plp_mat_scale_stride_i32s_xpulpv2(
    const int32_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    uint32_t strideSrc,
    uint32_t strideDst,
    int32_t scaleFactor,
    int32_t shift,
    int32_t *__restrict__ pDst
)

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

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • strideSrc Stride of input matrix (elements between each row)
  • strideDst Stride of output matrix (elements between each row)
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_stride_i8p_xpulpv2

void plp_mat_scale_stride_i8p_xpulpv2(
    void * args
)

Parallel strided matrix scale 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_scale_stride_i8s_rv32im

void plp_mat_scale_stride_i8s_rv32im(
    const int8_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    uint32_t strideSrc,
    uint32_t strideDst,
    int8_t scaleFactor,
    int32_t shift,
    int8_t *__restrict__ pDst
)

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

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • strideSrc Stride of input matrix (elements between each row)
  • strideDst Stride of output matrix (elements between each row)
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_stride_i8s_xpulpv2

void plp_mat_scale_stride_i8s_xpulpv2(
    const int8_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    uint32_t strideSrc,
    uint32_t strideDst,
    int8_t scaleFactor,
    int32_t shift,
    int8_t *__restrict__ pDst
)

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

Parameters:

  • pSrc Points to the input matrix
  • M Height of both matrices
  • N Width of both matrices
  • strideSrc Stride of input matrix (elements between each row)
  • strideDst Stride of output matrix (elements between each row)
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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


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