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
diff --git a/neuralnetworks/aidl/utils/test/DeviceTest.cpp b/neuralnetworks/aidl/utils/test/DeviceTest.cpp
index 79abe1b..19d2314 100644
--- a/neuralnetworks/aidl/utils/test/DeviceTest.cpp
+++ b/neuralnetworks/aidl/utils/test/DeviceTest.cpp
@@ -152,13 +152,15 @@
};
std::string printDeviceTest(const testing::TestParamInfo<nn::Version>& info) {
- switch (info.param) {
- case nn::Version::ANDROID_S:
+ const nn::Version version = info.param;
+ CHECK(!version.runtimeOnlyFeatures);
+ switch (version.level) {
+ case nn::Version::Level::ANDROID_S:
return "v1";
- case nn::Version::FEATURE_LEVEL_6:
+ case nn::Version::Level::FEATURE_LEVEL_6:
return "v2";
default:
- LOG(FATAL) << "Invalid AIDL version: " << info.param;
+ LOG(FATAL) << "Invalid AIDL version: " << version;
return "invalid";
}
}