Skip to main content

Overview

Execution providers enable hardware acceleration for faster inference and lower power consumption. React-native-sherpa-onnx supports:
QNN Runtime Libraries Not IncludedFor license reasons, this SDK does not include Qualcomm QNN runtime libraries. To use QNN acceleration, you must:
  1. Download the Qualcomm AI Runtime (accept license)
  2. Copy runtime .so files to your app’s jniLibs
  3. Include Qualcomm notices in your app’s legal/credits
See Adding QNN Runtime Libs below.

Quick Start: Check and Use Acceleration

Check QNN Support (Qualcomm NPU)

Check NNAPI Support (Android)

Check Core ML Support (iOS)

Check Available Providers

Adding QNN Runtime Libs

Step 1: Download Qualcomm AI Runtime

  1. Go to Qualcomm AI Runtime Community
  2. Accept the license agreement
  3. Download the SDK for your development platform

Step 2: Copy Runtime Libraries

Extract and copy the following .so files to your app’s jniLibs per ABI: Required libraries:
  • libQnnHtp.so
  • libQnnHtpV*Stub.so (multiple versions: V68, V69, V73, V75, V79, V81)
  • libQnnHtpV*Skel.so (multiple versions: V68, V69, V73, V75, V79, V81)
  • libQnnHtpPrepare.so
  • libQnnSystem.so
  • libQnnCpu.so (optional, for CPU fallback)
Destination:
See sherpa-onnx QNN guide for the exact list of required files.

Step 3: Rebuild and Test

Rebuild your app:
Test QNN support:

Step 4: Include License Notices

Add Qualcomm’s copyright and license notice to your app’s legal/credits section. The notice is in the QNN SDK LICENSE file.
Redistribution Requirements:The Qualcomm AI Stack License permits you to distribute QNN runtime libraries only:
  1. In object code (no source)
  2. As part of your application (not standalone)
  3. With proper attribution and notices
Do not remove Qualcomm’s copyright or proprietary notices from the libraries.

AccelerationSupport Format

All support checks return the same structure:

Understanding the Fields

Use canInit to decide if you can use the provider. It’s the most reliable indicator that the provider will work for your models.

API Reference

getQnnSupport(modelBase64?)

Check QNN (Qualcomm NPU) support.
Parameters:
  • modelBase64?: Base64-encoded ONNX model to test (optional; uses embedded test model if omitted)
Returns: Promise<AccelerationSupport>

getNnapiSupport(modelBase64?)

Check NNAPI (Android Neural Networks API) support.
Parameters:
  • modelBase64?: Base64-encoded ONNX model to test (optional)
Returns: Promise<AccelerationSupport>
Why hasAccelerator: false but canInit: true?
  • hasAccelerator checks if the NDK reports a dedicated accelerator device (GPU/DSP/NPU)
  • canInit checks if ONNX Runtime can create a session with NNAPI
NNAPI can run on CPU even when no accelerator is reported. Use canInit to decide if you can use provider: 'nnapi'.

getXnnpackSupport(modelBase64?)

Check XNNPACK (CPU-optimized) support.
Parameters:
  • modelBase64?: Base64-encoded ONNX model to test (required for meaningful canInit)
Returns: Promise<AccelerationSupport>
hasAccelerator is true when XNNPACK is compiled (CPU-optimized, not hardware acceleration).

getCoreMlSupport(modelBase64?)

Check Core ML (iOS) support.
Parameters:
  • modelBase64?: Base64-encoded ONNX model to test (not used; reserved for future)
Returns: Promise<AccelerationSupport>

getAvailableProviders()

List ONNX Runtime execution providers in the current build.
Returns: Promise<string[]>

Using Providers with STT/TTS

Pass the provider option when creating engines:

STT with QNN

STT with NNAPI

TTS with Core ML

Streaming STT with QNN

Provider Selection Strategy

Recommended provider selection order:

Performance Comparison

Typical speedup over CPU (device-dependent):
Actual performance depends on:
  • Model architecture and size
  • Device chipset and generation
  • Thermal conditions
  • OS version

Troubleshooting

Possible causes:
  • QNN runtime libs not added to jniLibs
  • Device doesn’t have Qualcomm chipset
  • QNN backend initialization failed (unsupported SoC or driver)
Solution:
This is normal. NNAPI can work without a dedicated accelerator (runs on CPU through NNAPI).Use canInit to decide if you can use NNAPI. hasAccelerator only indicates if the device reports a GPU/DSP/NPU.
Some operations may not be supported by hardware EPs:
  • Try a different model
  • Check if the model is compatible with the provider
  • Fallback to CPU for unsupported models
Apple Neural Engine requires:
  • A12 chip or later (iPhone XS/XR and newer)
  • iOS 15+ for reliable detection
Simulator always returns false for ANE.
This can happen when:
  • Model is very small (overhead outweighs benefit)
  • First run (initialization overhead)
  • Thermal throttling
Benchmark over multiple runs to get accurate results.

Testing Provider Performance

Benchmark different providers:

Next Steps

Speech-to-Text

Use hardware acceleration with STT

Text-to-Speech

Use hardware acceleration with TTS

Model Setup

Learn how to bundle and load models

Streaming STT

Real-time recognition with acceleration