Skip to content

0.16.3: Android Qualcomm NPU + GPU sampler fix#297

Merged
DenisovAV merged 7 commits into
mainfrom
fix/android-npu-extract-dispatch-libs
May 30, 2026
Merged

0.16.3: Android Qualcomm NPU + GPU sampler fix#297
DenisovAV merged 7 commits into
mainfrom
fix/android-npu-extract-dispatch-libs

Conversation

@DenisovAV
Copy link
Copy Markdown
Owner

Summary

  • Android NPU (PreferredBackend.npu): extracts QNN dispatch stack from APK to codeCacheDir/npu_libs/ at runtime so litert_dispatch.cc opendir() scan finds the libs (AGP 8+ extractNativeLibs=false keeps .so compressed in APK, never extracted to nativeLibraryDir). Bundles Qualcomm QNN libs for SM8550/SM8650/SM8750/SM8850 extracted from Google AI Edge Gallery APKs.
  • GPU sampler fix (Android: GPU samplers silently fall back to CPU — libLiteRtTopK{OpenCl,WebGpu}Sampler.so missing DT_NEEDED libLiteRtLm.so #270): applies patchelf --add-needed libLiteRtLm.so to libLiteRtTopKOpenClSampler.so and libLiteRtTopKWebGpuSampler.so — restores ~3× decode speedup on Android GPU.

Test plan

  • Test gemma-4-E2B-it_qualcomm_sm8750.litertlm + PreferredBackend.npu on SM8750 device (hacker1024 confirming)
  • Test gemma-4-E2B-it.litertlm + PreferredBackend.gpu — verify no GPU sampler CPU fallback in logcat
  • Run 18-test suite on Android arm64

DenisovAV added 7 commits May 30, 2026 10:54
litert_dispatch.cc uses opendir() to scan dispatch_lib_dir for
libLiteRtDispatch_Qualcomm.so. With AGP 8+ default extractNativeLibs=false,
.so files stay inside the APK and are never extracted to nativeLibraryDir,
so the scan finds nothing and NPU init fails with 'No dispatch library found'.

Extract the QNN dispatch stack (~7 MB) to codeCacheDir/npu_libs/ on first
NPU engine_create. Subsequent calls skip already-extracted files.
)

- Add libQnnHtpV73/V75/V79Skel.so to androidExtraLibs (extracted from
  Google AI Edge Gallery 1.0.15 APKs for SM8550/SM8650/SM8750)
- Update native-v0.12.0-a android_arm64 tarball sha256
- Extract Skel libs alongside Stub libs to codeCacheDir/npu_libs/
  so FastRPC can find them via ADSP_LIBRARY_PATH
@DenisovAV DenisovAV merged commit 7dadbfd into main May 30, 2026
3 checks passed
@DenisovAV DenisovAV deleted the fix/android-npu-extract-dispatch-libs branch May 30, 2026 14:44
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