summaryrefslogtreecommitdiff
path: root/neuralnetworks/utils/common/test
AgeCommit message (Collapse)Author
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
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-05-10Introduce reusable execution to canonical interface -- HAL.Xusong Wang
This CL modifies the canonical interface for reusable executions: - Add new interface: IExecution with compute and computeFenced methods - Add new method IPreparedModel::createExecution In NNAPI runtime, the new interface IExecution is used to memoize request-specific execution resources (e.g. converted HAL request). The expected usage is that, IPreparedModel::createExecution will be invoked in the first computation of a reusable NDK ANNExecution object, and IExecution::compute* will be invoked repeatedly. The IPreparedModel::execute* methods are preserved to avoid redundant object creation and memoization overhead for a single-time (non-reusable) execution. For a vendor implementing the canonical interfaces, only the IPreparedModel::execute* methods will be called because there is currently no reusable execution at HAL interface. A DefaultExecution implementation is provided to reduce the work needed on the vendor side. Bug: 184073769 Test: NNT_static Test: neuralnetworks_utils_hal_1_0_test Test: neuralnetworks_utils_hal_1_1_test Test: neuralnetworks_utils_hal_1_2_test Test: neuralnetworks_utils_hal_1_3_test Test: neuralnetworks_utils_hal_common_test Test: neuralnetworks_utils_hal_aidl_test Change-Id: I91790bb5ccf5ae648687fe603f88ffda2c9fd2b2 Merged-In: I91790bb5ccf5ae648687fe603f88ffda2c9fd2b2 (cherry picked from commit 727a7b2104b0962509fedffe720eec508b2ee6de)
2021-04-21Remove NN canonical IDevice::isUpdatable -- halMichael Butler
This CL alters the AIDL utility "getDevices" to return whether or not a service is updatable. This CL additional removes IDevice::isUpdatable because it is now redundant with the changes to "getDevices". Bug: 170696350 Test: mma Test: NeuralNetworksTest_static Change-Id: I86228763937c0dd2ee5b1d9d547c367cd7504ed4
2021-04-02Add additional parameters for NN Burst -- HALMichael Butler
Adds deadline and loopTimeoutDuration to nn::IBurst::execute. This CL additionally adds a test case for IPreparedModel::configureExecutionBurst and adds the suffix "_H" to the header guards that were missing "_H". Bug: 180492058 Bug: 177267324 Test: mma Test: NeuralNetworksTest_static Change-Id: Ic9ba2fb9b4dee4e40d99ae91bb9555a58d0508d2 Merged-In: Ic9ba2fb9b4dee4e40d99ae91bb9555a58d0508d2 (cherry picked from commit bbbdb0d5f118efa8159c3cc98304208fd7631609)
2021-02-17Change NNAPI Memory to ref-counted SharedMemory -- halMichael Butler
Bug: 179906132 Test: mma Test: NeuralNetworksTest_static Test: presubmit Change-Id: I6435db906a2efe4938da18149a1fcd6d24730a95 Merged-In: I6435db906a2efe4938da18149a1fcd6d24730a95 (cherry picked from commit 79a16ebb6f42c21a21202f7b63ce372f2df15137)
2021-01-19Introduce canonical IBurst object in NNAPI -- halMichael Butler
A sibling change to this change introduces a canonical IBurst object and a new method IPreparedModel::configureExecutionBurst. This CL performs minimal changes to the NN hal utility code to make the code still compile. Bug: 177267324 Test: mma Change-Id: I076067289dde7def5622a6cb25233619f80efa41 Merged-In: I076067289dde7def5622a6cb25233619f80efa41 (cherry picked from commit b6a7ed5d5fd45828643429fbfe015fe3a8054ef1)
2021-01-19Add isUpdatable to NNAPI canonical IDevice -- halMichael Butler
Bug: 177284207 Test: mma Change-Id: I580d5325be91f566ee1c591736a87a94d0a74315 Merged-In: I580d5325be91f566ee1c591736a87a94d0a74315 (cherry picked from commit 080fbf755c48a944586ecd739f02570b7aa611ee)
2021-01-08Create unit tests for NN interface utility codeMichael Butler
This CL introduces unit tests to validate the V1_X::utils::Device, *PreparedModel, and *Buffer adapter classes. It does so by mocking the underlying HIDL interface in order to simulate a driver returning bad data, HIDL transport failures, and service crashes. Note that the purpose of these new tests is to validate the adapter classes themselves, not the HIDL interfaces they use. For example, because nn::IPreparedModel does not currently define a method for configuring a burst execution, V1_[23]::utils::PreparedModel similarly does not use hardware::neuralnetworks::V1_[23]::IPreparedModel's configureExecutionBurst method. This CL also introduces unit tests to validate the utils::Resilient* adapter classes, and mocks DEAD_OBJECT failures to ensure that the underyling object can be recovered appropriately. Bug: 163801800 Test: mma Test: atest neuralnetworks_utils_hal_common_test Test: atest neuralnetworks_utils_hal_1_[0-3]_test Change-Id: I2c79865bf666d3f4bf53061ff5090746403583e9 Merged-In: I2c79865bf666d3f4bf53061ff5090746403583e9 (cherry picked from commit afc4d7cfe753669b08562eba8f58cbceefed334f)