-
Notifications
You must be signed in to change notification settings - Fork 5
How to Build
This guide describes the steps to build a Android/Windows release of the QNN backend.
- Install latest docker engine follow the official steps: Install Docker Engine
- Clone my llama-cpp-qnn-builder
- In builder folder, run
docker\docker_compose_compile_and_share.sh - Console output will look like this one, and exectualbe is located at
build_qnn_arm64-v8a
-
Download Qualcomm AI Engine Direct SDK, from here, and then extract it into a folder
-
Install the latest Visual Studio, make sure
clangtoolchain and 'cmake' are installed

-
Launch vs2022, tap
Continue without code, and then inFilemenu, selectOpen->CMake, in file open dialog, navigate to llama.cpp root directory, selectCMakeLists.txt -
Edit
llama.cpp\CMakePresets.json, add following line to configarm64-windows-llvm{ "name": "arm64-windows-llvm", "hidden": true, "architecture": { "value": "arm64", "strategy": "external" }, "toolset": { "value": "host=x64", "strategy": "external" }, "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-windows-llvm.cmake" + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/arm64-windows-llvm.cmake", + "GGML_QNN": "ON", + "GGML_QNN_SDK_PATH": "<path to your Qualcomm AI Engine Direct SDK, like x:/ml/qnn_sdk/qairt/2.31.0.250130/>", + "BUILD_SHARED_LIBS": "OFF" } }, -
Select config
arm64-windows-llvm-debug
-
In
Buildmenu, tapBuild All, output file are located atbuild-arm64-windows-llvm-debug\bin\ -
Please copy those files from sdk lib directory (at
qairt\2.31.0.250130\lib\aarch64-windows-msvc\) to the output directory before run:
QnnSystem.dll
QnnCpu.dll
QnnGpu.dll
QnnHtp.dll
QnnHtp*.dll