Skip to content

feat(0.16.3): Android Qualcomm NPU + qdrant-edge 0.7.1#296

Merged
DenisovAV merged 11 commits into
mainfrom
feature/android-npu
May 30, 2026
Merged

feat(0.16.3): Android Qualcomm NPU + qdrant-edge 0.7.1#296
DenisovAV merged 11 commits into
mainfrom
feature/android-npu

Conversation

@DenisovAV
Copy link
Copy Markdown
Owner

Summary

  • Android Qualcomm NPU (PreferredBackend.npu): bundles libLiteRtDispatch_Qualcomm.so + QNN runtime stack (libQnnHtp.so, libQnnSystem.so, libQnnHtpV73/V75/V79/V81Stub.so) for sm8550/sm8650/sm8750/sm8850 chipsets. Wired via litert_lm_engine_settings_set_litert_dispatch_lib_dir using nativeLibraryDir from a platform channel call before engine_create.
  • qdrant-edge 0.7.1: drops vendored fork — wal_options is now native in upstream. Requires Rust 1.95+ (stable); rust-toolchain.toml + RUSTC detection in build_local.sh ensure correct toolchain on macOS with Homebrew.
  • hook/build.dart: new androidExtraLibs field parallel to windowsExtraLibs; all 7 platform sha256s updated; version bumped to native-v0.12.0-a (new release tag that includes QNN libs without clobbering native-v0.12.0).
  • AndroidManifest: declares libcdsprpc.so as optional native library (required for Qualcomm HTP dispatch).

Test plan

  • Android integration tests (litertlm_ffi_test.dart) — all 23 tests passed on Pixel 8 (exit 0)
    • CPU text, GPU text/stream/vision/audio/thinking ✅
    • Chat: sync, stream, multi-turn, clearHistory, stop ✅
    • Multi-session: isolation, mutex, UAF safety ✅
    • NPU: skipped on Pixel 8 (Tensor G3, not Snapdragon) — expected
  • NPU smoke test on Snapdragon device (sm8650/sm8750) — requires QNN-compiled .litertlm model

DenisovAV added 11 commits May 29, 2026 18:37
Builds the Qualcomm QNN dispatch bridge from LiteRT source (commit
d865fd82, matching LiteRT-LM ffed38a / native-v0.12.0). Required for
PreferredBackend.npu on Android Snapdragon devices (#293).
- Bump qdrant-edge dependency: 0.6.1 → 0.7.1
- Replace EdgeShard::load_with_wal_options (patched upstream) with
  EdgeShard::load + wal_options field in EdgeConfig (now native in 0.7)
- Remove [patch.crates-io] block and ../vendored/qdrant-edge/ dependency
- Add rust-toolchain.toml pinning stable (0.7+ needs rustc 1.95+)
- build_local.sh: prefer rustup rustc over Homebrew's if available
- CI workflow: update default version, clean up release body text
….npu

- AndroidManifest: declare libcdsprpc.so as optional native library so
  Bionic can resolve the CDSP RPC symbols needed by HTP dispatch
- FlutterGemmaPlugin: add getNativeLibraryDir to bundledChannel so Dart
  can resolve the path where APK-bundled .so files land at runtime
- litert_lm_client.dart: call set_litert_dispatch_lib_dir with
  nativeLibraryDir when backend=='npu' on Android (mirrors Windows NPU)
- build_android.sh: copy Qualcomm dispatch+QNN libs from SCRIPT_DIR
  prebuilt dir into the output tarball (separate from LiteRT-LM prebuilts)

Qualcomm libs in prebuilt/android_arm64/ cover sm8550(V73), sm8650(V75),
sm8750(V79), sm8850(V81) — extracted from Google AI Edge Gallery APKs,
ABI-verified against litert_dispatch.h at LiteRT commit d865fd82.
- _NativeBundle: add androidExtraLibs field (parallel to windowsExtraLibs)
  for Android-only companion libraries
- _processBundle: register androidExtraLibs as CodeAssets on Android
- litertlm bundle: declare Qualcomm NPU libs as androidExtraLibs so Native
  Assets bundles them into the APK (LiteRtDispatch_Qualcomm + QnnHtp +
  QnnSystem + V73/V75/V79/V81 Stubs)
- qdrant-edge bundle: bump to 0.7.1 (vendored fork dropped), clear
  placeholder checksums pending tarball rebuild
- Mark Android litertlm sha256 as TODO pending QNN-inclusive tarball rebuild
litertlm android: new tarball includes Qualcomm QNN dispatch libs
  (NDK r29, LiteRT-LM ffed38a + QnnHtp/System/V73/V75/V79/V81 Stubs)
qdrant-edge 0.7.1: all 7 platforms — macOS/iOS/iOS-sim/Android (local),
  Linux x86_64/arm64 + Windows x86_64 (CI workflow run 26667793192)
build_android.sh: skip cp when source==dest for Qualcomm libs
…ix build_qualcomm_dispatch.sh, drop vendored qdrant-edge fork

- litert_lm_client.dart: throw StateError instead of silent skip when
  getNativeLibraryDir returns null (C-1 from PR review)
- FlutterGemmaPlugin.kt: wrap getNativeLibraryDir in try/catch for
  consistent error reporting (I-1)
- build_qualcomm_dispatch.sh: NDK_API_LEVEL 28→30 (matches minSdk for
  .litertlm); update stale LiteRT-LM ref comment 032334d→ffed38ad (I-4, I-5)
- Remove native/qdrant_edge/vendored/ (0.6.1 fork, dead since 0.7.1)
- Remove rust-toolchain.toml (dead weight, rustup detection in build_local.sh
  is sufficient; qdrant-edge 0.7.1 on crates.io requires stable ≥1.95.0)
@DenisovAV DenisovAV merged commit 58fe8cc into main May 30, 2026
1 check passed
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