char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

kurquharsnapdragon: python SDK setup (Windows) (#27903)d7bd3bfca

char/aliceai-t5-moe
6.8 KiB188 linesraw

Snapdragon-based Windows devices

Tool Dependencies

Native Windows 11 arm64 builds have the following tool dependencies:

  • MS Visual Studio 2026 (Community Edition or Pro)
    • MSVC arm64 standard and runtime libraries
    • UCRT and Driver Kit
  • LLVM core libraries and Clang compiler (winget)
  • CMake, Git, Python (winget)
  • Hexagon SDK Community Edition 6.6 or later (see below)
  • OpenCL SDK 2.3 or later (see below)

Note: The rest of the Windows build process assumes that you're running natively in Powershell.

Overview

The document covers procedures for installing the latest GPU and NPU drivers, and OpenCL and Hexagon SDKs.

In order to use Hexagon NPU on Snapdragon Windows devices the underlying HTP Ops libraries (e.g libggml-htp-v73.so) must be included in the .cat file digitally signed with a trusted certificate.

This document covers details on how to generate personal certificate files (.pfx) and how to configure the system to allow for test signatures (aka test-signing).

Install Windows SDKs

The recommended method is setup-sdk.py:

> python scripts\snapdragon\setup-sdk.py --list-sdk-releases
> python scripts\snapdragon\setup-sdk.py --hexagon --opencl

It installs the selected SDKs under C:\Qualcomm and sets their corresponding environment variables for the current user. Start a new terminal after it completes; native Windows builds check all SDK paths before CMake runs.

Select the SDKs to install with --hexagon and --opencl; use both to prepare a dual-backend build. To select a different available version, pass it to the SDK option, for example --hexagon 6.4.0.2. SDK versions install side by side, so you can switch versions without deleting an existing installation. Use --force to reinstall the selected SDKs. Use a new CMake build directory after each switch because CMake caches the SDK paths.

Either use the trimmed down version (optimized for CI) from

https://github.com/snapdragon-toolchain/opencl-sdk/releases/download/v2.3.2/adreno-opencl-sdk-v2.3.2-arm64-wos.tar.xz

Or download the complete official version from

https://softwarecenter.qualcomm.com/catalog/item/Adreno_OpenCL_SDK?version=2.3.2

Unzip/untar the archive into

c:\Qualcomm\OpenCL_SDK\2.3.2

Install the latest Hexagon SDK Community Edition

Either use the trimmed down version (optimized for CI) from

https://github.com/snapdragon-toolchain/hexagon-sdk/releases/download/v6.6.0.0/hexagon-sdk-v6.6.0.0-arm64-wos.tar.xz

Or download the complete official version from

https://softwarecenter.qualcomm.com/catalog/item/Hexagon_SDK?version=6.6.0.0

Unzip/untar the archive into

c:\Qualcomm\Hexagon_SDK\6.6.0.0

Install the latest Adreno GPU driver

Download the driver from

https://softwarecenter.qualcomm.com/catalog/item/Windows_Graphics_Driver

After the automated installation and reboot please make sure that the GPU device shows up in the Device Manager (under 'Display Adapters`)

Install the latest Qualcomm NPU driver

Download the driver from

https://softwarecenter.qualcomm.com/catalog/item/Qualcomm_HND

After the automated installation and reboot please make sure that the Hexagon NPU device shows up in the Device Manager (under Neural Processors).

If the device is not available you can try installing all components (qcnspmcdm8380, qcnspmcdm8380_ext) manually. The components are extracted into

c:\QCDrivers\qcnspmcdm...

Enable NPU driver test signatures

Please note that the following steps are required only for the Hexagon NPU. Adreno GPU backend does not require test signatures.

Enable testsigning

Use bcdedit to enable test-signing

> bcdedit /set TESTSIGNING ON

(Secure Boot may need to be disabled for this to work)

Make sure test-signing is enabled after reboot

> bcdedit /enum
...
testsigning             Yes
...

For additional details see Microsoft guide at

https://learn.microsoft.com/en-us/windows-hardware/drivers/install/the-testsigning-boot-configuration-option

Create personal certificate

The tools required for this procedure are available as part of Windows SDK and Windows Driver Kit which should be installed as part of the MS Visual Studio. They are typically located at

c:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0

(replace 10.0.26100.0 with correct version).

To create personal self-signed certificate run the following commands (either from cmd or power-shell):

> cd c:\Users\MyUser
> mkdir Certs
> cd Certs
> makecert -r -pe -ss PrivateCertStore -n CN=GGML.HTP.v1 -eku 1.3.6.1.5.5.7.3.3 -sv ggml-htp-v1.pvk ggml-htp-v1.cer
> pvk2pfx.exe -pvk ggml-htp-v1.pvk -spc ggml-htp-v1.cer -pfx ggml-htp-v1.pfx

(replace MyUser with your username).

Add this certificate to Trusted Root Certification Authorities and Trusted Publishers stores. This can be done using certlm Certificate Manager tool. Right click on the certificate store, select All Tasks -> Import and follow the prompts to import the certificate from the PFX file you created above.

For additional details see Microsoft guide at

https://learn.microsoft.com/en-us/windows-hardware/drivers/install/introduction-to-test-signing

Make sure to save the PFX file, you will need it for the build procedures. Please note that the same certificate can be used for signing any number of builds.

Build Hexagon backend with signed HTP ops libraries

The overall Hexagon backend build procedure for Windows on Snapdragon is the same as for other platforms. However, additional settings are required for generating and signing HTP Ops libraries.

> $env:OPENCL_SDK_ROOT="C:\Qualcomm\OpenCL_SDK\2.3.2"
> $env:HEXAGON_SDK_ROOT="C:\Qualcomm\Hexagon_SDK\6.6.0.0"
> $env:HEXAGON_TOOLS_ROOT="C:\Qualcomm\Hexagon_SDK\6.6.0.0\tools\HEXAGON_Tools\19.0.07"
> $env:HEXAGON_HTP_CERT="c:\Users\MyUsers\Certs\ggml-htp-v1.pfx"
> $env:WINDOWS_SDK_BIN="C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0"

> cmake --preset arm64-windows-snapdragon-release -B build-wos
...
> cmake --install build-wos --prefix pkg-wos

Once the build is complete HTP ops libraries will be installed like this

> dir pkg-wos/lib
...
-a----         1/22/2026   6:01 PM         187656 libggml-htp-v73.so
-a----         1/22/2026   6:01 PM         191752 libggml-htp-v75.so
-a----         1/22/2026   6:01 PM         187656 libggml-htp-v79.so
-a----         1/22/2026   6:01 PM         187656 libggml-htp-v81.so
-a----         1/22/2026   6:01 PM           4139 libggml-htp.cat

The .cat file, the signature and proper certificate installation can be verified with

> signtool.exe verify /v /pa .\pkg-wos\lib\libggml-htp.cat
Verifying: .\pkg-wos\lib\libggml-htp.cat

Signature Index: 0 (Primary Signature)
Hash of file (sha256): 9820C664DA59D5EAE31DBB664127FCDAEF59CDC31502496BC567544EC2F401CF

Signing Certificate Chain:
        Issued to: GGML.HTP.v1
...
Successfully verified: .\pkg-wos\lib\libggml-htp.cat
...
1# Snapdragon-based Windows devices
2
3## Tool Dependencies
4
5Native Windows 11 arm64 builds have the following tool dependencies:
6- MS Visual Studio 2026 (Community Edition or Pro)
7  - MSVC arm64 standard and runtime libraries
8  - UCRT and Driver Kit
9- LLVM core libraries and Clang compiler (winget)
10- CMake, Git, Python (winget)
11- Hexagon SDK Community Edition 6.6 or later (see below)
12- OpenCL SDK 2.3 or later (see below)
13
14Note: The rest of the **Windows** build process assumes that you're running natively in Powershell.
15
16## Overview
17
18The document covers procedures for installing the latest GPU and NPU drivers, and OpenCL and Hexagon SDKs.
19
20
21In order to use Hexagon NPU on Snapdragon Windows devices the underlying HTP Ops libraries (e.g libggml-htp-v73.so)
22must be included in the .cat file digitally signed with a trusted certificate.
23
24This document covers details on how to generate personal certificate files (.pfx) and how to configure the system
25to allow for test signatures (aka test-signing).
26
27## Install Windows SDKs
28
29The recommended method is `setup-sdk.py`:
30
31```
32> python scripts\snapdragon\setup-sdk.py --list-sdk-releases
33> python scripts\snapdragon\setup-sdk.py --hexagon --opencl
34```
35
36It installs the selected SDKs under `C:\Qualcomm` and sets their corresponding environment variables for the current user. Start a new terminal after it completes; native Windows builds check all SDK paths before CMake runs.
37
38Select the SDKs to install with `--hexagon` and `--opencl`; use both to prepare a dual-backend build. To select a different available version, pass it to the SDK option, for example `--hexagon 6.4.0.2`. SDK versions install side by side, so you can switch versions without deleting an existing installation. Use `--force` to reinstall the selected SDKs. Use a new CMake build directory after each switch because CMake caches the SDK paths.
39
40Either use the trimmed down version (optimized for CI) from
41
42    https://github.com/snapdragon-toolchain/opencl-sdk/releases/download/v2.3.2/adreno-opencl-sdk-v2.3.2-arm64-wos.tar.xz
43
44Or download the complete official version from
45
46    https://softwarecenter.qualcomm.com/catalog/item/Adreno_OpenCL_SDK?version=2.3.2
47
48Unzip/untar the archive into
49```
50c:\Qualcomm\OpenCL_SDK\2.3.2
51```
52
53## Install the latest Hexagon SDK Community Edition
54
55Either use the trimmed down version (optimized for CI) from
56
57    https://github.com/snapdragon-toolchain/hexagon-sdk/releases/download/v6.6.0.0/hexagon-sdk-v6.6.0.0-arm64-wos.tar.xz
58
59Or download the complete official version from
60
61    https://softwarecenter.qualcomm.com/catalog/item/Hexagon_SDK?version=6.6.0.0
62
63Unzip/untar the archive into
64```
65c:\Qualcomm\Hexagon_SDK\6.6.0.0
66```
67
68## Install the latest Adreno GPU driver
69
70Download the driver from
71
72    https://softwarecenter.qualcomm.com/catalog/item/Windows_Graphics_Driver
73
74After the automated installation and reboot please make sure that the GPU device shows up in the `Device Manager` (under 'Display Adapters`)
75
76## Install the latest Qualcomm NPU driver
77
78Download the driver from
79
80    https://softwarecenter.qualcomm.com/catalog/item/Qualcomm_HND
81
82After the automated installation and reboot please make sure that the Hexagon NPU device shows up in the `Device Manager`
83(under `Neural Processors`).
84
85If the device is not available you can try installing all components (`qcnspmcdm8380`, `qcnspmcdm8380_ext`) manually.
86The components are extracted into
87```
88c:\QCDrivers\qcnspmcdm...
89```
90
91## Enable NPU driver test signatures
92
93Please note that the following steps are required only for the Hexagon NPU.
94Adreno GPU backend does not require test signatures.
95
96### Enable testsigning
97
98Use `bcdedit` to enable test-signing
99```
100> bcdedit /set TESTSIGNING ON
101```
102(Secure Boot may need to be disabled for this to work)
103
104Make sure test-signing is enabled after reboot
105```
106> bcdedit /enum
107...
108testsigning             Yes
109...
110```
111For additional details see Microsoft guide at
112
113   https://learn.microsoft.com/en-us/windows-hardware/drivers/install/the-testsigning-boot-configuration-option
114
115### Create personal certificate
116
117The tools required for this procedure are available as part of Windows SDK and Windows Driver Kit which should be
118installed as part of the MS Visual Studio.
119They are typically located at
120```
121c:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0
122```
123(replace 10.0.26100.0 with correct version).
124
125To create personal self-signed certificate run the following commands (either from cmd or power-shell):
126```
127> cd c:\Users\MyUser
128> mkdir Certs
129> cd Certs
130> makecert -r -pe -ss PrivateCertStore -n CN=GGML.HTP.v1 -eku 1.3.6.1.5.5.7.3.3 -sv ggml-htp-v1.pvk ggml-htp-v1.cer
131> pvk2pfx.exe -pvk ggml-htp-v1.pvk -spc ggml-htp-v1.cer -pfx ggml-htp-v1.pfx
132```
133(replace `MyUser` with your username).
134
135Add this certificate to `Trusted Root Certification Authorities` and `Trusted Publishers` stores.
136This can be done using `certlm` Certificate Manager tool.
137Right click on the certificate store, select `All Tasks -> Import` and follow the prompts to import the certificate from the
138PFX file you created above.
139
140For additional details see Microsoft guide at
141
142    https://learn.microsoft.com/en-us/windows-hardware/drivers/install/introduction-to-test-signing
143
144Make sure to save the PFX file, you will need it for the build procedures.
145Please note that the same certificate can be used for signing any number of builds.
146
147## Build Hexagon backend with signed HTP ops libraries
148
149The overall Hexagon backend build procedure for Windows on Snapdragon is the same as for other platforms.
150However, additional settings are required for generating and signing HTP Ops libraries.
151```
152> $env:OPENCL_SDK_ROOT="C:\Qualcomm\OpenCL_SDK\2.3.2"
153> $env:HEXAGON_SDK_ROOT="C:\Qualcomm\Hexagon_SDK\6.6.0.0"
154> $env:HEXAGON_TOOLS_ROOT="C:\Qualcomm\Hexagon_SDK\6.6.0.0\tools\HEXAGON_Tools\19.0.07"
155> $env:HEXAGON_HTP_CERT="c:\Users\MyUsers\Certs\ggml-htp-v1.pfx"
156> $env:WINDOWS_SDK_BIN="C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0"
157
158> cmake --preset arm64-windows-snapdragon-release -B build-wos
159...
160> cmake --install build-wos --prefix pkg-wos
161```
162
163Once the build is complete HTP ops libraries will be installed like this
164```
165> dir pkg-wos/lib
166...
167-a----         1/22/2026   6:01 PM         187656 libggml-htp-v73.so
168-a----         1/22/2026   6:01 PM         191752 libggml-htp-v75.so
169-a----         1/22/2026   6:01 PM         187656 libggml-htp-v79.so
170-a----         1/22/2026   6:01 PM         187656 libggml-htp-v81.so
171-a----         1/22/2026   6:01 PM           4139 libggml-htp.cat
172```
173
174The .cat file, the signature and proper certificate installation can be verified with
175
176```
177> signtool.exe verify /v /pa .\pkg-wos\lib\libggml-htp.cat
178Verifying: .\pkg-wos\lib\libggml-htp.cat
179
180Signature Index: 0 (Primary Signature)
181Hash of file (sha256): 9820C664DA59D5EAE31DBB664127FCDAEF59CDC31502496BC567544EC2F401CF
182
183Signing Certificate Chain:
184        Issued to: GGML.HTP.v1
185...
186Successfully verified: .\pkg-wos\lib\libggml-htp.cat
187...
188```