NNAPI Runtime

The NNAPI Runtime module is a shared library that sits between an app and backend drivers. The Android Neural Networks API (NNAPI) is an Android C API designed for running computationally intensive operations for machine learning on mobile devices and enables hardware-accelerated inference operations on Android devices. This module is updatable, meaning it can receive updates to functionality outside of the normal Android release cycle.

The benefits of modularizing the NNAPI Runtime include the following.

  • End users get improved consistency and compatibility.

  • Platform developers can patch bugs in the NNAPI runtime, improve NNAPI runtime interaction with drivers, and deploy new features that improve NNAPI capabilities, stability, performance, and health.

  • App developers get improved app compatibility and performance with updated CPU kernels.

Module boundary

For Android 12 and higher, the NNAPI HAL revision uses AIDL instead of HIDL.

For Android 11 and lower, the NNAPI Runtime module boundary is platform/frameworks/ml/nn:libneuralnetworks.so.

Module format

The NNAPI Runtime module (com.android.neuralnetworks) is in APEX format and is available for devices running Android 11 or higher.

Module dependences

This NNAPI Runtime module depends on the NNAPI HAL and AHardwareBuffer.

Testing

To verify the functionality of the NNAPI Runtime module, use the Android Compatibility Test Suite (CTS) and Vendor Test Suite (VTS) tests.