DSPLIB User Guide
DSPLIB_w_vec

Introduction

Kernel for weighted addition of two input vector data.

Data Structures

struct  DSPLIB_w_vec_InitArgs
 Structure containing the parameters to initialize the kernel. More...
 

Functions

int32_t DSPLIB_w_vec_getHandleSize (DSPLIB_w_vec_InitArgs *pKerInitArgs)
 This is a query function to calculate the size of internal handle. More...
 
DSPLIB_STATUS DSPLIB_w_vec_init (DSPLIB_kernelHandle handle, DSPLIB_bufParams1D_t *bufParamsIn, DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_w_vec_InitArgs *pKerInitArgs)
 This function should be called before the DSPLIB_w_vec_exec function is called. This function takes care of any one-time operations such as setting up the configuration of required hardware resources such as the MMA accelerator and the streaming engine. The results of these operations are stored in the handle. More...
 
DSPLIB_STATUS DSPLIB_w_vec_init_checkParams (DSPLIB_kernelHandle handle, const DSPLIB_bufParams1D_t *bufParamsIn, const DSPLIB_bufParams1D_t *bufParamsOut, const DSPLIB_w_vec_InitArgs *pKerInitArgs)
 This function checks the validity of the parameters passed to DSPLIB_w_vec_init function. This function is called with the same parameters as the DSPLIB_w_vec_init, and this function must be called before the DSPLIB_w_vec_init is called. More...
 
DSPLIB_STATUS DSPLIB_w_vec_exec_checkParams (DSPLIB_kernelHandle handle, const void *restrict pIn1, const void *restrict pIn2, const void *restrict pM, const void *restrict pOut)
 This function checks the validity of the parameters passed to DSPLIB_w_vec_exec function. This function is called with the same parameters as the DSPLIB_w_vec_init, and this function must be called before the DSPLIB_w_vec_init is called. More...
 
DSPLIB_STATUS DSPLIB_w_vec_exec (DSPLIB_kernelHandle handle, void *restrict pIn1, void *restrict pIn2, void *restrict pM, void *restrict pOut)
 This function is the main kernel compute function. More...
 

Enumerations

enum  DSPLIB_w_vec_weightStyle { DSPLIB_SCALAR = 0 , DSPLIB_VECTOR = 1 }
 Enumeration for w_vec flag pertaining to scalar or vector input weight. More...
 

Enumeration Type Documentation

◆ DSPLIB_w_vec_weightStyle

Enumeration for w_vec flag pertaining to scalar or vector input weight.

Enumerator
DSPLIB_SCALAR 

Input Weight is a Scalar.

DSPLIB_VECTOR 

Input Weight is a Vector.

Definition at line 107 of file DSPLIB_w_vec.h.

Function Documentation

◆ DSPLIB_w_vec_getHandleSize()

int32_t DSPLIB_w_vec_getHandleSize ( DSPLIB_w_vec_InitArgs pKerInitArgs)

This is a query function to calculate the size of internal handle.

Parameters
[in]pKerInitArgs: Pointer to structure holding init parameters
Returns
Size of the buffer in bytes
Remarks
Application is expected to allocate buffer of the requested size and provide it as input to other functions requiring it.

Definition at line 25 of file DSPLIB_w_vec.cpp.

◆ DSPLIB_w_vec_init()

DSPLIB_STATUS DSPLIB_w_vec_init ( DSPLIB_kernelHandle  handle,
DSPLIB_bufParams1D_t bufParamsIn,
DSPLIB_bufParams1D_t bufParamsOut,
const DSPLIB_w_vec_InitArgs pKerInitArgs 
)

This function should be called before the DSPLIB_w_vec_exec function is called. This function takes care of any one-time operations such as setting up the configuration of required hardware resources such as the MMA accelerator and the streaming engine. The results of these operations are stored in the handle.

Parameters
[in]handle: Active handle to the kernel
[in]bufParamsIn: Pointer to the structure containing dimensional information of input buffers
[out]bufParamsOut: Pointer to the structure containing dimensional information of ouput buffer
[in]pKerInitArgs: Pointer to the structure holding init parameters
Returns
Status value indicating success or failure. Refer to DSPLIB_STATUS.
Remarks
Application is expected to provide a valid handle.

Definition at line 83 of file DSPLIB_w_vec.cpp.

◆ DSPLIB_w_vec_init_checkParams()

DSPLIB_STATUS DSPLIB_w_vec_init_checkParams ( DSPLIB_kernelHandle  handle,
const DSPLIB_bufParams1D_t bufParamsIn,
const DSPLIB_bufParams1D_t bufParamsOut,
const DSPLIB_w_vec_InitArgs pKerInitArgs 
)

This function checks the validity of the parameters passed to DSPLIB_w_vec_init function. This function is called with the same parameters as the DSPLIB_w_vec_init, and this function must be called before the DSPLIB_w_vec_init is called.

Parameters
[in]handle: Active handle to the kernel
[in]bufParamsIn: Pointer to the structure containing dimensional information of input buffers
[out]bufParamsOut: Pointer to the structure containing dimensional information of output buffer
[in]pKerInitArgs: Pointer to the structure holding init parameters
Returns
Status value indicating success or failure. Refer to DSPLIB_STATUS.
Remarks
None

Definition at line 32 of file DSPLIB_w_vec.cpp.

◆ DSPLIB_w_vec_exec_checkParams()

DSPLIB_STATUS DSPLIB_w_vec_exec_checkParams ( DSPLIB_kernelHandle  handle,
const void *restrict  pIn1,
const void *restrict  pIn2,
const void *restrict  pM,
const void *restrict  pOut 
)

This function checks the validity of the parameters passed to DSPLIB_w_vec_exec function. This function is called with the same parameters as the DSPLIB_w_vec_init, and this function must be called before the DSPLIB_w_vec_init is called.

Parameters
[in]handle: Active handle to the kernel
[in]pIn1: Pointer to the structure input buffer 1
[in]pIn2: Pointer to the structure input buffer 2
[in]pM: Pointer to structure weight factor
[out]pOut: Pointer to the output buffer
Returns
Status value indicating success or failure. Refer to DSPLIB_STATUS.
Remarks
None

Definition at line 62 of file DSPLIB_w_vec.cpp.

◆ DSPLIB_w_vec_exec()

DSPLIB_STATUS DSPLIB_w_vec_exec ( DSPLIB_kernelHandle  handle,
void *restrict  pIn1,
void *restrict  pIn2,
void *restrict  pM,
void *restrict  pOut 
)

This function is the main kernel compute function.

Please refer to details under DSPLIB_w_vec_exec

Parameters
[in]handle: Active handle to the kernel
[in]pIn1: Pointer to buffer holding the input data 1
[in]pIn2: Pointer to buffer holding the input data 2
[in]pM: Pointer to buffer holding weight factor
[out]pOut: Pointer to buffer holding the output data
Returns
Status value indicating success or failure. Refer to DSPLIB_STATUS.
Assumptions:
  • None
Performance Considerations:
For best performance,
  • the input and output data buffers are expected to be in L2 memory
  • the buffer pointers are assumed to be 64-byte aligned
Remarks
Before calling this function, application is expected to call DSPLIB_w_vec_init and DSPLIB_w_vec_exec_checkParams functions. This ensures resource configuration and error checks are done only once for several invocations of this function.

Definition at line 191 of file DSPLIB_w_vec.cpp.