Commit graph

1027 commits

Author SHA1 Message Date
Michael Butler
73e470235d Remove isUpdatable query from NNAPI -- hal
The NNAPI originally planned to have updated platform drivers delivered
through GMSCore. These updatable drivers would be retrieved through the
NN sAIDL utility code, and were known to be updatable through
Manager.cpp's Device::isUpdatable query.

However, the NNAPI ultimately did not move forward with its updatability
plans. This CL removes the updatability check in the NN AIDL utility
code.

Bug: N/A
Test: mma
Test: CtsNNAPITestCases
Test: NeuralNetworksTest_static
Change-Id: I6f9c1eac3af8cb54565bfaaeab7ddd382a85e3bd
2022-02-14 19:21:38 -08:00
Michael Butler
6f497d1833 Clamp NNAPI HAL Version to runtime version -- hal
The NNAPI is a Mainline Module, and its runtime version is determined by
an Android Feature Flag to remotely rollout and rollback Feature Levels
as needed. This change propagates the maximum feature level version
allowed by the runtime to the HAL utility code, and clamps the utility
code's version to the version allowed by the runtime.

Bug: N/A
Test: mma
Test: CtsNNAPITestCases
Test: NeuralNetworksTest_static
Test: logged driver version, set current_feature_level, and verified the
      driver version was clamped by current_feature_level
Change-Id: Ibaa895f8e35d36b2ddf9432b3ef9468e5886075f
2022-02-14 19:21:09 -08:00
Xusong Wang
f5ad7c56c9 Merge "Address ANAPIC review comments -- hal." am: 8b389e1123 am: 706652c817 am: cfa3838085 am: aba49d0512
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1957303

Change-Id: I88834c87adc1958cfd6cc68929d38eaad43c2d93
2022-02-09 19:47:27 +00:00
Xusong Wang
8805b2d67c Address ANAPIC review comments -- hal.
- Document that IPreparedModel::execute*WithConfig are for single-time
  usages, and IPreparedModel::createReusableExecution is for reusable
  usages.
- Make PrepareModelConfig::cacheToken a fixed sized array.

Fixes: 215566186
Test: VtsHalNeuralnetworksTargetTest
Test: NNT_static
Change-Id: I9c5a49c46a3eac2828b9eb666f3d742038493121
2022-02-07 14:02:41 -08:00
Michael Butler
e599ad0443 Merge "Move NNAPI HAL CommonUtils to nnapi/SharedMemory -- hal" am: ea3e90c1f1 am: 0d612d723b am: f288828f8e am: 67a0cba6b5
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1966388

Change-Id: Ie8eccccc4d97287b776cf786d146f4cf80f1edc5
2022-02-01 23:27:28 +00:00
Michael Butler
6b0905cb69 Move NNAPI HAL CommonUtils to nnapi/SharedMemory -- hal
This CL relocates utility code that transfers data between pointer-based
memory and shared memory for Request objects and Model objects, moving
it from nnapi/hal/CommonUtils.h (hal utilities) to nnapi/SharedMemory.h
(canonical library).

This change also adds a check for whether Model and Requests have
pointer-based data in neuralnetworks/aidl/utils/src/Conversions.cpp to
make it consistent with the HIDL utility conversions.

Bug: 217217023
Test: mma
Test: presubmit
Change-Id: I55a0fea186708d806bc709681e10027a9e4b0ffb
2022-01-31 19:26:57 +00:00
Michael Butler
0e6671e908 Merge "Make VtsHalNeuralnetworksTargetTest run on the host" am: 8f255182ec am: ca13a2b719 am: c5699bca62 am: b81e3f351c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1946651

Change-Id: I34ce4c7d79fe86d57399daf363178d436e227fc2
2022-01-22 00:25:18 +00:00
Michael Butler
d0d9a7abac Make VtsHalNeuralnetworksTargetTest run on the host
This change adds a host build of VtsHalNeuralnetworksTargetTest. In the
existing device build of VtsHalNeuralnetworksTargetTest, the drivers run
out-of-process. In the host build of VtsHalNeuralnetworkaTargetTest, the
driver runs in-process.

The in-process driver that runs on the host is the canonical sample
driver (which is just the CPU "driver", located in
packages/modules/NeuralNetworks/driver/sample) adapted to an AIDL
interface (by the adapter code in
hardware/interfaces/neuralnetworks/utils/adapter/aidl).

Bug: N/A
Test: mma
Test: VtsHalNeuralnetworksTargetTest on host
Change-Id: Ia30dd3a7db8e0592b9f13d69c9831f8ffe10c371
2022-01-21 21:04:50 +00:00
Michael Butler
e0a93293c4 Merge "Cleanup NN utility libraries' dependencies" am: d3e413e759 am: fd0636d14b am: b3d989c805 am: 2dddfa7d4a
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1950217

Change-Id: Ibf979c129b008a94d1b729e84cc2e338624e176b
2022-01-21 00:42:42 +00:00
Michael Butler
d3e413e759 Merge "Cleanup NN utility libraries' dependencies" 2022-01-20 23:36:09 +00:00
Michael Butler
9257d6d06d Cleanup NN utility libraries' dependencies
Bug: N/A
Test: mma
Change-Id: I0243c477098d9a2de28ca78bfde155d3ecb5acb6
2022-01-20 12:31:38 -08:00
Miao Wang
b5c8a82f25 HAL interface for compilation and execution hints
The following AIDL types are added:
 - TokenValuePair
 - PrepareModelConfig
 - ExecutionConfig

The following AIDL methods are added:
 - IDevice::prepareModelWithConfig
 - IPreparedModel::executeSynchronouslyWithConfig
 - IPreparedModel::executeFencedWithConfig
 - IBurst::executeSynchronouslyWithConfig

The compilation and execution hints are being stored as a list of
token-value pairs as part of the PrepareModelConfig / ExecutionConfig.
And the PrepareModelConfig / ExecutionConfig parcelables are created in
order to make future extensions to the execution related interfaces
easier.

It is the drivers responsibility to verify the hints, and it is allowed
for the driver to ignore them.

Bug: 203248587
Test: neuralnetworks_utils_hal_aidl_test
Change-Id: I98240fd75089fc85cdfcaa0be28aab8a6f0dfca5
Merged-In: I98240fd75089fc85cdfcaa0be28aab8a6f0dfca5
(cherry picked from commit 0e671f3edb)
2022-01-20 16:48:40 +00:00
Miao Wang
0e671f3edb HAL interface for compilation and execution hints
The following AIDL types are added:
 - TokenValuePair
 - PrepareModelConfig
 - ExecutionConfig

The following AIDL methods are added:
 - IDevice::prepareModelWithConfig
 - IPreparedModel::executeSynchronouslyWithConfig
 - IPreparedModel::executeFencedWithConfig
 - IBurst::executeSynchronouslyWithConfig

The compilation and execution hints are being stored as a list of
token-value pairs as part of the PrepareModelConfig / ExecutionConfig.
And the PrepareModelConfig / ExecutionConfig parcelables are created in
order to make future extensions to the execution related interfaces
easier.

It is the drivers responsibility to verify the hints, and it is allowed
for the driver to ignore them.

Bug: 203248587
Test: neuralnetworks_utils_hal_aidl_test
Change-Id: I98240fd75089fc85cdfcaa0be28aab8a6f0dfca5
2022-01-20 05:24:48 +00:00
David Gross
810aaa0a8d FL7: Refine MIRROR_PAD specification
Test: N/A

Bug: 202280925
Merged-In: If19d45d806f6ba33f9aa6c7af9bc411957cdc706
Change-Id: If19d45d806f6ba33f9aa6c7af9bc411957cdc706
(cherry picked from commit 4718025a6c)
2022-01-19 14:27:06 -08:00
David Gross
146b38685a FL7: Refine REVERSE specification
Test: N/A

Bug: 202280925

Merged-In: Iae1f177254023c750c701e6594a61f3958de538c
Change-Id: Iae1f177254023c750c701e6594a61f3958de538c
(cherry picked from commit 91a30c1cea)
2022-01-19 14:27:06 -08:00
David Gross
da4682aa6f FL7: Add some AIDL_V3 test infrastructure
Test: atest VtsHalNeuralnetworksTargetTest -- --test-arg com.android.tradefed.testtype.GTest:native-test-flag:"--gtest_filter=*abs*:*floor*:*log*:*rsqrt*:*sin*:*sqrt*"

Bug: 202280925
Merged-In: I848add0ddb94e1500a5d4d6af5d51ddf5ebba045
Change-Id: I848add0ddb94e1500a5d4d6af5d51ddf5ebba045
(cherry picked from commit 8e9fbfc592)
2022-01-19 14:27:05 -08:00
David Gross
061d3411c8 Freeze neuralnetworks AIDL version as v3 for FL7
$ m android.hardware.neuralnetworks-update-api
$ m android.hardware.neuralnetworks-freeze-api

(This cherry pick required hand editing to ensure makefile
references are changed from
android.hardware.neuralnetworks-V2-ndk_platform to
android.hardware.neuralnetworks-V3-ndk_platform.)

Bug: 202280925

Test: adb shell NeuralNetworksTest_static
Test: atest VtsHalNeuralnetworksTargetTest
Merged-In: I2b2755d7376bb847b15b395e280bf352b5b9ef55
Change-Id: I2b2755d7376bb847b15b395e280bf352b5b9ef55
(cherry picked from commit 68e4300c72)
2022-01-19 14:26:19 -08:00
David Gross
88ec0799db Add NNAPI specification and infrastructure for FL7.
Adds operations MIRROR_PAD and REVERSE.
Extends RSQRT to support QUANT8_ASYMM and QUANT8_ASYMM_SIGNED.

DOES NOT include tests or CPU reference implementation.

(This is a slightly non-trivial cherry pick that had to be
hand-edited to compensate for the fact that certain nn::Version
changes and makefile restructurings are absent from the target branch.)

Bug: 202280917

Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksTargetTest

Merged-In: I0b2133346b996849faac00c46885e3633c78f024
Change-Id: I0b2133346b996849faac00c46885e3633c78f024
(cherry picked from commit 04ed8595b5)
2022-01-19 14:20:48 -08:00
Xusong Wang
72e06c2843 Add VTS tests for reusable execution.
- Modified generated tests and validation tests to exercise reusable
execution.
- Add a scoped trace to print the test config when an error occurs

Bug: 202405342
Bug: 202431255
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I3e2346903e430080ec4d926bf08daf6825ea4dce
Merged-In: I3e2346903e430080ec4d926bf08daf6825ea4dce
(cherry picked from commit 859200800c)
2022-01-19 08:00:08 -08:00
Xusong Wang
11f30c81ef Reusable execution at HAL level -- HAL.
This CL modifies the canonical/AIDL adapter to use IExecution object
if available.

Bug: 202405342
Bug: 202431255
Test: NNT_static
Test: CtsNNAPITestCases
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I6aac3c57f97ac87a5ba3f78cfd843fcc403decff
Merged-In: I6aac3c57f97ac87a5ba3f78cfd843fcc403decff
(cherry picked from commit 7f5c7d293c)
2022-01-18 10:51:29 -08:00
Xusong Wang
018fc3cac8 Define AIDL reusable execution interface.
This CL defines the AIDL interface for reusable execution.

This CL also fixes a stale statement in IBurst about deadlineNs:
boot_clock should be used rather than steady_clock.

Bug: 202405342
Bug: 202431255
Test: NNT_static
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I07d26909081018ffd92264d76109a66d4a0de3bd
Merged-In: I07d26909081018ffd92264d76109a66d4a0de3bd
(cherry picked from commit 0d9b1a9d28)
2022-01-18 10:49:42 -08:00
Xusong Wang
859200800c Add VTS tests for reusable execution.
- Modified generated tests and validation tests to exercise reusable
execution.
- Add a scoped trace to print the test config when an error occurs

Bug: 202405342
Bug: 202431255
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I3e2346903e430080ec4d926bf08daf6825ea4dce
2022-01-18 10:03:49 -08:00
Xusong Wang
7f5c7d293c Reusable execution at HAL level -- HAL.
This CL modifies the canonical/AIDL adapter to use IExecution object
if available.

Bug: 202405342
Bug: 202431255
Test: NNT_static
Test: CtsNNAPITestCases
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I6aac3c57f97ac87a5ba3f78cfd843fcc403decff
2022-01-14 15:29:01 -08:00
Xusong Wang
0d9b1a9d28 Define AIDL reusable execution interface.
This CL defines the AIDL interface for reusable execution.

This CL also fixes a stale statement in IBurst about deadlineNs:
boot_clock should be used rather than steady_clock.

Bug: 202405342
Bug: 202431255
Test: NNT_static
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I07d26909081018ffd92264d76109a66d4a0de3bd
2022-01-14 14:58:24 -08:00
David Gross
6eef5c1ef8 Merge "Freeze neuralnetworks AIDL version as v3 for FL7" am: 3e6d04f6df am: b81359e293 am: 9894d5625f am: 112d1a22f1
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1947667

Change-Id: Ia846557ffc6b8a0b5e897690e75aed2950bfbd23
2022-01-13 18:41:04 +00:00
David Gross
3e6d04f6df Merge "Freeze neuralnetworks AIDL version as v3 for FL7" 2022-01-13 17:51:42 +00:00
David Gross
68e4300c72 Freeze neuralnetworks AIDL version as v3 for FL7
$ m android.hardware.neuralnetworks-update-api
$ m android.hardware.neuralnetworks-freeze-api

Bug: 202280925

Test: adb shell NeuralNetworksTest_static
Test: atest VtsHalNeuralnetworksTargetTest
Change-Id: I2b2755d7376bb847b15b395e280bf352b5b9ef55
2022-01-12 14:18:36 -08:00
Michael Butler
475a7ba71a Merge changes Ifeffea05,I966f65a1 am: 104192c28f am: ca40766dd6 am: c0bceee092 am: d038448af8
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1944552

Change-Id: If3fb99d21670277bcf99f54d7f064d792e4ee0cc
2022-01-12 21:18:06 +00:00
Michael Butler
594cc78a7b Remove uid from NN HIDL adapter
Having the adapter retrieve the uid is redundant because the implementor
is already able to get the uid directly themselves with
IPCThreadState::self()->getCallingUid().

Bug: N/A
Test: mma
Change-Id: Ifeffea053cb92556be1aae8b17a94fafa1ac98e0
2022-01-11 22:59:11 -08:00
Michael Butler
534556391a Create NN AIDL adapter
This change adds the following adapters:
* nn::IDevice -> BnDevice
* nn::IPreparedModel -> BnPreparedModel
* nn::IBurst -> BnBurst
* nn::IBuffer -> BnBuffer

Bug: N/A
Test: mma
Test: locally created a binderized service with this adapter code,
      which passed VtsHalNeuralnetworksTargetTest
Change-Id: I966f65a1e4d75284c050b77f3f40c515e4970130
2022-01-11 22:23:31 -08:00
David Gross
3d3884621a Merge "FL7: Refine MIRROR_PAD specification" am: f914da59a6 am: 7dc880a386 am: e22d6fbd77 am: 072433f545
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1940673

Change-Id: I96262f815d9a0296cdf9311c1b585575d2f5296d
2022-01-10 18:12:28 +00:00
David Gross
f914da59a6 Merge "FL7: Refine MIRROR_PAD specification" 2022-01-10 17:11:26 +00:00
David Gross
4718025a6c FL7: Refine MIRROR_PAD specification
Test: N/A

Bug: 202280925
Change-Id: If19d45d806f6ba33f9aa6c7af9bc411957cdc706
2022-01-07 14:56:03 -08:00
Michael Butler
dab865c1d3 Merge "Update NNAPI owners file" am: 69e8cc44f4 am: 5272d38dbf am: 1edafa3398 am: a71831984b
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1936283

Change-Id: I524ff773e8285e0aa2654d1160d1ebfb6035307a
2022-01-05 19:53:55 +00:00
Michael Butler
69e8cc44f4 Merge "Update NNAPI owners file" 2022-01-05 18:24:13 +00:00
Michael Butler
1957c684de Merge "Fix NNAPI HIDL 1.3 VTS MemoryDomainExecutionTest" am: 97a7435d5f am: 3248647a41 am: 1a97eee58c am: e230fb1a19
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1936397

Change-Id: Ieab14397cdc4041c1c976a46c74f9f72b318d322
2022-01-04 22:27:59 +00:00
Michael Butler
77414ebf5a Fix NNAPI HIDL 1.3 VTS MemoryDomainExecutionTest
MemoryDomainTests.cpp#1131 in aosp/13591469 fixed a problem with
VtsHalNeuralnetworksTargetTest's MemoryDomainExecutionTest's
InvalidDimensions test where a dimension was doubled but the number of
bytes and size of shared memory did not double, but this change was not
ported to VtsHalNeuralnetworksV1_3TargetTest. This CL ports that fix to
VtsHalNeuralnetworksV1_3TargetTest.

Bug: 213197824
Test: mma
Test: VtsHalNeuralnetworksV1_3TargetTest
Change-Id: Ib7323e584c17ab230bde71487c0b94349701ec57
2022-01-04 21:21:17 +00:00
Michael Butler
fb43bf28c9 Update NNAPI owners file
This change includes the NNAPI_OWNERS file from
packages/modules/NeuralNetworks instead of unnecessarily duplicating the
OWNERS file here.

Bug: N/A
Test: mma
Change-Id: I52daeb8f6ba91e0ec19b18fa9a6b2eda2fcb124e
2022-01-04 09:45:05 -08:00
David Gross
2569d1aa4a Merge "FL7: Refine REVERSE specification" am: dd26914af7 am: d90a3fdb5a am: 84924a175d am: 6c9a09cdc5
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1915765

Change-Id: I5b3abc55ef5986a8bbcc5fe102e200d2944029fd
2021-12-10 23:19:26 +00:00
David Gross
2a889d50b7 Freeze neuralnetworks AIDL version as v2 for FL6
$ m android.hardware.neuralnetworks-update-api
$ m android.hardware.neuralnetworks-freeze-api

Cherrypicked from I35dbd32695acdffc552790dc7396bc8c724e9242

Bug: 206089870

Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I35dbd32695acdffc552790dc7396bc8c724e9242
Merged-In: I35dbd32695acdffc552790dc7396bc8c724e9242
2021-12-10 16:19:42 +00:00
Ian Hua
23d4e5e298 Add FL6 spec tests to AIDL VTS.
Also skip FL6 (AIDL_V2) tests for older AIDL drivers.

Cherrypicked from I689fef0945428f6548977628e3c43628dd1e5bf7

Bug: 206089870
Test: VtsHalNeuralnetworksTargetTest
Specifically, for old driver such as AIDL_V1 sample driver, it can pass
HIDL tests and skip AIDL_V2 tests. For new driver such as AIDL_V2
sample driver, it can pass all tests.

Change-Id: I689fef0945428f6548977628e3c43628dd1e5bf7
2021-12-10 16:19:19 +00:00
David Gross
0af4ac2ec4 Add PACK operation to NNAPI feature level 6.
Cherrypicked from Ic15d047b70c62437b4f0db6f2ca10127591ae07c

Bug: 206089870

Test: m -j NeuralNetworksTest_static
Test: VtsHalNeuralnetworksTargetTest

Change-Id: Ic15d047b70c62437b4f0db6f2ca10127591ae07c
2021-12-10 16:18:25 +00:00
Ian Hua
aaeda0e84f AIDL interface changes for NNAPI feature level 6.
- Add BATCH_MATMUL operation
- Support TENSOR_INT32 for RESHAPE operation.

Also update "current" version snapshot and use
android.hardware.neuralnetworks-V2-ndk since AIDL v1 has been frozen.

Cherrypicked from Iabe45c57e2306d61055f711eda03b80b9cbe906d

Bug: 206089870
Test: mm
Change-Id: Iabe45c57e2306d61055f711eda03b80b9cbe906d
Merged-In: Iabe45c57e2306d61055f711eda03b80b9cbe906d
2021-12-10 16:17:59 +00:00
David Gross
91a30c1cea FL7: Refine REVERSE specification
Test: N/A

Bug: 202280925

Change-Id: Iae1f177254023c750c701e6594a61f3958de538c
2021-12-08 16:55:51 -08:00
David Gross
cbf10f9cd2 Merge "FL7: Add some AIDL_V3 test infrastructure" am: 8f7ecd2d50 am: 7e1d2a294e am: 1812477791 am: beb2a43439
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1909591

Change-Id: I693bb9ed6cbc0d974dc860d6db2c1201eebea904
2021-12-06 21:06:16 +00:00
David Gross
8e9fbfc592 FL7: Add some AIDL_V3 test infrastructure
Test: atest VtsHalNeuralnetworksTargetTest -- --test-arg com.android.tradefed.testtype.GTest:native-test-flag:"--gtest_filter=*abs*:*floor*:*log*:*rsqrt*:*sin*:*sqrt*"

Bug: 202280925
Change-Id: I848add0ddb94e1500a5d4d6af5d51ddf5ebba045
2021-12-02 15:39:33 -08:00
David Gross
2edfc467f1 Add NNAPI specification and infrastructure for FL7.
Adds operations MIRROR_PAD and REVERSE.
Extends RSQRT to support QUANT8_ASYMM and QUANT8_ASYMM_SIGNED.

DOES NOT include tests or CPU reference implementation.

Bug: 202280917

Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksTargetTest

Merged-In: I0b2133346b996849faac00c46885e3633c78f024
Change-Id: I0b2133346b996849faac00c46885e3633c78f024
(cherry picked from commit 04ed8595b5)
2021-11-22 14:41:51 -08:00
David Gross
04ed8595b5 Add NNAPI specification and infrastructure for FL7.
Adds operations MIRROR_PAD and REVERSE.
Extends RSQRT to support QUANT8_ASYMM and QUANT8_ASYMM_SIGNED.

DOES NOT include tests or CPU reference implementation.

Bug: 202280917

Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksTargetTest

Change-Id: I0b2133346b996849faac00c46885e3633c78f024
2021-11-22 11:15:01 -08:00
Michael Butler
5203cd1d67 Merge "Rename Version::ANDROID_* to kVersionFeatureLevel* -- hal" am: 8f6b82c7a5 am: 58b61dbce0 am: b79dc03c81 am: 0092aefaa2
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1896056

Change-Id: If1e0c76bcba7fac6d69bdef6d7b0810292cd6b39
2021-11-19 03:56:02 +00:00
Michael Butler
c6bbc28165 Merge "Make NNAPI Version more structured -- hal" am: 71b595549c am: a9ebf76162 am: 4d7093ecd2 am: 22c9336428
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1890277

Change-Id: I94b642c7f2b14594bf0e37628cd22b362e562eee
2021-11-19 01:04:53 +00:00
Michael Butler
60a7b86cf0 Rename Version::ANDROID_* to kVersionFeatureLevel* -- hal
Prior to this change, version constants (e.g., Version::ANDROID_S) were
public static constants to make the version constants look as if they
were enum values. However, this method prevented versions from being
constexpr, because the Version type was incomplete by that point in
time. This change moves these version constants outside of the Version
struct, and makes them constexpr. They have the new names:
* Version::ANDROID_OC_MR1 -> kVersionFeatureLevel1
* Version::ANDROID_P -> kVersionFeatureLevel2
* Version::ANDROID_Q -> kVersionFeatureLevel3
* Version::ANDROID_R -> kVersionFeatureLevel4
* Version::ANDROID_S -> kVersionFeatureLevel5
* Version::FEATURE_LEVEL_6 -> kVersionFeatureLevel6
* Version::EXPERIMENTAL -> kVersionFeatureLevelExperimental

Bug: 206975939
Test: mma
Change-Id: Ibf5f2fdb1459a69c51865aa5fdcd0cb0c3a88ade
2021-11-18 23:56:54 +00:00
Michael Butler
34f0a8f418 Make NNAPI Version more structured -- hal
Prior to this topic, NNAPI Versions were linear and represented by an
enumeration. However, this did not properly account for the
non-linearity of runtime-specific features such as a control flow
operations with operands of dynamic sizes. This topic alters Version to
be a struct containing a feature level enumeration as well as a boolean
which indicates whether there are runtime-specific features.

Bug: 206975939
Test: mma
Test: NeuralNetworksTests_static
Change-Id: I78c54ef597bf269b137f2835332bdedac49883d4
2021-11-18 23:56:15 +00:00
Michael Butler
51ac1e9793 Merge "Configure Version value for each version of NN AIDL utils" am: 21e079c9e2 am: a0c2165144 am: 99aea2fe82 am: 04f63c1e18
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1890278

Change-Id: I02759b48d6d5972ea549dfd7039914e898488060
2021-11-16 20:52:13 +00:00
Michael Butler
21e079c9e2 Merge "Configure Version value for each version of NN AIDL utils" 2021-11-16 19:30:51 +00:00
Michael Butler
11b7f63991 Merge "Consolidate NNAPI OWNERS files" am: 161883c967 am: 3e31733ee7 am: c8d5b0599c am: 43b5f0f221
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1892878

Change-Id: I4e3d5b838727a8cc152a93fecad0e5e3f3997f31
2021-11-16 00:25:33 +00:00
Michael Butler
20f76f3654 Configure Version value for each version of NN AIDL utils
Currently, there are two different versions of the NN AIDL utils:
* neuralnetworks_utils_hal_aidl_v1 (v1)
* neuralnetowrks_utils_hal_aidl (v2)

This change configures utils::kVersion to match the version of the
utility library that builds it.

Bug: N/A
Test: mma
Change-Id: I7d08bf50f76664702ec0828cc35a363eb29bdde3
2021-11-15 15:42:28 -08:00
Michael Butler
acd7955b21 Consolidate NNAPI OWNERS files
This change deletes all existing OWNERS files under
hardware/interfaces/neuralnetworks and creates a new OWNERS file with
the current NNAPI team members.

This change also updates the NNAPI project path in
hardware/interfaces/neuralnetworks/README.

Bug: 179510251
Test: N/A
Change-Id: Iaca69505c8449ae7d93be0db99205f5f56556e86
2021-11-15 20:22:41 +00:00
Ian Hua
162753ba0b Merge "Freeze neuralnetworks AIDL version as v2 for FL6" am: 2a7b0014a7 am: d42d9f7f4b am: 80b9eaa419 am: e3b6aea7c8 am: 0d395bd674
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1880612

Change-Id: Ia090d08fb8f2476c0a5061cf2fe338221cfe6b34
2021-11-10 12:03:12 +00:00
Ian Hua
2a7b0014a7 Merge "Freeze neuralnetworks AIDL version as v2 for FL6" 2021-11-10 10:51:18 +00:00
Michael Butler
698f81e2b3 Merge "Remove unnecessary NNAPI header files" am: 9ec39aa042 am: 340e03f4b9 am: 970d671c9b am: b40584fd8e am: 53b8aa9d99
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1880752

Change-Id: Ic5e925237786260eca1890de6f23e252c12454a2
2021-11-09 03:28:33 +00:00
Michael Butler
2ffa7ad391 Remove unnecessary NNAPI header files
This change removes the following header files, which were created
temporarily while NNAPI utility code was being re-organized, and are no
longer needed:
* include/AidlBufferTracker.h
* include/AidlHalInterfaces.h
* include/AidlHalUtils.h
* include/AidlValidateHal.h

Bug: 191442336
Test: mma
Test: atest neuralnetworks_utils_hal_*
Change-Id: I895d0bf6b5fd0ec4ef2977da0ecfe2a106e44083
2021-11-05 12:26:01 -07:00
David Gross
7e2e6b33a4 Freeze neuralnetworks AIDL version as v2 for FL6
$ m android.hardware.neuralnetworks-update-api
$ m android.hardware.neuralnetworks-freeze-api

Bug: 203055646

Test: NeuralNetworksTest_static
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I35dbd32695acdffc552790dc7396bc8c724e9242
2021-11-04 10:11:16 -07:00
Michael Butler
044b1271ef Merge changes from topic "libneuralnetworks_common-cleanup" am: ee7a476090 am: f3ac53fa2a am: 14c577fc22 am: 882338aeaa am: 036adec109
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1878019

Change-Id: Ia81a3ad625e2ec3ff70501b70c3bd36d751e9873
2021-11-03 20:01:02 +00:00
Michael Butler
8bd6cccf20 Move Aidl utility code to aidl/utils -- hal 1/2 am: 8fa5383407 am: 937d71b102 am: 4b45b7b234 am: f8eee4fe1b am: cb1285dc8c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1878018

Change-Id: I7d695306a8906ce4acd16da67a5a6bc903415113
2021-11-03 20:01:00 +00:00
Michael Butler
937d71b102 Move Aidl utility code to aidl/utils -- hal 1/2 am: 8fa5383407
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1878018

Change-Id: I4dc6f6a75e1643ddb9fd1e673dedde70e366fff5
2021-11-03 18:47:28 +00:00
Michael Butler
ee7a476090 Merge changes from topic "libneuralnetworks_common-cleanup"
* changes:
  Move Aidl utility code to aidl/utils -- hal 2/2
  Move Aidl utility code to aidl/utils -- hal 1/2
2021-11-03 18:14:06 +00:00
Michael Butler
24d95273f2 Merge changes Ibd460229,I589668ef am: 7815893786 am: 00e983df29 am: 7f9d146254 am: 5de3d44e0b am: c11d2b1770
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1877839

Change-Id: Icd2085d4f5a425067c13d0e6b161bfc560b18624
2021-11-02 21:56:34 +00:00
Michael Butler
c331067aac Move Aidl utility code to aidl/utils -- hal 2/2
This change is part of an effort to remove HAL types from
libneuralnetworks_common*. This change:
* Updates the header guard names for the new directory
* Removes the "Aidl" prefix from the files
* Adds temporary "Aidl" header files under include/ that redirect to
   their corresponding files in include/nnapi/hal/aidl/
* Changes references of libneuralnetworks_common_hidl to
   libneuralnetworks_common

Bug: 191442336
Test: mma
Change-Id: Icbcc04e0a49a9adf8d8826fd5735028ea26de0ca
2021-11-01 21:34:53 -07:00
Michael Butler
8fa5383407 Move Aidl utility code to aidl/utils -- hal 1/2
This change is part of an effort to remove HAL types from
libneuralnetworks_common*. This change moves the following files to
hardware/interfaces/neuralnetworks/aidl/utils:
* AidlBufferTracker.h
* AidlHalInterfaces.h
* AidlHalUtils.h
* AidlValidateHal.h

Bug: 191442336
Test: mma
Change-Id: I799d8ba761c004af963fc6bc044125d8828f2053
2021-11-01 21:34:49 -07:00
Michael Butler
137ee99a16 Re-organize NNAPI Burst utility classes
This change:
* Renames ExecutionBurstController to Burst in 1.2/utils
* Renames ExecutionBurstUtils to BurstUtils in 1.2/utils
* Renames ExecutionBurstServer to Burst in common/adapter

Bug: N/A
Test: mma
Change-Id: Ibd460229887c8c9cd23ebc6ee61da37c7c820288
2021-11-01 16:40:31 -07:00
Michael Butler
cfc16f94b2 Change NN adapter to use ExecutionBurstServer utility
Bug: 180492058
Bug: 177267324
Test: mma, presubmit
Change-Id: I589668efe187641a67934463bcdea8d19f095bb4
2021-11-01 14:48:48 -07:00
Michael Butler
abc86918ae Revert^2 "Provide explicitly versioned NNAPI AIDL utils libs -- HAL."
Reason for revert: rollforward fix of this topic

This change is a revert of I3d3ac4745, which itself is a revert of
I74f1798e8.

This CL modifies the AIDL utils libraries to be explicitly
versioned. Currently, we only have two versions: v1 and "current".
Specifically, the following changes are made:
- Remove AIDL dependencies from neuralnetworks_utils_hal_common
- Create explicitly versioned libs of neuralnetworks_utils_hal_aidl*

This is needed because it is not allowed for a build target to
link against multiple versions of the same AIDL lirary.

The canonical driver will report ANDROID_S for AIDL v1, and FL6 for v2.

Reverted Changes:
I2aefa0023:Revert "Use explicitly versioned NNAPI HAL util li...
Ia7df07ab9:Revert "Add neuralnetworks_utils_hal_aidl_v2 to al...
Iadd823460:Revert "Provide explicitly version NNAPI AIDL util...
I3d3ac4745:Revert "Provide explicitly versioned NNAPI AIDL ut...

Bug: 202405342
Test: NNT_static
Test: CtsNNAPITestCases
Test: VtsHalNeuralnetworksTargetTest
Change-Id: Ib3b732aa406f6d37e8f941082807c9232720c909
Merged-In: Ib3b732aa406f6d37e8f941082807c9232720c909
(cherry picked from commit 478a78ea77)
2021-10-29 14:28:45 -07:00
Michael Butler
d4cad1c2b4 Merge "Revert^2 "Provide explicitly versioned NNAPI AIDL utils libs -- HAL."" 2021-10-29 21:08:58 +00:00
Michael Butler
478a78ea77 Revert^2 "Provide explicitly versioned NNAPI AIDL utils libs -- HAL."
Reason for revert: rollforward fix of this topic

This change is a revert of I3d3ac4745, which itself is a revert of
I74f1798e8.

This CL modifies the AIDL utils libraries to be explicitly
versioned. Currently, we only have two versions: v1 and "current".
Specifically, the following changes are made:
- Remove AIDL dependencies from neuralnetworks_utils_hal_common
- Create explicitly versioned libs of neuralnetworks_utils_hal_aidl*

This is needed because it is not allowed for a build target to
link against multiple versions of the same AIDL lirary.

The canonical driver will report ANDROID_S for AIDL v1, and FL6 for v2.

Reverted Changes:
I2aefa0023:Revert "Use explicitly versioned NNAPI HAL util li...
Ia7df07ab9:Revert "Add neuralnetworks_utils_hal_aidl_v2 to al...
Iadd823460:Revert "Provide explicitly version NNAPI AIDL util...
I3d3ac4745:Revert "Provide explicitly versioned NNAPI AIDL ut...

Bug: 202405342
Test: NNT_static
Test: CtsNNAPITestCases
Test: VtsHalNeuralnetworksTargetTest
Change-Id: Ib3b732aa406f6d37e8f941082807c9232720c909
2021-10-27 21:59:44 -07:00
Ian Hua
64b82c3673 Add FL6 spec tests to AIDL VTS. am: ca46f9768c am: 65a058482b am: 1a1d9d0325 am: cc144fffe5 am: 71e94d7243
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1866682

Change-Id: Ib085391c12ee7d82ced9f321d89799d736e7c877
2021-10-27 17:19:54 +00:00
Ian Hua
ca46f9768c Add FL6 spec tests to AIDL VTS.
Also skip FL6 (AIDL_V2) tests for older AIDL drivers.

Bug: 203038813
Test: VtsHalNeuralnetworksTargetTest
Specifically, for old driver such as AIDL_V1 sample driver, it can pass
HIDL tests and skip AIDL_V2 tests. For new driver such as AIDL_V2
sample driver, it can pass all tests.

Change-Id: I689fef0945428f6548977628e3c43628dd1e5bf7
2021-10-27 11:55:25 +01:00
Michael Butler
aa33ad0e05 Merge changes Iae9f692f,Ib43f1cb6,I9d4f0c30,I7d06ea35 am: 5f14bad22c am: b9aff55ad9 am: 6109e931d9 am: ebab2cdef5 am: 1fb34517fc
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1863342

Change-Id: Id84736e9ef21fb82f3905204498700ffb56c0390
2021-10-27 01:58:54 +00:00
Michael Butler
5f14bad22c Merge changes Iae9f692f,Ib43f1cb6,I9d4f0c30,I7d06ea35
* changes:
  Move NN HandleError from utils/common to 1.0/utils
  Relocate NN ProtectCallback to 1.0/utils
  Move NN memory utils from utils/common to 1.0/utils
  Remove hal::utils::countNumberOfConsumers
2021-10-26 23:55:24 +00:00
Michael Butler
49d95e0457 Move NN HandleError from utils/common to 1.0/utils
This change is part of a larger chain of changes to remove HIDL and AIDL
libraries from neuralnetworks_utils_hal_common.

Bug: N/A
Test: mma
Change-Id: Iae9f692ffc72700294aae694c256e75c7e353fef
2021-10-26 21:18:33 +00:00
Michael Butler
e8645c3b8d Relocate NN ProtectCallback to 1.0/utils
This change is part of a larger chain of changes to remove HIDL and AIDL
libraries from neuralnetworks_utils_hal_common.

Bug: N/A
Test: mma
Change-Id: Ib43f1cb683a09ae5c9116a6dea4d269c9c2c78b4
2021-10-26 21:18:09 +00:00
Michael Butler
15965821e8 Move NN memory utils from utils/common to 1.0/utils
This change is part of a larger chain of changes to remove HIDL and AIDL
libraries from neuralnetworks_utils_hal_common.

Bug: N/A
Test: mma
Change-Id: I9d4f0c30932fad7ccb6231aa03e57f7227af4880
2021-10-26 21:17:53 +00:00
Michael Butler
301ef060e9 Remove hal::utils::countNumberOfConsumers
This CL removes hal::utils::countNumberOfConsumers and uses the existing
nn::countNumberOfConsumers.

This change is part of a larger chain of changes to remove HIDL and AIDL
libraries from neuralnetworks_utils_hal_common.

Bug: N/A
Test: mma
Change-Id: I7d06ea355eae7aa80b94b09a23d606bbb2322120
2021-10-26 21:17:10 +00:00
Michael Butler
c42a934ea8 Revert "Provide explicitly versioned NNAPI AIDL utils libs -- HAL."
Revert "Use explicitly versioned NNAPI HAL util libs in darwinn2."

Revert "Add neuralnetworks_utils_hal_aidl_v2 to allowed_deps.txt"

Revert "Provide explicitly version NNAPI AIDL utils lib -- runtime."

Revert submission 16007539-nnapi-experimental-aidl-feature

Reason for revert: The cherry-pick of this CL breaks the build
Reverted Changes:
Ieb2da3461:Add neuralnetworks_utils_hal_aidl_v2 to allowed_de...
I8ae01e3c6:Provide explicitly version NNAPI AIDL utils lib --...
I74f1798e8:Provide explicitly versioned NNAPI AIDL utils libs...
I2362464e8:Use explicitly versioned NNAPI HAL util libs in da...

Test: mma

Change-Id: I3d3ac4745fb707cbdceb2019f3c2fc7807183b71
Merged-In: I3d3ac4745fb707cbdceb2019f3c2fc7807183b71
(cherry picked from commit 932e82b0c3)
2021-10-25 21:13:15 -07:00
Michael Butler
c02e862913 Merge "Revert "Provide explicitly versioned NNAPI AIDL utils libs -- HAL."" 2021-10-26 03:43:15 +00:00
Michael Butler
932e82b0c3 Revert "Provide explicitly versioned NNAPI AIDL utils libs -- HAL."
Revert "Use explicitly versioned NNAPI HAL util libs in darwinn2."

Revert "Add neuralnetworks_utils_hal_aidl_v2 to allowed_deps.txt"

Revert "Provide explicitly version NNAPI AIDL utils lib -- runtime."

Revert submission 16007539-nnapi-experimental-aidl-feature

Reason for revert: The cherry-pick of this CL breaks the build
Reverted Changes:
Ieb2da3461:Add neuralnetworks_utils_hal_aidl_v2 to allowed_de...
I8ae01e3c6:Provide explicitly version NNAPI AIDL utils lib --...
I74f1798e8:Provide explicitly versioned NNAPI AIDL utils libs...
I2362464e8:Use explicitly versioned NNAPI HAL util libs in da...

Change-Id: I3d3ac4745fb707cbdceb2019f3c2fc7807183b71
2021-10-26 03:29:13 +00:00
Xusong Wang
cb2c37f78f Provide explicitly versioned NNAPI AIDL utils libs -- HAL.
This CL modifies the AIDL utils libraries to be explicitly
versioned. Currently, we only have two versions: v1 and "current".
Specifically, the following changes are made:
- Remove AIDL dependencies from neuralnetworks_utils_hal_common
- Create explicitly versioned libs of neuralnetworks_utils_hal_aidl_*

This is needed because it is not allowed for a build target to
link against multiple versions of the same AIDL lirary.

The canonical driver will report ANDROID_S for AIDL v1, and FL6 for v2.

Bug: 202405342
Test: NNT_static
Test: CtsNNAPITestCases
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I74f1798e80a059949e43e0567d23e884a7f7c92d
Merged-In: I74f1798e80a059949e43e0567d23e884a7f7c92d
(cherry picked from commit 9763a9537d)
2021-10-25 12:58:44 -07:00
Xusong Wang
9557306454 Merge "Provide explicitly versioned NNAPI AIDL utils libs -- HAL." 2021-10-25 07:10:59 +00:00
Xusong Wang
9763a9537d Provide explicitly versioned NNAPI AIDL utils libs -- HAL.
This CL modifies the AIDL utils libraries to be explicitly
versioned. Currently, we only have two versions: v1 and "current".
Specifically, the following changes are made:
- Remove AIDL dependencies from neuralnetworks_utils_hal_common
- Create explicitly versioned libs of neuralnetworks_utils_hal_aidl_*

This is needed because it is not allowed for a build target to
link against multiple versions of the same AIDL lirary.

The canonical driver will report ANDROID_S for AIDL v1, and FL6 for v2.

Bug: 202405342
Test: NNT_static
Test: CtsNNAPITestCases
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I74f1798e80a059949e43e0567d23e884a7f7c92d
2021-10-21 10:33:04 -07:00
David Gross
09e486ee47 Merge "Add PACK operation to NNAPI feature level 6." am: 6e74ca65a7 am: 9fc0aae600 am: 6232d05bf5 am: 9e836f5709 am: 6ec84071f4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1835817

Change-Id: Iee6a6cd8605d27b769ad5c25037a161937cebbdb
2021-10-19 22:24:56 +00:00
David Gross
6e74ca65a7 Merge "Add PACK operation to NNAPI feature level 6." 2021-10-19 21:23:12 +00:00
David Gross
79d63db0c8 Add PACK operation to NNAPI feature level 6.
Bug: 200281183
Bug: 200280665

Test: m -j NeuralNetworksTest_static
Test: VtsHalNeuralnetworksTargetTest

Change-Id: Ic15d047b70c62437b4f0db6f2ca10127591ae07c
2021-10-19 11:04:57 -07:00
Michael Butler
6767158be2 Merge "Allow implicit conversions for NN errors -- hal" am: 68e98f40dc am: d236dbf3b3 am: 36c599d513 am: 0e0dc63cff am: 2542d951d0
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1859936

Change-Id: I2d5d614f17b8762d2523dde714ae5f6a38adf2a2
2021-10-19 00:16:19 +00:00
Michael Butler
68e98f40dc Merge "Allow implicit conversions for NN errors -- hal" 2021-10-18 22:45:51 +00:00
Ian Hua
068df81ab6 AIDL interface changes for NNAPI feature level 6.
- Add BATCH_MATMUL operation
- Support TENSOR_INT32 for RESHAPE operation.

Also update "current" version snapshot and use
android.hardware.neuralnetworks-V2-ndk since AIDL v1 has been frozen.

Bug: 193012662
Bug: 200281183
Test: mm
Change-Id: Iabe45c57e2306d61055f711eda03b80b9cbe906d
Merged-In: Iabe45c57e2306d61055f711eda03b80b9cbe906d
2021-10-18 11:38:55 +01:00
Ian Hua
be48b1ffeb Merge "AIDL interface changes for NNAPI feature level 6." 2021-10-18 10:25:07 +00:00
Michael Butler
ff9a5a527a Allow implicit conversions for NN errors -- hal
This change allows GeneralErrors to be created from a string and allows
ExecutionErrors to be created from a string or a GeneralError.
This makes error handling more terse, removing the need for helper
functions such as makeGeneralFailure or makeExecutionFailure.

Bug: N/A
Test: mma
Change-Id: I8c5e80a2eb4f399fad64aab763fe6fa08cf8d1db
2021-10-15 16:37:09 -07:00
Ian Hua
a7adbcc630 AIDL interface changes for NNAPI feature level 6.
- Add BATCH_MATMUL operation
- Support TENSOR_INT32 for RESHAPE operation.

Also update "current" version snapshot and use
android.hardware.neuralnetworks-V2-ndk since AIDL v1 has been frozen.

Bug: 193012662
Bug: 200281183
Test: NeuralNetworksTest_static,VtsHalNeuralnetworksTargetTest
Change-Id: Iabe45c57e2306d61055f711eda03b80b9cbe906d
2021-10-15 13:59:53 +01:00
Przemyslaw Szczepaniak
817f2cd2d2 Merge "Update OWNERS file" am: 996054b24f am: fd6488319e am: f64e152e7b am: 329d170010 am: 6736b287b5
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1857518

Change-Id: I86e0880b633d5f16adfb79052ee3017593b25334
2021-10-15 12:08:28 +00:00
Przemyslaw Szczepaniak
996054b24f Merge "Update OWNERS file" 2021-10-15 11:02:37 +00:00
Michael Butler
a6cebbe851 Merge "Handle error returned by IBurstContext::freeMemory" am: f3bd4751a3 am: 1b085b37c8 am: 608210f72c am: 02d3a9485d am: 5f9917e6c0
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1856680

Change-Id: I820e3d18f2a3f9d16062bfef4351b7d48cd368ab
2021-10-14 22:27:36 +00:00