DSP Runtime Environment¶
The DSP runtime is a dynamically loaded module, needed for using the AIP and DSP runtimes. This module is found in :
$SNPE_ROOT/lib/hexagon-v65/unsigned/libSnpeDspV65Skel.so (for v65 targets)
$SNPE_ROOT/lib/hexagon-v66/unsigned/libSnpeDspV66Skel.so (for v66 targets)
$SNPE_ROOT/lib/hexagon-v68/unsigned/libSnpeHtpV68Skel.so (for v68 targets)
$SNPE_ROOT/lib/hexagon-v69/unsigned/libSnpeHtpV69Skel.so (for v69 targets)
$SNPE_ROOT/lib/hexagon-v73/unsigned/libSnpeHtpV73Skel.so (for v73 targets)
This module runs on the ADSP or the CDSP or the HTP, depending on the target. Please refer to the Snapdragon Device Support Matrix table in the Overview section to determine Qualcomm® Neural Processing SDK support of DSP on various Snapdragon devices. Qualcomm® Neural Processing SDK automatically detects the appropriate DSP.
The DSP loader requires the environment variable ADSP_LIBRARY_PATH to be set to the directory where the shared libraries are stored. This environment variable is used for both ADSP and CDSP.
For command line executables
A typical setting of ADSP_LIBRARY_PATH looks like:
export ADSP_LIBRARY_PATH="<path_to_dsp_skel>;/system/lib/rfsa/adsp;/system/vendor/lib/rfsa/adsp;/dsp"
Where <path_to_dsp_skel> is the path where $SNPE_ROOT/lib/hexagon-v65/unsigned/libSnpeDspV65Skel.so and/or other skel files have been pushed. Do not include the file name of the skel in the path.
Example: Assuming the appropriate DSP skel has been pushed to /data/local/tmp/snpeexample/dsp/lib, then the following command for setting ADSP_LIBRARY_PATH would be used.
export ADSP_LIBRARY_PATH="/data/local/tmp/snpeexample/dsp/lib;/system/lib/rfsa/adsp;/system/vendor/lib/rfsa/adsp;/dsp"
Key points to note when setting the ADSP_LIBRARY_PATH:
Unlike LD_LIBRARY_PATH, the path must be contained within quotations. Additionally, unlike LD_LIBRARY_PATH, the directory separator is a semi-colon, not a colon.
For Android and most embeded linux systems, the three paths below MUST be part of ADSP_LIBRARY_PATH. If any of these are missing the DSP runtime may fail.
/system/lib/rfsa/adsp
/system/vendor/lib/rfsa/adsp
/dsp
For embeded linux automotive system, the following DSP paths are required.
/usr/lib/rfsa/adsp
/dsp
For Android APKs
ADSP_LIBRARY_PATH must be set for Android APKs as well, and it cannot be done using an “export” command. It must be done within code running in the APK.
The Qualcomm® Neural Processing SDK Android Java APIs automatically sets the ADSP_LIBRARY_PATH. The supplied Qualcomm® Neural Processing SDK Java AAR library automatically sets up the DSP environment for your Android application.
Android applications that do not use the Qualcomm® Neural Processing SDK Java AAR must set the ADSP_LIBRARY_PATH explicitly in native code. An example is provided below.
bool SetAdspLibraryPath(std::string nativeLibPath) {
std::stringstream path;
path << nativeLibPath << ";/system/lib/rfsa/adsp;/system/vendor/lib/rfsa/adsp;/dsp";
return setenv("ADSP_LIBRARY_PATH", path.str().c_str(), 1 /*override*/) == 0;
}
Assuming that the DSP loadable module is placed in the same location as libSNPE.so in the Android application, the “nativeLibPath” input passed to the above method should be the string returned by the the following Android API:
application.getApplicationInfo().nativeLibraryDir