When working on Qualcomm AIC100 projects, Stable Diffusion inference servers, or NPU-accelerated AI workloads, apply this domain knowledge.
Qualcomm Cloud AI 100 (AIC100) — Domain Knowledge
SDK Management
Installation
- SDK is distributed as zip files:
aic_platform, aic_apps, aic_factorytools, aic_containers.
- Extract to home directory, then run install script that installs platform debs (firmware, kernel module, runtime).
- Installed to
/opt/qti-aic/ — includes exec/qaic-exec, dev/python/, dev/lib/.
Version Upgrades (e.g., 1.20.4 → 1.21.2)
- Stop the server
- Back up current install script
- Extract new SDK zips
- Update install script paths and deb filenames
- Run
sudo bash scripts/install_runtime.sh
- Verify device:
qaic-util -q
- Verify exec:
/opt/qti-aic/exec/qaic-exec --help
- Verify Python:
python3 -c "import sys; sys.path.insert(0, '/opt/qti-aic/dev/python'); import qaicrt"
- Clean up old SDK versions (~4.4GB savings)
GLIBCXX Conflict (CRITICAL)
qaic-exec has RUNPATH pointing to /opt/qti-aic/dev/lib/x86_64/apps/ which bundles an old
libstdc++.so.6 (max GLIBCXX 3.4.14).
- When
LD_LIBRARY_PATH is empty, the RUNPATH wins, causing GLIBCXX_3.4.30 not found errors.
- Fix: set
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu in the subprocess environment to override RUNPATH.
Model Compilation Pipeline
ONNX → QPC Workflow
- Export model to ONNX format
- Compile ONNX to QPC (Qualcomm Program Container) using
qaic-exec
- QPC binaries are loaded into DDR, then activated on NPU
Resource Constraints
- 14 NSPs (Neural Signal Processors) required per model activation
- ~15 GB DDR available — can hold ~4-6 models simultaneously in DDR
- Only one model can hold NSPs at a time (active inference)
- SD pipeline requires 4 QPCs (text encoder, UNet, VAE decoder, safety checker) — ~3.6 GB DDR total
Model Registry Architecture
models/
registry.yaml # master index of all models
<model-name>/
config.yaml # metadata, export settings, compile flags, IO spec
export.py # model-specific ONNX export
qpc/ # compiled QPC binaries (generated)
onnx/ # intermediate ONNX files (generated)
Stable Diffusion on AIC100
Model Type Detection
- WRONG: File-size heuristic (>5GB = SDXL) — fails for large SD1.5 checkpoints.
- RIGHT: Inspect safetensors header keys:
conditioner key → SDXL model
cond_stage_model key → SD 1.5 model
- Reject unsupported architectures (e.g., FLUX) early after key-based detection.
LoRA Support
- Auto-LoRA trigger-word matching can activate unwanted LoRAs, causing garbled output.
- Parameters to control:
auto_lora (bool, default true) — master switch
auto_lora_filter (list[str]) — whitelist of LoRA names to allow
- Logic:
auto_lora=false → skip matching; auto_lora=true + empty filter → keep all;
auto_lora=true + filter → keep only matching names.
LoRA + Model Combo Caching
- Track cache status for each LoRA + model combination on a dashboard.
- Compiled LoRA-fused QPC is specific to the exact model + LoRA + strength combo.
Job Queue and Progress
- ETA computation:
eta_sec = elapsed * (1 - progress) / progress (linear extrapolation).
- Report
eta_sec in WebSocket progress messages and job tracking updates.
Server Architecture (Python/FastAPI)
SD WebUI Compatible API
POST /sdapi/v1/txt2img — text to image generation
POST /sdapi/v1/img2img — image to image generation
GET /sdapi/v1/sd-models — list available models
GET /sdapi/v1/samplers — list samplers
GET /sdapi/v1/loras — list LoRAs
GET /sdapi/v1/progress — generation progress
POST /sdapi/v1/interrupt — cancel generation
Generic Model Inference
POST /api/v1/run/{model_name} — run inference on any registered model
GET/POST/DELETE /api/v1/registry — manage model registry
WebSocket Support
/ws/jobs/{job_id} — real-time progress updates with ETA
- Generation progress messages include step count, percentage, and preview images
Debugging
RAM Usage
- Large model files loaded into DDR can consume significant RAM.
- Monitor with standard Linux tools — models may appear as memory-mapped files.
Blurry/Garbled Output
- Usually caused by unwanted LoRA activation via trigger-word matching.
- Diagnosis: check which LoRAs were auto-activated in the generation log.
- Fix: use
auto_lora=false or auto_lora_filter to restrict.
Compilation Failures
- Check for GLIBCXX version conflicts (see SDK section above).
- Verify model architecture detection (SD1.5 vs SDXL vs unsupported).
- Check that
qaic-exec path and SDK version match.
1---2name: qualcomm-aic3description: Qualcomm Cloud AI 100 (AIC100) NPU development — SDK management, model compilation, SD pipeline, LoRA caching, and debugging patterns4---5
6When working on Qualcomm AIC100 projects, Stable Diffusion inference servers, or NPU-accelerated AI workloads, apply this domain knowledge.
7
8# Qualcomm Cloud AI 100 (AIC100) — Domain Knowledge
9
10## SDK Management
11
12### Installation
13- SDK is distributed as zip files: `aic_platform`, `aic_apps`, `aic_factorytools`, `aic_containers`.
14- Extract to home directory, then run install script that installs platform debs (firmware, kernel module, runtime).
15- Installed to `/opt/qti-aic/` — includes `exec/qaic-exec`, `dev/python/`, `dev/lib/`.
16
17### Version Upgrades (e.g., 1.20.4 → 1.21.2)
181. Stop the server
192. Back up current install script
203. Extract new SDK zips
214. Update install script paths and deb filenames
225. Run `sudo bash scripts/install_runtime.sh`
236. Verify device: `qaic-util -q`
247. Verify exec: `/opt/qti-aic/exec/qaic-exec --help`
258. Verify Python: `python3 -c "import sys; sys.path.insert(0, '/opt/qti-aic/dev/python'); import qaicrt"`
269. Clean up old SDK versions (~4.4GB savings)
27
28### GLIBCXX Conflict (CRITICAL)
29- `qaic-exec` has `RUNPATH` pointing to `/opt/qti-aic/dev/lib/x86_64/apps/` which bundles an old
30 `libstdc++.so.6` (max GLIBCXX 3.4.14).
31- When `LD_LIBRARY_PATH` is empty, the RUNPATH wins, causing `GLIBCXX_3.4.30 not found` errors.
32- Fix: set `LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu` in the subprocess environment to override RUNPATH.
33
34## Model Compilation Pipeline
35
36### ONNX → QPC Workflow
371. Export model to ONNX format
382. Compile ONNX to QPC (Qualcomm Program Container) using `qaic-exec`
393. QPC binaries are loaded into DDR, then activated on NPU
40
41### Resource Constraints
42- 14 NSPs (Neural Signal Processors) required per model activation
43- ~15 GB DDR available — can hold ~4-6 models simultaneously in DDR
44- Only one model can hold NSPs at a time (active inference)
45- SD pipeline requires 4 QPCs (text encoder, UNet, VAE decoder, safety checker) — ~3.6 GB DDR total
46
47### Model Registry Architecture
48```
49models/
50 registry.yaml # master index of all models
51 <model-name>/
52 config.yaml # metadata, export settings, compile flags, IO spec
53 export.py # model-specific ONNX export
54 qpc/ # compiled QPC binaries (generated)
55 onnx/ # intermediate ONNX files (generated)
56```
57
58## Stable Diffusion on AIC100
59
60### Model Type Detection
61- **WRONG**: File-size heuristic (>5GB = SDXL) — fails for large SD1.5 checkpoints.
62- **RIGHT**: Inspect safetensors header keys:
63 - `conditioner` key → SDXL model
64 - `cond_stage_model` key → SD 1.5 model
65- Reject unsupported architectures (e.g., FLUX) early after key-based detection.
66
67### LoRA Support
68- Auto-LoRA trigger-word matching can activate unwanted LoRAs, causing garbled output.
69- Parameters to control:
70 - `auto_lora` (bool, default `true`) — master switch
71 - `auto_lora_filter` (list[str]) — whitelist of LoRA names to allow
72- Logic: `auto_lora=false` → skip matching; `auto_lora=true` + empty filter → keep all;
73 `auto_lora=true` + filter → keep only matching names.
74
75### LoRA + Model Combo Caching
76- Track cache status for each LoRA + model combination on a dashboard.
77- Compiled LoRA-fused QPC is specific to the exact model + LoRA + strength combo.
78
79### Job Queue and Progress
80- ETA computation: `eta_sec = elapsed * (1 - progress) / progress` (linear extrapolation).
81- Report `eta_sec` in WebSocket progress messages and job tracking updates.
82
83## Server Architecture (Python/FastAPI)
84
85### SD WebUI Compatible API
86- `POST /sdapi/v1/txt2img` — text to image generation
87- `POST /sdapi/v1/img2img` — image to image generation
88- `GET /sdapi/v1/sd-models` — list available models
89- `GET /sdapi/v1/samplers` — list samplers
90- `GET /sdapi/v1/loras` — list LoRAs
91- `GET /sdapi/v1/progress` — generation progress
92- `POST /sdapi/v1/interrupt` — cancel generation
93
94### Generic Model Inference
95- `POST /api/v1/run/{model_name}` — run inference on any registered model
96- `GET/POST/DELETE /api/v1/registry` — manage model registry
97
98### WebSocket Support
99- `/ws/jobs/{job_id}` — real-time progress updates with ETA
100- Generation progress messages include step count, percentage, and preview images
101
102## Debugging
103
104### RAM Usage
105- Large model files loaded into DDR can consume significant RAM.
106- Monitor with standard Linux tools — models may appear as memory-mapped files.
107
108### Blurry/Garbled Output
109- Usually caused by unwanted LoRA activation via trigger-word matching.
110- Diagnosis: check which LoRAs were auto-activated in the generation log.
111- Fix: use `auto_lora=false` or `auto_lora_filter` to restrict.
112
113### Compilation Failures
114- Check for GLIBCXX version conflicts (see SDK section above).
115- Verify model architecture detection (SD1.5 vs SDXL vs unsupported).
116- Check that `qaic-exec` path and SDK version match.