executorch icon indicating copy to clipboard operation
executorch copied to clipboard

QNN HTP fails to initialize on Snapdragon 8 Elite (SM8750P) — native “No Snapdragon SOC detected” / transport error 4000

Open ivaylo681-dev opened this issue 4 months ago • 26 comments

🐛 Describe the bug

Hello! I am opening the topic here as closing the old one (seems the old was on a wrong place).

The failure that I have is with identical failure signature as https://github.com/pytorch/executorch/issues/16465 (QnnDsp: No Snapdragon SOC detected → error 4000), but on a different sun-platform device (my soc_id=639 confirmed via /sys/devices/soc0/soc_id). In the thread that I have found it has been replied that the issue for soc_id=705 will be fixed in qnn-runtime 2.43.0. I am already with the newest version 2.48.0, but as my soc is different version of 7850 seems the problem is not solved for it. Adding here the full description and I will be really gratefull for any help!

Summary

On a Snapdragon 8 Elite (SM8750P) Android device, the Hexagon HTP backend fails to initialize via QNN, regardless of which framework or SDK version is used to reach it. The failure occurs deep inside Qualcomm’s native QNN libraries — at DSP SoC-detection / transport-initialization — not in any application-level or third-party framework code. This has been reproduced identically through two independent, unrelated frameworks (ONNX Runtime’s QNN Execution Provider, and TensorFlow Lite’s QNN delegate), both calling into the same underlying QAIRT native libraries, both failing at the same point with the same error codes.

Device

• SoC model: SM8750P (adb shell getprop ro.soc.model)

• Board platform: sun (adb shell getprop ro.board.platform)

• Hardware: qcom

• OS: Android 16, MIUI/HyperOS (Xiaomi)

• Native QNN libs present on device (confirmed via run-as ls -la on installed APK): libQnnHtp.so, libQnnHtpV68/V69/V73/V75/V79/V81Skel.so + matching Stub.so, libQnnSystem.so — all present, correctly loaded (confirmed via nativeloader log: Load .../libqnn_delegate_jni.so ... ok)

Reproduction 1 — ONNX Runtime QNN Execution Provider

Using onnxruntime-android-qnn (tested versions 1.27.0 and 1.28.0, identical result on both):

val qnnOptions = OrtSession.SessionOptions().apply {

addQnn(mapOf(

"backend_path" to "libQnnHtp.so",

"profiling_level" to "detailed" ))

}

createdSession = ortEnv!!.createSession(modelBytes, qnnOptions)

Result — session creation does not throw, but GetCapability() silently assigns 100% of graph nodes to CPU:

W onnxruntime: [qnn_backend_manager.cc:1680 SetupBackend] Failed to setup so cleaning up

E onnxruntime: [qnn_execution_provider.cc:1046 GetCapability] QNN SetupBackend failed Failed to create device. Error: QNN_DEVICE_ERROR_INVALID_CONFIG: Invalid config values

Confirmed via enableProfiling() trace inspection: every node across multiple full inference passes shows "provider": "CPUExecutionProvider"; zero occurrences of “QNN” in the raw trace JSON.

Reproduction 2 — TensorFlow Lite QNN delegate (independent framework, same device, same app process)

Using com.qualcomm.qti:qnn-litert-delegate:

val options = QnnDelegate.Options()

options.setBackendType(QnnDelegate.Options.BackendType.HTP_BACKEND)

options.setSkelLibraryDir(context.applicationInfo.nativeLibraryDir)

val qnnDelegate = QnnDelegate(options)

val tfliteOptions = Interpreter.Options().apply { addDelegate(qnnDelegate) }

val interpreter = Interpreter(tfliteModel, tfliteOptions)

Result — this surfaces the real native failure, at the QnnDsp layer, independent of ORT entirely:

E QnnDsp: QnnDsp loadRemoteSymbols failed with err 4000

E QnnDsp: QnnDsp Failed to create transport for device, error: 4000

E QnnDsp: QnnDsp Failed to load skel, error: 4000

E QnnDsp: QnnDsp Transport layer setup failed: 14001

E QnnDsp: QnnDsp Failed to parse default platform info: 14001

E QnnDsp: QnnDsp Failed to load default platform info: 14001

E QnnDsp: QnnDsp Failed to parse platform config: 14001

This is a native-level failure inside libQnnHtp.so / the skel loading path — not a Java/Kotlin exception, not framework-specific code. Two different frameworks, two different SDK entry points, same underlying native failure.

Matches a known, previously-reported issue on the same platform

This closely matches #16465 (“QNN HTP init fails on CQ8750S (soc_id=705): ‘No Snapdragon SOC detected’”), filed against the same ro.board.platform=sun device family and already labeled partner: qualcomm by the ExecuTorch maintainers. That issue’s log shows the same error code surfacing at a slightly earlier stage of initialization:

QnnDsp No Snapdragon SOC detected

QnnDsp No Snapdragon SOC detected

QnnDsp Failed to init router

QnnDsp failed sg_htpSingletonProvider initialize: 4000

Same error code (4000), same platform family, consistent with a SoC-identification failure early in QNN’s device-detection path that cascades into transport/skel-load failure. My device reports a clean ro.soc.model=SM8750P (not the garbled CQ8750S string in that report), so this may be a related but distinct SoC-ID/SKU variant not recognized by the current QAIRT SoC lookup table.

Ruled out (not the cause)

Exhaustively tested and eliminated before concluding this is an SDK-level issue:

Variable

Tested

Result

htp_arch provider option

unset, 81, 79 (invalid — not in ORT enum), 69

No change

soc_model provider option

69

No change

Model precision

fp32, native fp16

No change — fails before model is evaluated

onnxruntime-android-qnn version

1.27.0, 1.28.0

Identical failure both versions

qnn-runtime native library version

bundled vs. explicit override to 2.48.0 (confirmed via file-size diff on installed APK: 2,642,248 ? 3,760,632 bytes — genuinely a different binary)

No change

Manual ADSP_LIBRARY_PATH override

present vs. removed entirely

No change

vtcm_mb config

unset vs. 8

No change

Op-level HTP support

checked all model ops against published QNN operator table — all supported

Not the cause; failure occurs before op-level partitioning

App-level DSP device-node permissions (disproven as the cause, included for completeness)

Initially suspected the app’s read-only access to /dev/fastrpc-cdsp (owner/group system:system) as the cause. This is disproven: a third-party benchmarking app (Geekbench AI), running with no elevated privileges, achieves genuine HTP acceleration on this exact device via its own TFLite QNN backend — confirmed via a large FP16/INT8 score differential versus its NNAPI backend on the same device (QNN: 21,627/55,112 vs. NNAPI: 485/1,111 for half-precision/quantized workloads respectively) — https://browser.geekbench.com/ai/v1/542278. This proves third-party app-level HTP access is possible on this device in principle. I do not know what QAIRT/QNN SDK version Geekbench bundles; it’s possible they have a vendor-provided or newer build with correct SoC recognition for this chip that isn’t yet available via the public qnn-runtime Maven releases I tested (through 2.48.0).

Versions

PyTorch version: 2.13.0+cpu Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A

OS: Microsoft Windows 11 Pro (10.0.26100 64-bit) GCC version: Could not collect Clang version: Could not collect CMake version: version 3.31.7 Libc version: N/A

Python version: 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] (64-bit runtime) Python platform: Windows-10-10.0.26100-SP0 Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA Is XPU available: False HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: False Caching allocator config: N/A

CPU: Name: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz Manufacturer: GenuineIntel Family: 205 Architecture: 9 ProcessorType: 3 DeviceID: CPU0 CurrentClockSpeed: 2901 MaxClockSpeed: 2901 L2CacheSize: 1536 L2CacheSpeed: None Revision: None

Versions of relevant libraries: [pip3] numpy==2.4.6 [pip3] onnx==1.22.0 [pip3] onnxruntime==1.27.0 [pip3] onnxslim==0.1.94 [pip3] optree==0.19.1 [pip3] torch==2.13.0 [pip3] torchvision==0.28.0 [conda] Could not collect

cc @cbilgin @psiddh

ivaylo681-dev avatar Aug 05 '26 07:08 ivaylo681-dev

@chenweng-quic , Good catch! You're right that /sys/devices/soc0/soc_id isn't a QNN concept at all. I checked QnnTypes.h again and there's no socId field anywhere in it, only socModel. I've been using the kernel-level soc_id (639) purely as a convenient way to identify which physical chip I'm testing on (since ro.soc.model=SM8750P alone doesn't disambiguate SKU variants). It has never been itself passed into any QNN API or config field. I don't have a document establishing equivalence between it and anything QNN-internal. Apologies if that caused confusion in how I framed earlier reports.

The actual QNN-facing values tested, for the record:

ORT's soc_model provider option: 69 (confirmed correct value for SM8750 per QnnTypes.h) - fails ExecuTorch's --soc_model flag: "SM8750" (string form) - device creation succeeds, crashes later at execution (separate bug, tracked above)

Reproduce command in ExecuTorch (on the device reporting soc_id=639/SM8750P):

python mobilenet_v2.py --device <device_serial> --soc_model "SM8750" --build_folder /path/to/build-android -d /path/to/imagenet-mini/val Full setup: executorch @ latest main as of 2026-08-07, QAIRT SDK 2.49.0.260730, Android NDK r27c, target arm64-v8a.

From my "notes": [INFO] [Qnn ExecuTorch]: QnnContextCustomProtocol expected magic number: 0x5678abcd but get: 0x4034b50 [INFO] [Qnn ExecuTorch]: Deserializing processed data using Dlc [INFO] [Qnn ExecuTorch]: Creating new backend bundle. [INFO] [Qnn ExecuTorch]: create QNN Logger with log_level 1 [INFO] [Qnn ExecuTorch]: Initialize Qnn backend parameters for Qnn executorch backend type 2 [INFO] [Qnn ExecuTorch]: Caching: Caching is in RESTORE MODE. [INFO] [Qnn ExecuTorch]: QnnContextCustomProtocol expected magic number: 0x5678abcd but get: 0x4034b50 [WARNING] [Qnn ExecuTorch]: Failed to interpret QNN context binary. Error code 30010. Try verifying binary with online-prepare format. [INFO] [Qnn ExecuTorch]: create QNN Logger with log_level 1 [INFO] [Qnn ExecuTorch]: Running level=1 optimization. [INFO] [Qnn ExecuTorch]: Skip qnn_graph_create, graph has already been composed from Dlc. Segmentation fault

  • thread #1, stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x7f3337ec0c1c) frame #0: EventTracer::event_tracer_profiling_level(this=0x00007f3337ec0c00) at event_tracer.h:529:12 frame #1: EventTracerProfileOpScope::~EventTracerProfileOpScope(this=0x0000007fffffc9cf) at event_tracer_hooks.h:63:24 frame #2: Method::execute_instruction(this=...) at method.cpp:1546:5 frame #3: Method::execute(this=...) at method.cpp:1758:21 frame #4: main(argc=1, argv=...) at qnn_executor_runner.cpp:607:26

ivaylo681-dev avatar Aug 13 '26 07:08 ivaylo681-dev

For segmentation fault issue, could you create another issue and close current one if there is no issue leave?

chenweng-quic avatar Aug 13 '26 07:08 chenweng-quic

@chenweng-quic , I have opened the segfault as a separate issue: https://github.com/pytorch/executorch/issues/21804 On closing this one - the original device-creation failure itself is still open: soc_id=639 (SM8750P) isn't recognized at the native QNN SoC-detection layer inside the qnn-runtime library itself, which is framework-independent - it's the same underlying issue whether triggered via ORT (QNN_DEVICE_ERROR_INVALID_CONFIG), TFLite (QnnDsp: No Snapdragon SOC detected), or auto-detection inside ExecuTorch itself when soc_model isn't explicitly overridden. To be clear, I'm not asking about anything ORT- or ExecuTorch-specific here - this is squarely a qnn-runtime package bug, since that's the component doing the actual SoC recognition underneath all three frameworks. That's what this thread is actually about, and it's unresolved regardless of which downstream framework calls into it. Could we keep this open until that's addressed, or is there a reason to consider it resolved that I'm missing?

ivaylo681-dev avatar Aug 13 '26 07:08 ivaylo681-dev

@chenweng-quic , I have something new! Found the mapping in your own SDK: <QNN_SDK_ROOT>/lib/python/qti/aisw/tools/core/utilities/devices/android/android_device_constants.py contains:

python "639": "SM8750",

So soc_id=639 → SM8750 → soc_model=69 is the correct mapping according to your own SDK. But soc_model=69 still fails at deviceCreate() in the native runtime (libQnnHtp.so), producing "No Snapdragon SOC detected" / QNN_DEVICE_ERROR_INVALID_CONFIG.

So the mapping exists and is correct — it's just not being honored by the native library ((libQnnHtp.so/libQnnSystem.so))at device creation time. Can this be checked on your end?

ivaylo681-dev avatar Aug 13 '26 21:08 ivaylo681-dev

@chenweng-quic @nil-is-all , Update — the ORT-side portion of this is now fixed, and the remaining problem turns out to be something different from what I described earlier.

On the ORT side, @qti-mbadnara raised onnxruntime/onnxruntime-qnn#736, which adds string-name support for the soc_model provider option. I built and validated it on this device: soc_model="SM8750" now parses and resolves correctly to model value 69 (confirmed against a deliberately-invalid control string, which does produce a warning). That fix works as intended and closes the ORT parsing gap. Thanks for the quick turnaround on it.

More importantly: my earlier diagnosis in this thread was wrong. I've now run Qualcomm's own qnn-platform-validator (QAIRT 2.49.0.260730) on this device, and it passes every check — the chip is identified correctly as Hexagon V79, and a unit test executes successfully on the DSP. So please disregard my previous comment about android_device_constants.py and the SoC-ID table: soc_id=639 is recognized, and no table change is needed. I withdraw that request.

What's left is narrower and, I think, genuinely answerable. Below is what's now eliminated, and the three specific questions remaining.

Device: SM8750P, soc_id=639, Android 16 (HyperOS). QAIRT 2.49.0.260730, libraries copied directly from the SDK — libQnnHtp.so is byte-identical (3,786,064) in both tests below.

Qualcomm's qnn-platform-validator, shell context:

DSP,Supported,Found,Not Found,Hexagon Architecture V79,Passed,Passed

Calculator unit test executed on the DSP using the unsigned hexagon-v79 skel. No testsig required.

Same libraries, loaded from the app's nativeLibraryDir:

qnn_execution_provider.cc:2081 — QNN SetupBackend failed Failed to create device. Error: QNN_DEVICE_ERROR_INVALID_CONFIG

Eliminated: SoC recognition (validator above); DSP/FastRPC/skel loading (validator above); ORT config construction — option tags, arch.arch, arch.deviceId, socModel all verified populated at qnn_backend_manager.cc:776–871; soc_model ("SM8750", 69, and no config at all — [nullptr] — fail identically, so there are no config values present to be invalid); htp_arch (v79 parsed and carried to the struct); QAIRT version (2.48, 2.49; Maven and SDK builds); ADSP_LIBRARY_PATH (unset, app-dir-first, ; and : separators — all identical).

The failure takes ~2 ms and produces no QnnDsp-tagged native output. The validator, same device and libraries, logs verbosely at every stage.

Questions:

Does QNN_DEVICE_ERROR_INVALID_CONFIG from QnnDevice_Create() indicate rejection at config-struct validation, before SoC detection runs? The absence of any native logging suggests it returns before doing real work. What differs for QnnDevice_Create() between a shell process and an Android app process, given the platform validator passes on this hardware with these libraries? What is the correct ADSP_LIBRARY_PATH value and separator for an Android app loading skels from its own nativeLibraryDir? ORT warns about the existing value on every run, whether the app sets it or not.

ivaylo681-dev avatar Aug 19 '26 10:08 ivaylo681-dev

Hi @ivaylo681-dev , For any questions about ORT-QNN, could you open an issue there? If you see any errors in executorch, could you zip up all artifacts and share the steps to reproduce?

chenweng-quic avatar Aug 19 '26 10:08 chenweng-quic