Skip to content

Android: opt-in QNN shared I/O and NPU correctness fixes - #19

Draft
joe-sama wants to merge 9 commits into
zoompilot:mainfrom
joe-sama:android-npu-optimizations
Draft

joe-sama wants to merge 9 commits into
zoompilot:mainfrom
joe-sama:android-npu-optimizations

Conversation

@joe-sama

Copy link
Copy Markdown

Adds three default-off QNN options: real HTP shared allocations, explicit CPU-fallback prevention during compilation and reload, and a matching-SDK adapter that disables advanced activation fusion. Provider discovery stays generic; changed policies get separate caches. Models, precision and ordinary builds stay unchanged.

The initial numerical problem was reproducible on the tested range-safe CTV3 graph: stock QNN fusion failed six output groups, while disabling it passed the unchanged gates on 32 identical frames. Separately, shared I/O measured 42.9 → 40.5 ms mean in sequential one-minute prototype tests. These results do not establish a universal speedup or NPU occupancy; that graph preparation is not added here.

Validation: 31 focused Swift tests, 58 Android unit tests in each default/opt-in build, both release APK builds, Android native compilation, and the adapter forwarding/failure/lifetime test passed. All 16 published files were checked against the tested source. An expanded WSL run had eight large-UDP frame-assembly issues in unchanged code; those remain outside this patch. This exact upstream port has not been device-qualified.

Options and reproduction. Related: #16, #18.

mouxangithub added a commit to mouxangithub/jetlink that referenced this pull request Nov 5, 2026
… + cn features fused

Conflict resolution decisions:
- OrtBackend init: keep both qnnBackend (cn phone_qnn vendor backend) and
  the new qnn: QnnPolicy parameter
- providerOptions(.htp): PR's policy-driven options (htpBackend, shared
  I/O allocator) + cn's backend_path override for the phone's own QNN
- compileContext: keep cn's OOM precheck and fail-fast diagnostics, adopt
  PR's contextConfiguration (strict provider contract, no CPU fallback)
- build.gradle.kts: keep cn's natives-packaging (no implementation dep);
  PR's QNN buildConfig fields and qnnJniDir identity kept via auto-merge
  (jniLibs srcDir covers the AAR's QNN libs through the overrides rule)
- ServerController.kt: union (mirrors + qnn_* config keys)

New opt-in QNN options (all default-off): qnn_shared_io, qnn_strict,
qnn_no_activation_fusion + jetlink.qnnJniDir / jetlink.qnnSharedIO etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant