summaryrefslogtreecommitdiff
path: root/neuralnetworks/1.2/utils/test/DeviceTest.cpp
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-03-16Add missing NNAPI HIDL interface mock testsLev Proleev
prepareModelFromCache* was tested for handling of errors happening during the preparation launch but not during the actual preparation. Bug: 163801800 Test: mma Test: atest neuralnetworks_utils_hal_common_test Test: atest neuralnetworks_utils_hal_1_[0-3]_test Change-Id: I2c4b235fd4877238d7a18be8b0ea051434c1df6b Merged-In: I2c4b235fd4877238d7a18be8b0ea051434c1df6b (cherry picked from commit c6cf50ad425d60796da6a326f5d5515fb3b28fc0)
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)