Lab 01 — AI Hub Deployment (QAI Hub)
Phase: 06 — Qualcomm NPU Hardware & Deployment | Difficulty: ⭐⭐⭐⭐⭐ | Time: 3–4 hours
Qualcomm AI Hub (qai_hub) compiles and benchmarks models directly on Snapdragon NPU/DSP hardware.
What you build
- Export a model to ONNX (opset 17) for QAI Hub compatibility
- Simulate SNPE/QNN conversion pipeline (profile, compile, inference tasks)
- Evaluate model compatibility: supported ops vs fallback ops
- Parse and analyze Hub job results for latency and accuracy
Key concepts
| Concept | What to understand |
|---|---|
| SNPE vs QNN | SNPE = legacy DLC format; QNN = new binary context format |
| NPU targets | Snapdragon 8 Gen 3 (SM8650) has 45 TOPS NPU |
| Op support | Not all ONNX ops supported on NPU; unsupported fall to CPU/GPU |
| QAI Hub jobs | compile_job → profile_job → inference_job pipeline |
Files
| File | Purpose |
|---|---|
lab.py | Stubs with TODO markers |
solution.py | Complete working implementation |
test_lab.py | pytest suite |
requirements.txt | Dependencies |
Run
pip install -r requirements.txt
python lab.py
pytest test_lab.py -v
Note: Full QAI Hub tests require a
qai_hubaccount and device access. Tests that need account access are skipped automatically.