Main Content

Conditions for Code Replacement of Math Operators with HVX

Each math operators that can be used with the Support Package for Qualcomm Hexagon Processors requires specific conditions to allow code replacement by using the Qualcomm Hexagon Library (QHL). You use this code replacement when generating C/C++ code from a model or from MATLAB® code.

If you do not meet the specific requirements, then the generated C/C++ code runs on the Qualcomm Hexagon Processors. However, this generated code does not use library support.

The library supports these math operators only when you set specific properties, as indicated in this table.

OperatorsInput RequirementsParameter RequirementsEquivalent Functions
Addition (+)
  • Input can be vector or matrix

  • Real and Complex Values

  • Length should be >=1024 and a multiple of 32

  • Vector and matrix real inputs

    • qhblas_hvx_vector_add_af

  • Vector and matrix complex inputs

    • mw_qhblas_hvx_vector_add_acf

Subtraction (-)
  • Input can be vector or matrix

  • Real and Complex Values

  • Length should be >=1024 and a multiple of 32

  • Vector and matrix real inputs

    • qhblas_vector_sub_af

  • Vector and matrix complex inputs

    • mw_qhblas_vector_sub_acf

Element-wise matrix multiplication
  • Input can be vector or matrix

  • Real Values

  • Length should be >=1024 and a multiple of 32

  • Vector and matrix real inputs

    • qhblas_hvx_vector_hadamard_af

Multiplication - scaling
  • Input can be real or complex, and vector or matrix

  • Scale factor has to be a real scalar

 
  • Vector and matrix real inputs

    • qhblas_hvx_vector_scaling_af

  • Vector and matrix complex inputs

    • mw_qhblas_hvx_vector_scaling_acf

Matrix Multiplication
  • Real Values

  • Input can be a vector or matrix

  • Matrix1 dimensions = m*n

  • Matrix2 dimensions = n*k

  • if RowMajor & k = 1 or ColMajor & m = 1

  • (2*n) - 1 >= 127 & m*k >= 4

    else

  • (2*n) - 1>= 15 & m*k >= 64

  • For Vector and Matrix real inputs

    • mw_qhblas_hvx_matrix_matrix_mpy_af

See Also

| |

Topics