Skip to content

Strided Matrix Scale

Module: Strided Matrix operations

More...

Modules

Name
Strided Matrix Scale Kernels

Functions

Name
void plp_mat_scale_stride_f32(const float restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, float scaleFactor, float restrict pDst)
Glue code for strided matrix scale of 32-bit floating-point matrices.
void plp_mat_scale_stride_f32_parallel(const float restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, float scaleFactor, uint32_t nPE, float restrict pDst)
Glue code for parallel strided matrix scale of 32-bit floating-point matrices.
void plp_mat_scale_stride_i16(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)
Glue code for strided matrix scale of 16-bit integer matrices.
void plp_mat_scale_stride_i16_parallel(const int16_t restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, int16_t scaleFactor, int32_t shift, uint32_t nPE, int16_t restrict pDst)
Glue code for parallel strided matrix scale of 16-bit integer matrices.
void plp_mat_scale_stride_i32(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)
Glue code for strided matrix scale of 16-bit integer matrices.
void plp_mat_scale_stride_i32_parallel(const int32_t restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, int32_t scaleFactor, int32_t shift, uint32_t nPE, int32_t restrict pDst)
Glue code for parallel strided matrix scale of 16-bit integer matrices.
void plp_mat_scale_stride_i8(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)
Glue code for strided matrix scale of 16-bit integer matrices.
void plp_mat_scale_stride_i8_parallel(const int8_t restrict pSrc, uint32_t M, uint32_t N, uint32_t strideSrc, uint32_t strideDst, int8_t scaleFactor, int32_t shift, uint32_t nPE, int8_t restrict pDst)
Glue code for parallel strided matrix scale of 16-bit integer matrices.

Detailed Description

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

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

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

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_f32

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

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

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

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

function plp_mat_scale_stride_f32_parallel

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

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

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
  • nPE Number of cores to use for computation
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_stride_i16

void plp_mat_scale_stride_i16(
    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
)

Glue code for strided matrix scale of 16-bit integer matrices.

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

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

function plp_mat_scale_stride_i16_parallel

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

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

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
  • nPE Number of cores to use for computation
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_stride_i32

void plp_mat_scale_stride_i32(
    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
)

Glue code for strided matrix scale of 16-bit integer matrices.

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

Glue code for strided matrix scale of a 32-bit integer matrices.

function plp_mat_scale_stride_i32_parallel

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

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

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
  • nPE Number of cores to use for computation
  • shift Amount to shift each element
  • pDst Points to the output matrix

Return: none

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

function plp_mat_scale_stride_i8

void plp_mat_scale_stride_i8(
    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
)

Glue code for strided matrix scale of 16-bit integer matrices.

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

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

function plp_mat_scale_stride_i8_parallel

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

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

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
  • nPE Number of cores to use for computation
  • pDst Points to the output matrix

Return: none

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


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