QHL
Qualcomm Hexagon Libraries
Qualcomm Hexagon Libraries

QHL is a set of libraries for the Qualcomm Hexagon DSPs with a v66 or above architectures instruction set. These libraries provide a set of functions performing various mathematical computations using scalar instructions.

Since performance, alongside with accuracy, is crucial to each mathematical operation, most of the QHL implementations are written in assembly language or in C with intrinsics.

The QHL libraries are organized in the following groups:

  • Qualcomm Hexagon Math (QHMATH)
    • Common mathematical computations on real numbers
  • Qualcomm Hexagon Complex (QHCOMPLEX)
    • Common mathematical computations on complex numbers
  • Qualcomm Hexagon Basic Linear Algebra Subprograms (QHBLAS)
    • Basic linear algebra operations
  • Qualcomm Hexagon Digital Signal Processing (QHDSP)
    • Digital signal processing operations

Naming convention

Naming convention used for QHL library functions is as below:

<group_name>[_<output_format>]_<function description>_<input_format>
<output_format> is optional and will be used only if input and output formats differ in a function.
<function description> describes the function in brief
VariantAllowed values
group_nameqhdsp, qhmath, qhcomplex, qhblas
output_formataf,ah,ach,acf,f,h
input_formataf,ah,ach,acf,f,h

The desciption for the short forms used in input and output formats is expanded in the table below: When a function takes multiple input arguments, the input format only refers to the format of the main argument.

AbbreviationDescription
aarray
ccomplex
fsingle-precision float
hfhalf-precision float
hfixed-point or integer type, usually but not always 16-bit

Example: qhdsp_c1dfft_ach: This function falls under the sub-group qhdsp. It takes an array of complex 16-bit integer inputs(ach) and computes Complex 1-D FFT(c1dfft) outputs stored in an array of complex 16-bit integers(ach).

Build instructions

In order to build all the libraries, run the following command:

cd $HEXAGON_SDK_ROOT/libs/qhl
build_cmake hexagon DSP_ARCH=<v66/v68>

In order to remove all binaries, run the following command:

build_cmake hexagon_clean DSP_ARCH=<v66/v68>

Running an example

In order to see an example of how to invoke the libraries, please see $HEXAGON_SDK_ROOT/examples/qhl.

Running unit tests

cd $HEXAGON_SDK_ROOT/libs/qhl/tests
The QHL library comes with a set of unit tests that measures the accuracy and performance of each function. run_tests_dsp.py script is provided for easy build and run of the libraries both on target as well as simulator.
Below section describes the usage of the run_tests_dsp.py script.

##To run the accuracy and benchmark tests for all the libraries present as part of QHL. invoke the python script as:
python run_tests_dsp.py <DSP_ARCH> simulator=YES/NO clean_build=YES/NO
The script can also be invoked as:
python run_tests_dsp.py <DSP_ARCH> simulator=YES/NO (By default performs a clean-build of existing libs)
python run_tests_dsp.py <DSP_ARCH>                  (By default performs a clean-build of existing libs and runs on target)

##To run the accuracy and benchmark tests for a specific library of QHL, invoke the python script as:
python run_tests_dsp.py <DSP_ARCH> simulator=YES/NO clean_build=YES/NO LIB=lib_name
##lib_name has the following valid values: qhmath, qhblas, qhcomplex, qhdsp/fft, qhdsp/filters, qhdsp/decimation, qhdsp/interpolation

##To run any specific test of the user's choice, the script is invoked as:
python run_tests_dsp.py <DSP_ARCH> simulator=YES/NO clean_build=YES/NO name_of_test_to_be_executed

Note: Any other way of invoking the .py script apart from the above four, is considered invalid.

Note: A target device must be connected to run the tests on target

Test Results

The results of any run are stored in ./tests/test_results/report-tests-dsp.txt (For runs on target) /report-tests-simulator.txt (For runs on simulator)

Performance Numbers

The following table provides performance numbers for the QHL library functions. These numbers may vary depending on the exact system configuration.