Skip to content

Commit 0366f92

Browse files
committed
feat: Add Snapdragon hardware acceleration support for Windows ARM64
- Add detect-snapdragon.ps1 script to identify Qualcomm devices and QNN runtime - Integrate Snapdragon detection with installer staging pipeline - Bundle detection helper in installer for post-install verification - Add comprehensive Snapdragon section to README with setup/verification steps - Support automatic CPU fallback on unsupported devices This enables Windows ARM64 users on Snapdragon processors to leverage: * Neural network inference via Snapdragon NPU * DSP acceleration for signal preprocessing * Model compilation optimizations * Graceful fallback to CPU mode if QNN unavailable Supported devices: Windows 11 ARM64 on Snapdragon, RB3 Gen 2, IQ-9
1 parent 0d40192 commit 0366f92

4 files changed

Lines changed: 176 additions & 0 deletions

File tree

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,59 @@ You can pass in options to the CLI. Here are the key ones:
9191
9292
edge-impulse-linux and edge-impulse-linux-runner can be run as a service via a custom AWS IoT Greengrass component(s). When provided with the "--greengrass" option, both services will utilize the AWS IoT Greengrass authentication context (ONLY present when launched as a AWS IoT Greengrass custom component) as well as AWS Secrets Manager to extract the api key to be used to authenticate to a new project. If the authentication context is abscent and/or incorrect, both services will simply ignore the "--greengrass" option that was provided and continue with any of the other provided options normally.
9393
94+
### Snapdragon Hardware Acceleration (Windows ARM64)
95+
96+
The Windows installer for ARM64 devices on Qualcomm Snapdragon platforms includes automatic detection and support for **QNN (Qualcomm Neural Network)** hardware acceleration.
97+
98+
#### What this enables
99+
100+
* Neural network inference via Snapdragon NPU (Neural Processing Unit)
101+
* Optimized DSP (Digital Signal Processing) for audio/signal preprocessing
102+
* Accelerated model compilation to ONNX and TensorFlow Lite formats
103+
* Automatic fallback to CPU mode if acceleration libraries unavailable
104+
105+
#### Supported devices
106+
107+
* Windows 11 ARM64 on Snapdragon processors (X SoC, Gen 3, etc.)
108+
* Qualcomm reference boards (RB3 Gen 2, IQ-9)
109+
110+
#### Checking for Snapdragon acceleration
111+
112+
After installation, run the included detection script to verify acceleration support:
113+
114+
```powershell
115+
# From Command Prompt or PowerShell
116+
%PROGRAMFILES%\EdgeImpulse Linux CLI\bin\detect-snapdragon.ps1
117+
```
118+
119+
Expected output for Snapdragon device:
120+
121+
```
122+
✓ Snapdragon device detected: <processor-name>
123+
✓ QNN runtime available - hardware acceleration enabled
124+
```
125+
126+
If QNN runtime is not detected:
127+
128+
```
129+
ℹ Qualcomm Snapdragon detected: <processor-name>
130+
ℹ QNN runtime not detected - install Qualcomm AI Hub or Snapdragon SDK for acceleration
131+
```
132+
133+
#### Installing QNN runtime
134+
135+
To enable QNN hardware acceleration, install one of:
136+
137+
1. **Qualcomm AI Hub** - Recommended for developers
138+
- Download from https://qualcomm.ai/hub
139+
- Includes QNN SDK and runtime libraries
140+
141+
2. **Snapdragon SDK** - For Snapdragon platform development
142+
- Available via Qualcomm Developer Network
143+
- Includes TensorFlow Lite with QNN delegate support
144+
145+
After installation, the CLI will automatically detect and use QNN for model execution. The system gracefully falls back to CPU inference if QNN libraries are unavailable.
146+
94147
## Classifying data
95148

96149
To classify data (whether this is from the camera, the microphone, or a custom sensor) you'll need a model file. This model file contains all signal processing code, classical ML algorithms and neural networks - and typically contains hardware optimizations to run as fast as possible. To grab a model file:
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Snapdragon Hardware Acceleration Detector for Windows ARM64
2+
# This script detects Qualcomm Snapdragon devices and validates QNN (Qualcomm Neural Network) runtime support
3+
# Output: JSON object with device info and QNN availability
4+
5+
param(
6+
[switch]$Json = $false
7+
)
8+
9+
# Detect if running on ARM64 Windows
10+
$isArm64 = (Get-WmiObject -Class Win32_Processor | Select-Object -ExpandProperty Architecture) -eq 12
11+
12+
if (-not $isArm64) {
13+
if ($Json) {
14+
Write-Output (ConvertTo-Json @{
15+
"device" = "x64"
16+
"isSnapdragon" = $false
17+
"hasQnn" = $false
18+
"message" = "Not an ARM64 device"
19+
})
20+
}
21+
else {
22+
Write-Output "Not an ARM64 device (current: $(Get-WmiObject -Class Win32_Processor | Select-Object -ExpandProperty Name))"
23+
}
24+
exit 0
25+
}
26+
27+
# Detect Qualcomm Snappdragon device indicators
28+
$deviceInfo = @{
29+
"device" = "arm64"
30+
"isSnapdragon" = $false
31+
"hasQnn" = $false
32+
"processorName" = ""
33+
"message" = ""
34+
}
35+
36+
try {
37+
$processor = Get-WmiObject -Class Win32_Processor | Select-Object -ExpandProperty Name
38+
$deviceInfo.processorName = $processor
39+
40+
# Check for Qualcomm Snapdragon indicators
41+
if ($processor -like "*Qualcomm*" -or $processor -like "*Snapdragon*") {
42+
$deviceInfo.isSnapdragon = $true
43+
$deviceInfo.message = "Qualcomm Snapdragon detected: $processor"
44+
}
45+
}
46+
catch {
47+
$deviceInfo.message = "Warning: Could not detect processor details (error: $_)"
48+
}
49+
50+
# Check for QNN runtime library in WSL2 (if available)
51+
# This would require WSL with Qualcomm AI Hub or Snapdragon SDK installed
52+
$qnnPaths = @(
53+
"$env:USERPROFILE\.qnn\lib\libQnnTFLiteDelegate.so",
54+
"$env:ProgramFiles\Qualcomm\*\lib\*QNN*",
55+
"C:\Program Files\Qualcomm AI Hub\*\lib\*QNN*"
56+
)
57+
58+
foreach ($path in $qnnPaths) {
59+
if (Test-Path $path) {
60+
$deviceInfo.hasQnn = $true
61+
$deviceInfo.message += " | QNN runtime detected at: $path"
62+
break
63+
}
64+
}
65+
66+
# Check environment variables for Snapdragon SDK
67+
if (Test-Path env:QUALCOMM_SDK_ROOT) {
68+
$deviceInfo.hasQnn = $true
69+
$deviceInfo.message += " | QUALCOMM_SDK_ROOT found"
70+
}
71+
72+
if (Test-Path env:QNN_SDK_ROOT) {
73+
$deviceInfo.hasQnn = $true
74+
$deviceInfo.message += " | QNN_SDK_ROOT found"
75+
}
76+
77+
# Output result
78+
if ($Json) {
79+
Write-Output (ConvertTo-Json $deviceInfo -AsArray)
80+
}
81+
else {
82+
if ($deviceInfo.isSnapdragon) {
83+
Write-Output "✓ Snapdragon device detected: $($deviceInfo.processorName)"
84+
if ($deviceInfo.hasQnn) {
85+
Write-Output "✓ QNN runtime available - hardware acceleration enabled"
86+
}
87+
else {
88+
Write-Output "ℹ QNN runtime not detected - install Qualcomm AI Hub or Snapdragon SDK for acceleration"
89+
}
90+
}
91+
else {
92+
Write-Output "ℹ ARM64 device detected but not confirmed as Snapdragon"
93+
Write-Output " Processor: $($deviceInfo.processorName)"
94+
}
95+
}
96+
97+
exit 0

windows-installer/installer.nsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Section "Edge Impulse Linux CLI (required)" SecMain
7070
File "${STAGING_DIR}\bin\edge-impulse-linux.cmd"
7171
File "${STAGING_DIR}\bin\edge-impulse-linux-runner.cmd"
7272
File "${STAGING_DIR}\bin\edge-impulse-camera-debug.cmd"
73+
File "${STAGING_DIR}\bin\detect-snapdragon.ps1"
7374

7475
FileOpen $R0 "$TEMP\_ei_addpath.ps1" w
7576
FileWrite $R0 "$$binDir = '$INSTDIR\bin'$\r$\n"

windows-installer/stage.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,21 @@ if (-not (Test-Path $nmSrc)) { throw "node_modules/ not found. Run npm ci first.
6666
robocopy $nmSrc "$stagingDir\node_modules" /E /NFL /NDL /NJH /NJS | Out-Null
6767
if ($LASTEXITCODE -gt 7) { throw "robocopy node_modules failed with exit code $LASTEXITCODE" }
6868

69+
# Detect Snapdragon hardware acceleration support (ARM64 only)
70+
Write-Host "`n--> Checking Snapdragon hardware acceleration support"
71+
if ($Arch -eq 'arm64') {
72+
$detectScriptPath = Join-Path $PSScriptRoot "detect-snapdragon.ps1"
73+
if (Test-Path $detectScriptPath) {
74+
& $detectScriptPath
75+
}
76+
else {
77+
Write-Host " (Snapdragon detection script not found)"
78+
}
79+
}
80+
else {
81+
Write-Host " Skipped (x64 architecture)"
82+
}
83+
6984
Write-Host "`n--> Writing .cmd shims"
7085
$binEntries = @{
7186
'edge-impulse-linux' = 'build\cli\linux\linux.js'
@@ -83,6 +98,16 @@ foreach ($name in $binEntries.Keys) {
8398
Write-Host " $name.cmd"
8499
}
85100

101+
Write-Host "`n--> Copying Snapdragon detection helper"
102+
$detectScript = Join-Path $PSScriptRoot "detect-snapdragon.ps1"
103+
if (Test-Path $detectScript) {
104+
Copy-Item -Path $detectScript -Destination "$stagingDir\bin\detect-snapdragon.ps1" -Force
105+
Write-Host " detect-snapdragon.ps1 (for ARM64 optimization)"
106+
}
107+
else {
108+
Write-Host " (Snapdragon detection script not found)"
109+
}
110+
86111
Write-Host "`n--> Copying LICENSE"
87112
$licenseSrc = Join-Path $repoRoot "LICENSE.3-clause-bsd-clear"
88113
if (Test-Path $licenseSrc) {

0 commit comments

Comments
 (0)