Inside AI
← Build & Hack
Proposed build / Edge AI

Prove a fixed-image ONNX run reached Qualcomm HTP

Use the same SqueezeNet input for CPU-only, mixed and strict runs. The NPU procedure is proposed and untested on RUBIK Pi 3.

Device profile · Thundercomm RUBIK Pi 3 ↗
Start with the documented setup

This is a proposed workflow. Follow the linked official setup, then use the checks below to decide whether it works on your hardware.

Thundercomm RUBIK Pi 3 board showing its I/O ports and 40-pin header.
RUBIK Pi 3 product photograph shown by ATE Store for SKU ATE104550. The photographed PCB revision and separate reuse permission are unverified. Hardware reference for this proposed build; not a result from our test. ATE Store · Thundercomm ↗

Flash the board-specific Ubuntu Server release

Use Canonical Ubuntu Server 24.04 LTS for RUBIK Pi 3, x03 build 527 (ubuntu-24.04-preinstalled-server-arm64+rubikpi3-20260305-527.img.xz), with its matching DTB, rawprogram file and the QLI 1.6 boot bundle linked by Canonical. The Server manifest records kernel 6.8.0-1064-qcom and Python 3.12.3. In a Python 3.12 venv on ARM64, pair onnxruntime==1.26.0 with onnxruntime-qnn==2.5.0. Its CPython 3.12 manylinux ARM64 wheel has QAIRT 2.49.40, the HTP backend and the Hexagon V68 host stub and DSP skel. Keep the bundled libraries together and use the Ubuntu image's DSP firmware and FastRPC services. This combination is based on the published image, release and package contents. HTP execution on this board remains untested by Inside AI. Image and checksum · Image manifest · Version pair

Use the existing computer and a data-rated USB cable with QDL. Follow Thundercomm's factory instructions to enter EDL and flash the matched firmware and Server files to the board's UFS. Back up files on the board first because that operation replaces the installation. Use the Micro-USB serial connection for initial access and set up SSH over an existing network if preferred. The official image download, checksum, DTB, rawprogram file and firmware are separate. Download · QDL installation

Set up the exact Python and HTP stack

Run these commands on the board. The ARM64 image has the kernel and firmware. Use both Qualcomm IoT Noble FastRPC packages at 1.0.15+repack2. qcom-fastrpc1 supplies the runtime and udev rules. qcom-fastrpc-dev supplies the unversioned libcdsprpc.so link required by this wheel's V68 stub. Confirm the origin and version before installing. If the pin disappears, record and revalidate the replacement. Check that the CDSP device exists and your user can access it.

The standalone QNN plugin loads its own HTP libraries. Keep this isolated from system QNN libraries and the older Thundercomm download, which bundles the provider into ORT 1.23.0 and uses a different Python API. The project borrows that guide's model and input, then uses the versioned plugin route. FastRPC · Version pairing · ARM64 plugin wheel

uname -m
uname -r
python3.12 --version

sudo apt update
sudo apt install python3.12-venv software-properties-common wget
sudo add-apt-repository ppa:ubuntu-qcom-iot/qcom-ppa
sudo apt update
apt-cache policy qcom-fastrpc1 qcom-fastrpc-dev
sudo apt install qcom-fastrpc1=1.0.15+repack2 qcom-fastrpc-dev=1.0.15+repack2
dpkg-query -W qcom-fastrpc1 qcom-fastrpc-dev linux-firmware-qcom-rubikpi3
ls -l /dev/fastrpc-cdsp*
ldconfig -p | grep libcdsprpc
ls -l /usr/lib/aarch64-linux-gnu/libcdsprpc.so

python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --only-binary=:all: \
  'onnxruntime==1.26.0' 'onnxruntime-qnn==2.5.0' Pillow
python -m pip show onnxruntime onnxruntime-qnn

Get a fixed input and the vendor model

Download the public sample files in the same directory. The ONNX graph references external weights as model.data; retain that name. This model expects one uint8 NCHW tensor of shape 1,3,224,224 and uses input scale 1/255 with zero point 0. Use the same image and filenames for all runs. Save the hashes when comparing traces across machines. Thundercomm SqueezeNet example

assets=https://cdn.edgeimpulse.com/qc-ai-docs
wget -O model.onnx "$assets/models/SqueezeNet-1.1_w8a8.onnx"
wget -O model.data "$assets/models/SqueezeNet-1.1_w8a8.data"
wget -O labels.txt "$assets/models/SqueezeNet-1.1_labels.txt"
wget -O boa-constrictor.jpg "$assets/examples/boa-constrictor.jpg"
sha256sum model.onnx model.data labels.txt boa-constrictor.jpg

Save a script that records graph placement

Copy this as check_htp.py. Each invocation starts a fresh process and enables ORT profiling. Mixed and strict use the same HTP library, graph-I/O quantization setting and input. Strict sets session.disable_cpu_ep_fallback=1 before session creation. The separate disable_fallback() call turns off the Python wrapper's retry during inference. get_providers() only checks session configuration; the script then looks for executed partitions in the trace. Versioned plugin API

import argparse
import json
import platform
from pathlib import Path

import numpy as np
import onnxruntime as ort
from PIL import Image

parser = argparse.ArgumentParser()
parser.add_argument("mode", choices=("cpu", "mixed", "strict"))
mode = parser.parse_args().mode
ep_name = "QNNExecutionProvider"
options = ort.SessionOptions()
options.enable_profiling = True
options.profile_file_prefix = f"ort-{mode}"
options.log_severity_level = 0
options.log_verbosity_level = 1

if mode == "cpu":
    session = ort.InferenceSession(
        "model.onnx", sess_options=options, providers=["CPUExecutionProvider"]
    )
else:
    import onnxruntime_qnn as qnn

    if platform.system() != "Linux" or platform.machine() != "aarch64":
        raise RuntimeError("Run the HTP modes on the RUBIK Pi's ARM64 Linux.")
    print("ORT", ort.__version__, "QNN EP", qnn.__version__,
          "QAIRT", qnn.build_and_package_info.qnn_version)
    print("HTP backend:", qnn.get_qnn_htp_path())
    ort.register_execution_provider_library(ep_name, qnn.get_library_path())
    devices = [d for d in ort.get_ep_devices() if d.ep_name == ep_name]
    if not devices:
        raise RuntimeError("QNN device absent. Check the FastRPC/CDSP stack.")
    if mode == "strict":
        options.add_session_config_entry("session.disable_cpu_ep_fallback", "1")
    options.add_provider_for_devices(devices, {
        "backend_path": qnn.get_qnn_htp_path(),
        "offload_graph_io_quantization": "0",
        "profiling_level": "detailed",
        "profiling_file_path": f"htp-{mode}.csv",
    })
    session = ort.InferenceSession("model.onnx", sess_options=options)
    if ep_name not in session.get_providers():
        raise RuntimeError(f"Session lost QNN: {session.get_providers()}")

# Disable Python's run-time retry. The strict session option above controls
# CPU assignment of graph nodes, including during session creation.
session.disable_fallback()
input_spec = session.get_inputs()[0]
if input_spec.type != "tensor(uint8)" or input_spec.shape != [1, 3, 224, 224]:
    raise RuntimeError(f"Unexpected model input: {input_spec.type} {input_spec.shape}")

# The example model uses scale 1/255 and zero point 0: RGB bytes are its
# quantized inputs. Preprocessing and ranking run in Python on the CPU.
image = Image.open("boa-constrictor.jpg").convert("RGB").resize((224, 224))
pixels = np.ascontiguousarray(np.asarray(image).transpose(2, 0, 1)[None, ...])
logits = session.run(None, {input_spec.name: pixels})[0].reshape(-1)
labels = Path("labels.txt").read_text().splitlines()
for index in np.argsort(logits)[-5:][::-1]:
    print(index, labels[index], float(logits[index]))

trace_path = Path(session.end_profiling())
events = json.loads(trace_path.read_text())
assignments = sorted({
    (event["args"]["provider"], event["name"])
    for event in events
    if event.get("cat") == "Node" and event.get("args", {}).get("provider")
})
print("ORT trace:", trace_path)
for provider, node in assignments:
    print(provider, node)
del session
if mode != "cpu":
    ort.unregister_execution_provider_library(ep_name)
    if not any(provider == ep_name for provider, _ in assignments):
        raise RuntimeError("No QNN graph partition executed in the ORT trace.")
    if mode == "strict" and any(provider == "CPUExecutionProvider" for provider, _ in assignments):
        raise RuntimeError("The strict trace still contains CPU nodes.")
    print("Check the HTP graph-execution events in", f"htp-{mode}.csv")

Run CPU, mixed and strict in order

Use a clean run directory per trial so stale files never count as evidence. Read the corresponding stderr log when a command exits nonzero. The CPU run should print five label/score pairs and CPUExecutionProvider events. The mixed run should show executed QNN partitions and may show CPUExecutionProvider alongside them. Check the HTP CSV for graph execution events after inference, not just backend initialization. A successful strict run with HTP execution and zero CPU-assigned executed graph nodes supports full delegation of the optimized ONNX graph. Python resize, ranking and I/O still use the CPU.

If the QNN device is absent or HTP fails to load, check the board image, CDSP access, libcdsprpc and paired wheel libraries first. If mixed runs and strict rejects CPU assignment, identify the CPU nodes in the mixed JSON/verbose log, then check the operator, shape, dtype and quantization against the pinned plugin. The QNN CSV gives execution detail inside fused partitions where exposed. A generic HTP runtime error or no executed QNN partitions leaves the result unproven. Proposed experiment

python check_htp.py cpu > cpu.txt 2> cpu.log
printf "CPU exit: %s\n" "$?"
env -u ADSP_LIBRARY_PATH -u LD_LIBRARY_PATH \
  python check_htp.py mixed > mixed.txt 2> mixed.log
printf "Mixed exit: %s\n" "$?"
env -u ADSP_LIBRARY_PATH -u LD_LIBRARY_PATH \
  python check_htp.py strict > strict.txt 2> strict.log
printf "Strict exit: %s\n" "$?"
# Check the status and logs before using the traces.
grep -E 'QNNExecutionProvider|CPUExecutionProvider' cpu.txt mixed.txt strict.txt
ls -l ort-*.json htp-*.csv

Budget the headless first run

ATE Store Germany lists the 8 GB / 128 GB board as ATE104550 (internal no. 45426), €299.00 before VAT, €355.81 including German 19% VAT. Checked November 16, 2026. The listing showed immediate availability with 1–3 business days within Germany. It gives neither a stock count nor the shipped PCB revision. The board package contains the board, sticker and quick-start card. It has no PSU or fan. Package FAQ

First year in Germany, headless still-image project: €355.81 board + €25.99 adapter + €20–40 cables and bench materials + €0 required software or cloud fees = €401.80–421.80, VAT included where quoted. The UGREEN Nexode 65 W #10335 quote is a displayed promotion. Its single USB-C port use supports USB PD 3.0 at 12 V / 3 A. The €20–40 editorial allowance includes a 3 A USB-C power lead, USB-A to USB-C data lead for QDL, Micro-USB data lead for serial, and a basic nonconductive mount, with a host adapter or Ethernet cable as needed. Reuse a computer and an existing network connection. If the adapter, leads and mount are already owned, the incremental total is €355.81. A new host or network service is unquoted. Shipping, electricity and labor are excluded.

The included 128 GB UFS holds the OS and sample. The project uses a downloaded still image and prints labels in a terminal, with no camera, screen, keyboard, SSD or paid compiler purchase. The optional fan, enclosure and MIPI camera are separate for longer or live-video runs. Optional hosted model jobs, training or storage have separate terms and are outside this estimate.

Primary sources

Canonical Ubuntu Server x03 files Thundercomm factory Ubuntu installation Thundercomm SqueezeNet-1.1 example ONNX Runtime QNN EP v2.5.0 release Pinned QNN EP documentation and profiling options QNN EP 2.5.0 release on PyPI Qualcomm FastRPC and HTP runtime guide