In order to utilize the Snapdragon Hexagon NPU, a Qualcomm's proprietary .dlc format is required as there is no native support for common formats such as PyTorch, TensorFlow, or ONNX. The Qualcomm Hexagon SDK provides converter tools that handle this translation, but the build environment has minor caveats which can be time consuming to solve, especially for Windows users.
This guide expands on Qualcomm's official documentation and the SNPE plugin tutorial for UE5, covering how to configure a Windows/Linux environment capable of building ML models for Snapdragon Android devices. Because the Qualcomm Hexagon SDK does not support cross-compilation for Android on Windows directly, WSL (Windows Subsystem for Linux) is used to run an Ubuntu environment.
Read Section 3 before beginning installation. It documents workarounds for common issues that will block progress if encountered mid-install.
WSL: install Ubuntu 22.04, dependency warnings otherwise
wsl --install -d Ubuntu-22.04
Before creating venv go to $HOME folder and create it there, otherwise Python dependencies fail to install later in the process
Qualcomm Package Manager - if direct link in the setup does not work, use the following link and download latest version
Before installing Qualcomm Package Manager run this command to install dependencies
sudo apt update && sudo apt install xdg-utils
Install Hexagon SDK and toolchain using command-line Package Manager. This method is recommended over the GUI method because it is more reliable on WSL and less time consuming to set up:
4.1. Use powershell session with WSL and venv enabled
qpm-cli --logout
qpm-cli --login
qpm-cli --license-refresh
qpm-cli --license-activate hexagonsdk6.x
qpm-cli --install hexagonSDK6.x
Take note of the installation path printed at the end (SUCCESS: Installed HexagonSDK6.x.Core at [path])
/local/mnt/workspace/Qualcomm/Hexagon_SDK/6.5.0.1
Also install Hexagon toolchain
qpm-cli --install hexagon8.4
→ path can be /root/Qualcomm/HEXAGON_Tools/8.4.12
Source for qpm-cli instructions: https://docs.qualcomm.com/nav/home/setup_linux.html?product=1601111740010412
Follow steps in Readme setup file
open /local/mnt/workspace/Qualcomm/Hexagon_SDK/6.5.0.1/docs/tools/Setup.html
Install dependency for onnx converter
pip3 install onnxsim
Use built-in converter to conver onnx to dlc format
./x86_64-linux-clang/snpe-onnx-to-dlc --input_dim 'input' 1,3,720,1280 --input_network path_to_input_file.onnx --output_path path_to_output_file.dlc
Note: The --input_dim name and shape must match exactly what was specified when the PyTorch model was exported. Mismatches here are a common source of converter errors.
