Skip to content
No description, website, or topics provided.
Branch: branches/andro…
Clone or download
nikraj01 IVGCVSW-3093 Update NNAPISupport.txt to reflect Depthwise_Conv2d and …
…Conv_2d changes to support Qsymm16

Change-Id: I6b9289f9ed3617d61935a6eac509379f7a8cf0e9
Signed-off-by: nikraj01 <nikhil.raj@arm.com>
Latest commit 9972b40 May 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
1.0 IVGCVSW-3125 Deprecate CreateMergerDescriptorForConcatenation function May 20, 2019
1.1 IVGCVSW-3064 Implementing our own version of the compliantWithV1_0(op… May 13, 2019
test IVGCVSW-3116 Fix failing NN Driver Tests on Android Q May 23, 2019
.gitignore Release 18.02 Mar 9, 2018
Android.bp IVGCVSW-2911 Add Android Q support to android-nn-driver infrastructure May 22, 2019
Android.mk IVGCVSW-2911 Add Android Q support to android-nn-driver infrastructure May 22, 2019
ArmnnDevice.cpp IVGCVSW-2911 Add Android Q support to android-nn-driver infrastructure May 22, 2019
ArmnnDevice.hpp IVGCVSW-1807: change license text in file headers Sep 18, 2018
ArmnnDriver.hpp IVGCVSW-1806 More Android NN Driver refactoring Sep 18, 2018
ArmnnDriverImpl.cpp IVGCVSW-2911 Work towards compatibility with Q May 7, 2019
ArmnnDriverImpl.hpp IVGCVSW-2911 Work towards compatibility with Q May 7, 2019
ArmnnPreparedModel.cpp IVGCVSW-2911 More Q compatiblity May 7, 2019
ArmnnPreparedModel.hpp IVGCVSW-2911 Work towards compatibility with Q May 7, 2019
ConversionUtils.cpp IVGCVSW-2886 Support multiple backends in Android driver Apr 4, 2019
ConversionUtils.hpp IVGCVSW-2911 Work towards compatibility with Q May 7, 2019
DriverOptions.cpp IVGCVSW-3014 Check supported backends from runtime divice spec May 3, 2019
DriverOptions.hpp IVGCVSW-3014 Check supported backends from runtime divice spec May 3, 2019
LICENSE Release 18.05 May 23, 2018
ModelToINetworkConverter.cpp IVGCVSW-2911 Work towards compatibility with Q May 7, 2019
ModelToINetworkConverter.hpp IVGCVSW-2886 Support multiple backends in Android driver Apr 4, 2019
NnapiSupport.txt IVGCVSW-3093 Update NNAPISupport.txt to reflect Depthwise_Conv2d and … May 24, 2019
README.md IVGCVSW-3138 Update README.md in android-nn-driver May 23, 2019
RequestThread.cpp IVGCVSW-2911 More Q compatiblity May 7, 2019
RequestThread.hpp IVGCVSW-2911 More Q compatiblity May 7, 2019
SystemPropertiesUtils.hpp IVGCVSW-1807: change license text in file headers Sep 18, 2018
Utils.cpp IVGCVSW-2911 Work towards compatibility with Q May 7, 2019
Utils.hpp IVGCVSW-2911 Add Android Q support to android-nn-driver infrastructure May 22, 2019
android.hardware.neuralnetworks@1.0-service-armnn.rc Release 18.02 Mar 9, 2018
android.hardware.neuralnetworks@1.1-service-armnn.rc Release 18.08 Aug 31, 2018
androidnn.go IVGCVSW-2911 Add Android Q support to android-nn-driver infrastructure May 22, 2019
service.cpp IVGCVSW-1807: change license text in file headers Sep 18, 2018
setup.sh Release 18.03 Mar 29, 2018

README.md

ArmNN Android Neural Networks driver

This directory contains the ArmNN driver for the Android Neural Networks API, implementing the android.hardware.neuralnetworks@1.0 HAL and android.hardware.neuralnetworks@1.1 HAL.

For more information about supported operations and configurations, see NnapiSupport.txt

Integration guide

Prerequisites

  1. Android source tree for Android P FSK-R3 or later, in the directory <ANDROID_ROOT>
  2. Mali OpenCL driver integrated into the Android source tree

Please Note: ArmNN Neural Networks driver does not currently support Mali OpenCL driver for Android Q.

Procedure

  1. Place this source directory at <ANDROID_ROOT>/vendor/arm/android-nn-driver
  2. Run setup.sh
  3. Update the Android build environment to add the ArmNN driver. This ensures that the driver service is built and copied to the system/vendor/bin/hw directory in the Android image. To update the build environment, add to the contents of the variable PRODUCT_PACKAGES within the device-specific makefile that is located in the <ANDROID_ROOT>/device/<manufacturer>/<product> directory. This file is normally called device.mk:

For Android P or Q, using NN API version (1.0), the following should be added to device.mk:

PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.0-service-armnn

For Android P or Q, a new version of the NN API is available (1.1), thus the following should be added to device.mk instead:

PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.1-service-armnn
`Android.mk` contains the module definition of both versions of the ArmNN driver.

Similarly, the Neon or CL backend can be enabled/disabled by setting ARMNN_COMPUTE_CL_ENABLE or ARMNN_COMPUTE_NEON_ENABLE in device.mk:

ARMNN_COMPUTE_CL_ENABLE := 1

For Android P and Android Q the vendor manifest.xml requires the Neural Network HAL information.

<hal format="hidl">
    <name>android.hardware.neuralnetworks</name>
    <transport>hwbinder</transport>
    <version>1.1</version>
    <interface>
        <name>IDevice</name>
        <instance>armnn</instance>
    </interface>
    <fqname>@1.1::IDevice/armnn</fqname>
</hal>
  1. Build Android as normal, i.e. run make in <ANDROID_ROOT>
  2. To confirm that the ArmNN driver has been built, check for driver service executable at

Android P

/out/target/product//system/vendor/bin/hw

For example, if the ArmNN driver has been built with the NN API 1.0, check for the following file:

/out/target/product//system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-armnn

Android Q has a different path:

/out/target/product//vendor/bin/hw

Testing

  1. Run the ArmNN driver service executable in the background. The following examples assume that the 1.0 version of the driver is being used:
adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-armnn &
  1. Run some code that exercises the Android Neural Networks API, for example Android's NeuralNetworksTest unit tests (note this is an optional component that must be built).
adb shell /data/nativetest/NeuralNetworksTest_static/NeuralNetworksTest_static > NeuralNetworkTest.log
  1. To confirm that the ArmNN driver is being used to service the Android Neural Networks API requests, check for messages in logcat with the ArmnnDriver tag.

Using the GPU tuner

The GPU tuner is a feature of the Compute Library that finds optimum values for GPU acceleration tuning parameters. There are three levels of tuning: exhaustive, normal and rapid. Exhaustive means that all lws values are tested. Normal means that a reduced number of lws values are tested, but that generally is sufficient to have a performance close enough to the exhaustive approach. Rapid means that only 3 lws values should be tested for each kernel. The recommended way of using it with ArmNN is to generate the tuning data during development of the Android image for a device, and use it in read-only mode during normal operation:

  1. Run the ArmNN driver service executable in tuning mode. The path to the tuning data must be writable by the service. The following examples assume that the 1.0 version of the driver is being used:
adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-armnn --cl-tuned-parameters-file <PATH_TO_TUNING_DATA> --cl-tuned-parameters-mode UpdateTunedParameters --cl-tuning-level exhaustive &
  1. Run a representative set of Android NNAPI testing loads. In this mode of operation, each NNAPI workload will be slow the first time it is executed, as the tuning parameters are being selected. Subsequent executions will use the tuning data which has been generated.
  2. Stop the service.
  3. Deploy the tuned parameters file to a location readable by the ArmNN driver service (for example, to a location within /vendor/etc).
  4. During normal operation, pass the location of the tuning data to the driver service (this would normally be done by passing arguments via Android init in the service .rc definition):
adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.0-service-armnn --cl-tuned-parameters-file <PATH_TO_TUNING_DATA> &

License

The android-nn-driver is provided under the MIT license. See LICENSE for more information. Contributions to this project are accepted under the same license.

Individual files contain the following tag instead of the full license text.

SPDX-License-Identifier: MIT

This enables machine processing of license information based on the SPDX License Identifiers that are available here: http://spdx.org/licenses/

You can’t perform that action at this time.