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:
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
Variant | Allowed values |
---|---|
group_name | qhdsp, qhmath, qhcomplex, qhblas |
output_format | af,ah,ach,acf,f,h |
input_format | af,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.
Abbreviation | Description |
---|---|
a | array |
c | complex |
f | single-precision float |
hf | half-precision float |
h | fixed-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).
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>
In order to see an example of how to invoke the libraries, please see $HEXAGON_SDK_ROOT/examples/qhl.
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 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
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)
The following table provides performance numbers for the QHL library functions. These numbers may vary depending on the exact system configuration.