Main Content

Conditions for Code Replacement of Math Operators with HVX

Each math operator that can be used with the Embedded Coder® Support Package for Qualcomm® Hexagon® Processors requires specific conditions to allow code replacement by using the Hexagon Vector Extension (HVX). 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 (+)
  • 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 (-)
  • 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
  • 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
  • Vector or matrix

  • Real and Complex values

  • 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
  • Vector or matrix

  • Real values

  • 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

  • Vector and Matrix real inputs

    • mw_qhblas_hvx_matrix_matrix_mpy_af

See Also

| |

Topics