InPlay API
Hardware Accelerator Profile

HAL HWACC. More...

Enumerations

enum  hwacc_op_t {
  HWACC_OP_COPY = 0, HWACC_OP_ADD = 1, HWACC_OP_SUB = 2, HWACC_OP_MUL = 3,
  HWACC_OP_INV = 4, HWACC_OP_EQU = 5, HWACC_OP_CLEAR = 6, HWACC_OP_SCALE = 7
}
 hwacc operator More...
 
enum  hwacc_status_t {
  HWACC_ERR_OK = 0, HWACC_ERR_CONFIG_ERROR = 1, HWACC_ERR_INST_OVERFLOW = 2, HWACC_ERR_ALREADY_INIT = 3,
  HWACC_ERR_NOT_INIT = 4, HWACC_ERR_BAD_STATE = 5, HWACC_ERR_DIMENSION_MISMATCH = 6, HWACC_ERR_BAD_INPUT = 7
}
 HWACC function status return. More...
 

Functions

int hal_hwacc_open (void)
 Initialize hardware accelerator driver. More...
 
int hal_hwacc_close (void)
 Clean-up hardware accelerator driver. More...
 
int hal_hwacc_write_matrix (hwacc_matrix_desc_t *matrix, const float *head)
 Write matrix into hardware accelerator memory blocks. More...
 
int hal_hwacc_read_matrix (hwacc_matrix_desc_t *matrix, float *head)
 Read matrix data from hardware accelerator memory blocks. More...
 
int hal_hwacc_insert_inst (hwacc_matrix_desc_t *matrix_C, int C_symm, hwacc_matrix_desc_t *matrix_A, int A_trans, hwacc_matrix_desc_t *matrix_B, int B_trans, hwacc_op_t op)
 Insert instruction into queue. More...
 
int hal_hwacc_execute (void)
 Execute HW Accelerator instructions in queue. More...
 

Detailed Description

HAL HWACC.

Enumeration Type Documentation

◆ hwacc_op_t

enum hwacc_op_t

hwacc operator

Enumerator
HWACC_OP_COPY 

Matrix copy: (C = B) Copy B from one memory location to another memory location (same or different memory). A is ignored.

HWACC_OP_ADD 

Matrix addition: (C = A + B) Addition of A/B (each from a different memory), result saved to another memory. A/B/C must have same size.

HWACC_OP_SUB 

Matrix subtraction: (C = A - B) Subtraction of B from A (each from a different memory), result saved to another memory. A/B/C must have same size.

HWACC_OP_MUL 

Matrix multiplication: (C = AB) Multiplication of A/B (each from a different memory), result saved to another memory. Dimensions must match.

HWACC_OP_INV 

Matrix inversion: (C = A^-1) Inversion of A, result saved to another memory, at return: C = A^-1, A = identity matrix. B is ignored.

HWACC_OP_EQU 

Matrix solve linear equation: (C = A^-1 * B) Solving linear equation (A is a square matrix and B is a vector), at return: C = A^-1, B = solution to linear equation, A = Identity matrix.

HWACC_OP_CLEAR 

Matrix clear: (C = A * 0) C is zero matrix matching size of A. (Clear memory bank and offset of C with size of A). B is ignored.

HWACC_OP_SCALE 

Matrix scale: (C = A * B) Scale A by B (b is a scalar 1x1 matrix).

◆ hwacc_status_t

HWACC function status return.

Enumerator
HWACC_ERR_OK 

No error. Good status.

HWACC_ERR_CONFIG_ERROR 

Hardware configuration error detected.

HWACC_ERR_INST_OVERFLOW 

Instruction overflow detected. Too many instructions inserted.

HWACC_ERR_ALREADY_INIT 

HWACC driver already initialized with hwacc_open().

HWACC_ERR_NOT_INIT 

HWACC driver not yet initialized with hwacc_open().

HWACC_ERR_BAD_STATE 

HWACC unable to initialize.

HWACC_ERR_DIMENSION_MISMATCH 

Matrix dimension mismatch within instruction operation.

HWACC_ERR_BAD_INPUT 

HWACC input issue.

Function Documentation

◆ hal_hwacc_close()

int hal_hwacc_close ( void  )

Clean-up hardware accelerator driver.

Returns
HWACC_ERR_OK if successful, error otherwise.
See also
enum hwacc_status_t.

◆ hal_hwacc_execute()

int hal_hwacc_execute ( void  )

Execute HW Accelerator instructions in queue.

Returns
HWACC_ERR_OK if successful, error otherwise.
See also
enum hwacc_status_t.

◆ hal_hwacc_insert_inst()

int hal_hwacc_insert_inst ( hwacc_matrix_desc_t *  matrix_C,
int  C_symm,
hwacc_matrix_desc_t *  matrix_A,
int  A_trans,
hwacc_matrix_desc_t *  matrix_B,
int  B_trans,
hwacc_op_t  op 
)

Insert instruction into queue.

Parameters
[in]matrix_CPointer to matrix descriptor object of output matrix C.
See also
enum hwacc_matrix_desc_t.
Parameters
[in]C_symm1 if result matrix is symmetric (using this property saves HW operations).
[in]matrix_APointer to matrix descriptor object of input matrix A.
See also
enum hwacc_matrix_desc_t.
Parameters
[in]A_trans1 if input matrix A needs to be transposed for the operation.
[in]matrix_BPointer to matrix descriptor object of input matrix B.
See also
enum hwacc_matrix_desc_t.
Parameters
[in]B_trans1 if input matrix B needs to be transposed for the operation.
[in]opInstruction operation.
See also
enum hwacc_op_t.
Returns
HWACC_ERR_OK if successful, error otherwise.
See also
enum hwacc_status_t.

◆ hal_hwacc_open()

int hal_hwacc_open ( void  )

Initialize hardware accelerator driver.

Returns
HWACC_ERR_OK if successful, error otherwise.
See also
enum hwacc_status_t.

◆ hal_hwacc_read_matrix()

int hal_hwacc_read_matrix ( hwacc_matrix_desc_t *  matrix,
float *  head 
)

Read matrix data from hardware accelerator memory blocks.

Parameters
[in]matrixPointer to matrix descriptor object of matrix to be read.
See also
enum hwacc_matrix_desc_t.
Parameters
[in]headPointer to data of new matrix in row-major format. Data will be size 4-bytes per matrix index.
Returns
HWACC_ERR_OK if successful, error otherwise.
See also
enum hwacc_status_t.

◆ hal_hwacc_write_matrix()

int hal_hwacc_write_matrix ( hwacc_matrix_desc_t *  matrix,
const float *  head 
)

Write matrix into hardware accelerator memory blocks.

Parameters
[in]matrixPointer to matrix descriptor object of new matrix to be written.
See also
enum hwacc_matrix_desc_t.
Parameters
[in]headPointer to data of new matrix in row-major format. Data should be size 4-bytes per matrix index.
Returns
HWACC_ERR_OK if successful, error otherwise.
See also
enum hwacc_status_t.