Requirements
Hardware
- Qualcomm Snapdragon processors with Hexagon DSP/NPU:
- Snapdragon 8 Gen 1/2/3 (flagship mobile)
- Snapdragon 7 series (mid-range mobile)
- Snapdragon X Elite (Windows on ARM)
- Qualcomm Robotics platforms
Software
- Qualcomm Neural Processing SDK (QNN SDK)
- Android NDK (for Android deployment)
- Operating Systems:
- Android 10+
- Windows on ARM
- Linux (embedded systems)
QNN provides exceptional power efficiency, making it ideal for mobile and battery-powered edge devices.
Installation
- Build from Source
- Android
Basic Configuration
Python API
genai_config.json
Memory Management
CPU-Accessible NPU Memory
QNN uses CPU-accessible memory for NPU operations:QNN memory is shared between CPU and NPU, eliminating the need for explicit data transfers and reducing latency.
NPU Configuration
Backend Selection
Performance Settings
- Burst Mode
- Balanced Mode
- Power Saver
- Sustained
Mobile Deployment
Android Integration
Pipeline Models
QNN supports pipeline models for memory-constrained devices:reset_session_idx allows releasing memory from previous pipeline stages, crucial for devices with limited RAM.Quantization
INT8 Optimization
QNN provides native INT8 support for maximum efficiency:Precision Configuration
INT8 quantization on QNN provides:
- 4x memory reduction
- 2-4x inference speedup
- Minimal accuracy loss with proper calibration
Advanced Features
Context Binary Generation
Pre-compile models to context binaries for faster loading:Device Filtering
Power Management
Battery Optimization
Thermal Management
Troubleshooting
QNN SDK Not Found
Model Loading Failures
Check Model Compatibility
Check Model Compatibility
Ensure your ONNX model is compatible with QNN. Not all ONNX operators are supported.
Verify Backend Path
Verify Backend Path
Enable Logging
Enable Logging
Performance Issues
Benchmarking
Best Practices
Use INT8 Models
Quantize models to INT8 for best NPU performance and power efficiency.
Enable Context Caching
Pre-compile models to context binaries to reduce loading time.
Pipeline Large Models
Split large models into pipeline stages to fit in device memory.
Optimize Performance Mode
Choose performance mode based on battery state and thermal conditions.
Next Steps
Mobile Deployment
Deploy to Android devices
Model Quantization
Optimize models for QNN