Skip to content

matrix scale Kernels

Module: Matrix Functions / matrix scale

More...

Functions

Name
void plp_mat_scale_f32p_xpulpv2(void * args)
Parallel matrix scale of 32-bit floating-point matrices kernel for XPULPV2 extension.
void plp_mat_scale_f32s_xpulpv2(const float restrict pSrc, uint32_t M, uint32_t N, float scaleFactor, float restrict pDst)
matrix scale of 32-bit floating-point matrices kernel for XPULPV2 extension.
void plp_mat_scale_i16p_xpulpv2(void * args)
Parallel matrix scale of 16-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_scale_i16s_rv32im(const int16_t restrict pSrc, uint32_t M, uint32_t N, int16_t scaleFactor, int32_t shift, int16_t restrict pDst)
matrix scale of 16-bit integer matrices kernel for RV32IM extension.
void plp_mat_scale_i16s_xpulpv2(const int16_t restrict pSrc, uint32_t M, uint32_t N, int16_t scaleFactor, int32_t shift, int16_t restrict pDst)
matrix scale of 16-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_scale_i32p_xpulpv2(void * args)
Parallel matrix scale of 32-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_scale_i32s_rv32im(const int32_t restrict pSrc, uint32_t M, uint32_t N, int32_t scaleFactor, int32_t shift, int32_t restrict pDst)
matrix scale of 32-bit integer matrices kernel for RV32IM extension.
void plp_mat_scale_i32s_xpulpv2(const int32_t restrict pSrc, uint32_t M, uint32_t N, int32_t scaleFactor, int32_t shift, int32_t restrict pDst)
matrix scale of 32-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_scale_i8p_xpulpv2(void * args)
Parallel matrix scale of 8-bit integer matrices kernel for XPULPV2 extension.
void plp_mat_scale_i8s_rv32im(const int8_t restrict pSrc, uint32_t M, uint32_t N, int8_t scaleFactor, int32_t shift, int8_t restrict pDst)
matrix scale of 8-bit integer matrices kernel for RV32IM extension.
void plp_mat_scale_i8s_xpulpv2(const int8_t restrict pSrc, uint32_t M, uint32_t N, int8_t scaleFactor, int32_t shift, int8_t restrict pDst)
matrix scale of 8-bit integer matrices kernel for XPULPV2 extension.

Detailed Description

This module contains the kernel functions for 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_i32s_xpulpv2):

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

void plp_mat_scale_f32p_xpulpv2(
    void * args
)

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

Parameters:

Return: none

function plp_mat_scale_f32s_xpulpv2

void plp_mat_scale_f32s_xpulpv2(
    const float *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    float scaleFactor,
    float *__restrict__ pDst
)

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
  • scaleFactor Factor to mulitply all elements
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_i16p_xpulpv2

void plp_mat_scale_i16p_xpulpv2(
    void * args
)

Parallel 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_i16s_rv32im

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

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
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_i16s_xpulpv2

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

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
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_i32p_xpulpv2

void plp_mat_scale_i32p_xpulpv2(
    void * args
)

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

Parameters:

Return: none

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

function plp_mat_scale_i32s_rv32im

void plp_mat_scale_i32s_rv32im(
    const int32_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    int32_t scaleFactor,
    int32_t shift,
    int32_t *__restrict__ pDst
)

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
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_i32s_xpulpv2

void plp_mat_scale_i32s_xpulpv2(
    const int32_t *__restrict__ pSrc,
    uint32_t M,
    uint32_t N,
    int32_t scaleFactor,
    int32_t shift,
    int32_t *__restrict__ pDst
)

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
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_i8p_xpulpv2

void plp_mat_scale_i8p_xpulpv2(
    void * args
)

Parallel 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_i8s_rv32im

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

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
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_i8s_xpulpv2

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

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
  • scaleFactor Factor to mulitply all elements before shifting
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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


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