Skip to content

Commit 7ff622e

Browse files
committed
Update Integrator guide and FAQs
* Add steps to build Android T in IntegratorGuide Signed-off-by: Nikhil Raj <nikhil.raj@arm.com> Change-Id: Id2f4c33c50c10c31b2c9d3c76875ffaf780a6bad
1 parent b51aab9 commit 7ff622e

2 files changed

Lines changed: 14 additions & 81 deletions

File tree

docs/FAQ.md

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,6 @@ https://android.googlesource.com/platform/test/vts-testcase/hal/+/f74899c6c09b52
1717

1818
An acceptable workaround is to increase the timeout defined in AndroidTest.xml, in a similar way to https://android.googlesource.com/platform/test/vts-testcase/hal/+/f74899c6c09b52703e6db0323dffb4ae52539db4.
1919

20-
Problems seen when trying to build the android-nn-driver obtained from GitHub
21-
-----------------------------------------------------------------------------
22-
23-
Some users have encountered difficulties when attempting to build copies of the android-nn-driver obtained from GitHub. The build reports missing module source paths from armnn, clframework or flatbuffers-1.12.0.
24-
These errors can look
25-
like this:
26-
27-
'error: vendor/arm/android-nn-driver/Android.bp:45:1: variant "android_arm64_armv7": module "armnn-arm_compute" "module source path "vendor/arm/android-nn-driver/clframework/build/android-arm64v8a/src/core/CL" does not exist'
28-
29-
These errors are due to missing dependencies or incompatiblities between the android-nn-driver and armnn or clframework versions. The versions of android-nn-driver, armnn and clframework will have to match for them to work together. For example, the 22.02 version of android-nn-driver, clframework and armnn will work together but none of them will work with earlier or later versions of the others.
30-
31-
In order to ensure that the correct versions of flatbuffers, armnn and the clframework are obtained you can do the following:
32-
33-
1. Delete or move any flatbuffers, armnn or clframework directories from the android-nn-driver directory.
34-
2. Run the setup.sh script in the android-nn-driver directory.
35-
36-
This will download the correct versions of flatbuffers, armnn and the clframework and the android-nn-driver should build
37-
correctly. Alternatively you can go to the GitHub pages for android-nn-driver, armnn and computelibrary (clframework) and download versions with the same release tag.
38-
39-
As an example, for 22.02 these would be:
40-
41-
https://github.com/ARM-software/android-nn-driver/tree/v22.02
42-
https://github.com/ARM-software/armnn/tree/v22.02
43-
https://github.com/ARM-software/computelibrary/tree/v22.02
44-
45-
46-
The correct version of flatbuffers (1.12.0) can be downloaded from:
47-
48-
https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz
49-
5020
Instance Normalization test failures
5121
------------------------------------
5222

@@ -55,7 +25,7 @@ There is a known issue in the Android NNAPI implementation of Instance Normaliza
5525
VTS and CTS test failures
5626
-------------------------
5727

58-
With the release of the Android 10 R2 CTS some errors and crashes were discovered in the 19.08 and 19.11 releases of armnn, the android-nn-driver and ComputeLibrary. 19.08.01 and 19.11.01 releases of armnn, the android-nn-driver and ComputeLibrary were prepared that fix all these issues on CpuAcc and GpuAcc. If using 19.08 or 19.11 we recommend that you upgrade to the latest releases.
28+
With Android 10 R2 CTS some errors and crashes were discovered in the 19.08 and 19.11 releases of armnn, the android-nn-driver and ComputeLibrary. 19.08.01 and 19.11.01 releases of armnn, the android-nn-driver and ComputeLibrary were prepared that fix all these issues on CpuAcc and GpuAcc. If using 19.08 or 19.11 we recommend that you upgrade to the latest releases.
5929

6030
These fixes also required patches to be made to the Android Q test framework. You may encounter CTS and VTS test failures when attempting to build copies of the android-nn-driver against older versions of Android Q.
6131

docs/IntegratorGuide.md

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ This document describes how to integrate the Arm NN Android NNAPI driver into an
55

66
### Prerequisites
77

8-
1. Android source tree for Android P (we have tested against Android P version 9.0.0_r3) , in the directory `<ANDROID_ROOT>`
9-
2. Android source tree for Android Q (we have tested against Android Q version 10.0.0_r39), in the directory `<ANDROID_ROOT>`
8+
1. Android source tree for Android Q (we have tested against Android Q version 10.0.0_r39), in the directory `<ANDROID_ROOT>`
109
2. Android source tree for Android R (we have tested against Android R version 11.0.0_r3), in the directory `<ANDROID_ROOT>`
1110
3. Android source tree for Android S (we have tested against Android S version 12.0.0_r1), in the directory `<ANDROID_ROOT>`
12-
4. Mali OpenCL driver integrated into the Android source tree
11+
4. Android source tree for Android T (we have tested against Android T pre-release tag - TP1A.220624.003), in the directory `<ANDROID_ROOT>`
12+
5. Mali OpenCL driver integrated into the Android source tree
1313

1414
### Procedure
1515

@@ -21,19 +21,15 @@ To update the build environment, add to the contents of the variable `PRODUCT_PA
2121
within the device-specific makefile that is located in the `<ANDROID_ROOT>/device/<manufacturer>/<product>`
2222
directory. This file is normally called `device.mk`:
2323

24-
`Android.mk` contains the module definition of all versions (1.0, 1.1, 1.2 and 1.3) of the Arm NN driver.
25-
For Android P, a new version of NN API is available (1.1), thus the following should be added to `device.mk` instead:
26-
<pre>
27-
PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.1-service-armnn
28-
</pre>
24+
`Android.mk` contains the module definition of all versions (1.1, 1.2 and 1.3) of the Arm NN driver.
2925

3026
For Android Q, a new version of the NN API is available (1.2),
3127
thus the following should be added to `device.mk` instead:
3228
<pre>
3329
PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.2-service-armnn
3430
</pre>
3531

36-
For Android R and S, new version of the NN API is available (1.3),
32+
For Android R, S and T, new version of the NN API is available (1.3),
3733
thus the following should be added to `device.mk` instead:
3834
<pre>
3935
PRODUCT_PACKAGES += android.hardware.neuralnetworks@1.3-service-armnn
@@ -46,33 +42,24 @@ ARMNN_COMPUTE_CL_ENABLE := 1
4642
</pre>
4743

4844
For all Android versions the vendor manifest.xml requires the Neural Network HAL information.
49-
For Android P use HAL version 1.1 as below. For Android Q substitute 1.2 where necessary. For Android R and S substitute 1.3 where necessary.
45+
For Android Q use HAL version 1.2 as below. For later Android versions substitute 1.3 where necessary.
5046
```xml
5147
<hal format="hidl">
5248
<name>android.hardware.neuralnetworks</name>
5349
<transport>hwbinder</transport>
54-
<version>1.1</version>
50+
<version>1.2</version>
5551
<interface>
5652
<name>IDevice</name>
5753
<instance>armnn</instance>
5854
</interface>
59-
<fqname>@1.1::IDevice/armnn</fqname>
55+
<fqname>@1.2::IDevice/armnn</fqname>
6056
</hal>
6157
```
6258

6359
4. Build Android as normal (https://source.android.com/setup/build/building)
6460
5. To confirm that the Arm NN driver has been built, check for the driver service executable at
6561

66-
Android P
67-
<pre>
68-
<ANDROID_ROOT>/out/target/product/<product>/system/vendor/bin/hw
69-
</pre>
70-
For example, if the Arm NN driver has been built with the NN API 1.1, check for the following file:
71-
<pre>
72-
<ANDROID_ROOT>/out/target/product/<product>/system/vendor/bin/hw/android.hardware.neuralnetworks@1.1-service-armnn
73-
</pre>
74-
75-
Android Q and later has a different path:
62+
Android Q
7663
<pre>
7764
<ANDROID_ROOT>/out/target/product/<product>/vendor/bin/hw
7865
</pre>
@@ -82,9 +69,8 @@ Android Q and later has a different path:
8269
1. Run the Arm NN driver service executable in the background.
8370
Use the corresponding version of the driver for the Android version you are running.
8471
i.e
85-
android.hardware.neuralnetworks@1.1-service-armnn for Android P,
8672
android.hardware.neuralnetworks@1.2-service-armnn for Android Q and
87-
android.hardware.neuralnetworks@1.3-service-armnn for Android R and S
73+
android.hardware.neuralnetworks@1.3-service-armnn for Android R, S and T
8874
<pre>
8975
It is also possible to use a specific backend by using the -c option.
9076
The following is an example of using the CpuAcc backend for Android Q:
@@ -108,37 +94,14 @@ Rapid means that only 3 lws values should be tested for each kernel.
10894
The recommended way of using it with Arm NN 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:
10995

11096
1. Run the Arm NN driver service executable in tuning mode. The path to the tuning data must be writable by the service.
111-
The following examples assume that the 1.1 version of the driver is being used:
97+
The following examples assume that the 1.2 version of the driver is being used:
11298
<pre>
113-
adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.1-service-armnn --cl-tuned-parameters-file &lt;PATH_TO_TUNING_DATA&gt; --cl-tuned-parameters-mode UpdateTunedParameters --cl-tuning-level exhaustive &
99+
adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.2-service-armnn --cl-tuned-parameters-file &lt;PATH_TO_TUNING_DATA&gt; --cl-tuned-parameters-mode UpdateTunedParameters --cl-tuning-level exhaustive &
114100
</pre>
115101
2. 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.
116102
3. Stop the service.
117103
4. Deploy the tuned parameters file to a location readable by the Arm NN driver service (for example, to a location within /vendor/etc).
118104
5. 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):
119105
<pre>
120-
adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.1-service-armnn --cl-tuned-parameters-file &lt;PATH_TO_TUNING_DATA&gt; &
106+
adb shell /system/vendor/bin/hw/android.hardware.neuralnetworks@1.2-service-armnn --cl-tuned-parameters-file &lt;PATH_TO_TUNING_DATA&gt; &
121107
</pre>
122-
123-
124-
125-
### Troubleshooting
126-
127-
The guide assumes you have the knowledge of how to build Android from source and where to find certain files in Android source tree. But if you are having any trouble:
128-
129-
1. The vendor manifest.xml file for a hikey960 is located at android/device/linaro/hikey/manifest.xml
130-
2. The device.mk file for a hikey960 is located at device/linaro/hikey/hikey960/device-hikey960.mk
131-
132-
If you are running any tests you can also add them to the device-hikey960.mk file so that you have access to the test executable in your hikey. For example, if you are running VTS tests for Android R Hal version 1.3:
133-
134-
PRODUCT_PACKAGES += VtsHalNeuralnetworksV1_3TargetTest
135-
136-
Or if you are running NeuralNetworksTest:
137-
138-
PRODUCT_PACKAGES += NeuralNetworksTest_static
139-
140-
In some hikey960 boards you may need to set LD_LIBRARY_PATH before running the Arm NN driver service:
141-
export LD_LIBRARY_PATH=/vendor/lib64/egl:/vendor/lib/egl/
142-
143-
144-
The guide was tested on Ubuntu 18.04. If you are using a docker you may see some build issues. Explicitly setting the USER variable may help resolve these when building Android inside docker.

0 commit comments

Comments
 (0)