Commit graph

961 commits

Author SHA1 Message Date
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
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
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