summaryrefslogtreecommitdiff
path: root/neuralnetworks/aidl/utils
AgeCommit message (Collapse)Author
2022-04-28Move NN_TRY macro out of struct initializationMichael Butler
NNAPI NN_TRY macros use Statement Expressions (a GNU extension) to propagate errors. However, a "return" statement in a Statement Expression can lead to memory leaks when the Statement Expression is being used to initialize a member of a struct. Specifically, when one member of a struct is already initialized, and a Statement Expression used to initialize a subsequent member early-returns, the previously initialized members will not have their destructors called. This CL moves any NN_TRY macro out of struct initialization to avoid any potential memory leaks. Bug: 230500484 Test: mma Test: presubmit Change-Id: I3493fd4764f8eacc86750e6414e62bc891abaccd
2022-03-01Merge "Cast to the underlying type for union tags" am: 6cd0d474b2 am: ↵Treehugger Robot
5eb895c047 am: bbd66d27a0 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1999055 Change-Id: Ie0a38cc29d50c65b8168435c70786321fc9de199
2022-02-26Cast to the underlying type for union tagsJooyung Han
Union tags are of enum type. Streaming it would make more sense by casting to underlying types. For now casting is not required since tags are defined as `enum Tag`. But we're going to change it to `enum class Tag` which won't work with operator<< without casting. Bug: 218912230 Test: m Change-Id: Ia5e8a5c38fe23c72dffbdca320a32abdfa0eb38e
2022-02-24Merge "Remove NN host specific build defines" am: fe9368b729 am: 13a6d16614 ↵Michael Butler
am: 6d588b7cd9 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1997731 Change-Id: I2bfc9dbc8c7fbc0940eed48968dc5df89314b08c
2022-02-24Merge "Add timed out test files to tidy_timeout_srcs" am: ff54f73b4f am: ↵Chih-hung Hsieh
fa83970b3a am: 581616e658 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1992232 Change-Id: I2eac13fe3b5ab0b4f15d6ceadf376e5e74124a81
2022-02-24Merge "Remove NN host specific build defines"Michael Butler
2022-02-23Remove NN host specific build definesMichael Butler
These defines are redundant because they are already defined in neuralnetworks_utils_defaults. Bug: N/A Test: mma Change-Id: I1c5c44e9e61da19bc10dd8ed2e38099f7c4baccd
2022-02-18Add timed out test files to tidy_timeout_srcsChih-Hung Hsieh
* Timed out runs do not show any warning messages. * These test files cannot finish clang-tidy runs with the following settings: TIDY_TIMEOUT=90 WITH_TIDY=1 CLANG_ANALYZER_CHECKS=1 * When TIDY_TIMEOUT is set, in Android continuous builds, tidy_timeout_srcs files will not be compiled by clang-tidy. When developers build locally without TIDY_TIMEOUT, tidy_timeout_srcs files will be compiled. * Some of these test modules may be split into smaller ones, or disable some time consuming checks, and then enable clang-tidy to run within limited time. Bug: 201099167 Test: make droid tidy-hardware-interfaces_subset Change-Id: I1de28f1572fff368f67eab512fffec9f2e5c2a9b
2022-02-15Merge "Clamp NNAPI HAL Version to runtime version -- hal" am: b66f1308ac am: ↵Michael Butler
27e3ce4cf6 am: 9c4d73c39d Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1985406 Change-Id: I6b5669f02cf59128acb218d0baf1a2ea3cc99b39
2022-02-14Clamp NNAPI HAL Version to runtime version -- halMichael Butler
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-09Merge "Address ANAPIC review comments -- hal." am: 8b389e1123 am: 706652c817 ↵Xusong Wang
am: cfa3838085 am: aba49d0512 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1957303 Change-Id: I88834c87adc1958cfd6cc68929d38eaad43c2d93
2022-02-07Address ANAPIC review comments -- hal.Xusong Wang
- 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-01Merge "Move NNAPI HAL CommonUtils to nnapi/SharedMemory -- hal" am: ↵Michael Butler
ea3e90c1f1 am: 0d612d723b am: f288828f8e am: 67a0cba6b5 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1966388 Change-Id: Ie8eccccc4d97287b776cf786d146f4cf80f1edc5
2022-01-31Move NNAPI HAL CommonUtils to nnapi/SharedMemory -- halMichael Butler
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-21Merge "Cleanup NN utility libraries' dependencies" am: d3e413e759 am: ↵Michael Butler
fd0636d14b am: b3d989c805 am: 2dddfa7d4a Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1950217 Change-Id: Ibf979c129b008a94d1b729e84cc2e338624e176b
2022-01-20Merge "Cleanup NN utility libraries' dependencies"Michael Butler
2022-01-20Cleanup NN utility libraries' dependenciesMichael Butler
Bug: N/A Test: mma Change-Id: I0243c477098d9a2de28ca78bfde155d3ecb5acb6
2022-01-20HAL interface for compilation and execution hintsMiao Wang
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 0e671f3edb9d2c78658a4ef4169e3211e3f9bb00)
2022-01-20HAL interface for compilation and execution hintsMiao Wang
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-18Reusable execution at HAL level -- HAL.Xusong Wang
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 7f5c7d293c2dad462dc9c0f1f1a160fb2c2c9a9b)
2022-01-14Reusable execution at HAL level -- HAL.Xusong Wang
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-12Merge changes Ifeffea05,I966f65a1 am: 104192c28f am: ca40766dd6 am: ↵Michael Butler
c0bceee092 am: d038448af8 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1944552 Change-Id: If3fb99d21670277bcf99f54d7f064d792e4ee0cc
2022-01-11Create NN AIDL adapterMichael Butler
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
2021-11-22Add NNAPI specification and infrastructure for FL7.David Gross
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 04ed8595b5587e9f6e71ac45edd17cf92da56c32)
2021-11-22Add NNAPI specification and infrastructure for FL7.David Gross
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-19Merge "Rename Version::ANDROID_* to kVersionFeatureLevel* -- hal" am: ↵Michael Butler
8f6b82c7a5 am: 58b61dbce0 am: b79dc03c81 am: 0092aefaa2 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1896056 Change-Id: If1e0c76bcba7fac6d69bdef6d7b0810292cd6b39
2021-11-19Merge "Make NNAPI Version more structured -- hal" am: 71b595549c am: ↵Michael Butler
a9ebf76162 am: 4d7093ecd2 am: 22c9336428 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1890277 Change-Id: I94b642c7f2b14594bf0e37628cd22b362e562eee
2021-11-18Rename Version::ANDROID_* to kVersionFeatureLevel* -- halMichael Butler
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-18Make NNAPI Version more structured -- halMichael Butler
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-16Merge "Configure Version value for each version of NN AIDL utils" am: ↵Michael Butler
21e079c9e2 am: a0c2165144 am: 99aea2fe82 am: 04f63c1e18 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1890278 Change-Id: I02759b48d6d5972ea549dfd7039914e898488060
2021-11-16Merge "Configure Version value for each version of NN AIDL utils"Michael Butler
2021-11-16Merge "Consolidate NNAPI OWNERS files" am: 161883c967 am: 3e31733ee7 am: ↵Michael Butler
c8d5b0599c am: 43b5f0f221 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1892878 Change-Id: I4e3d5b838727a8cc152a93fecad0e5e3f3997f31
2021-11-15Configure Version value for each version of NN AIDL utilsMichael Butler
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-15Consolidate NNAPI OWNERS filesMichael Butler
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-09Merge "Remove unnecessary NNAPI header files" am: 9ec39aa042 am: 340e03f4b9 ↵Michael Butler
am: 970d671c9b am: b40584fd8e am: 53b8aa9d99 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1880752 Change-Id: Ic5e925237786260eca1890de6f23e252c12454a2
2021-11-05Remove unnecessary NNAPI header filesMichael Butler
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-03Merge changes from topic "libneuralnetworks_common-cleanup" am: ee7a476090 ↵Michael Butler
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-03Move Aidl utility code to aidl/utils -- hal 1/2 am: 8fa5383407 am: ↵Michael Butler
937d71b102 am: 4b45b7b234 am: f8eee4fe1b am: cb1285dc8c Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1878018 Change-Id: I7d695306a8906ce4acd16da67a5a6bc903415113
2021-11-01Move Aidl utility code to aidl/utils -- hal 2/2Michael Butler
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-01Move Aidl utility code to aidl/utils -- hal 1/2Michael Butler
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-10-29Revert^2 "Provide explicitly versioned NNAPI AIDL utils libs -- HAL."Michael Butler
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 478a78ea77fccf332b04d5ad25309428d0f96eaf)
2021-10-29Merge "Revert^2 "Provide explicitly versioned NNAPI AIDL utils libs -- HAL.""Michael Butler
2021-10-27Revert^2 "Provide explicitly versioned NNAPI AIDL utils libs -- HAL."Michael Butler
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-27Add FL6 spec tests to AIDL VTS. am: ca46f9768c am: 65a058482b am: 1a1d9d0325 ↵Ian Hua
am: cc144fffe5 am: 71e94d7243 Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1866682 Change-Id: Ib085391c12ee7d82ced9f321d89799d736e7c877
2021-10-27Add FL6 spec tests to AIDL VTS.Ian Hua
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-27Merge changes Iae9f692f,Ib43f1cb6,I9d4f0c30,I7d06ea35 am: 5f14bad22c am: ↵Michael Butler
b9aff55ad9 am: 6109e931d9 am: ebab2cdef5 am: 1fb34517fc Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1863342 Change-Id: Id84736e9ef21fb82f3905204498700ffb56c0390
2021-10-26Move NN HandleError from utils/common to 1.0/utilsMichael Butler
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-26Relocate NN ProtectCallback to 1.0/utilsMichael Butler
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-26Merge "Revert "Provide explicitly versioned NNAPI AIDL utils libs -- HAL.""Michael Butler
2021-10-26Revert "Provide explicitly versioned NNAPI AIDL utils libs -- HAL."Michael Butler
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