Add FL6 spec tests to AIDL VTS. am: ca46f9768c am: 65a058482b am: 1a1d9d0325 am: cc144fffe5

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1866682

Change-Id: Ie2b7ae91e0c021b0e97c4b1bbd94ab770f06c35b
This commit is contained in:
Ian Hua
2021-10-27 16:58:17 +00:00
committed by Automerger Merge Worker
5 changed files with 25 additions and 1 deletions

View File

@@ -28,7 +28,7 @@
namespace aidl::android::hardware::neuralnetworks::utils {
constexpr auto kDefaultPriority = Priority::MEDIUM;
constexpr auto kVersion = nn::Version::ANDROID_S;
constexpr auto kVersion = nn::Version::FEATURE_LEVEL_6;
template <typename Type>
nn::Result<void> validate(const Type& halObject) {

View File

@@ -63,6 +63,7 @@ cc_test {
"neuralnetworks_utils_hal_aidl",
],
whole_static_libs: [
"neuralnetworks_generated_AIDL_V2_example",
"neuralnetworks_generated_V1_0_example",
"neuralnetworks_generated_V1_1_example",
"neuralnetworks_generated_V1_2_example",

View File

@@ -907,6 +907,20 @@ void GeneratedTestBase::SetUp() {
const bool deviceIsResponsive =
ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
ASSERT_TRUE(deviceIsResponsive);
// TODO(b/201260787): We should require old drivers to report the model as
// unsupported instead of simply skipping the test.
SkipIfDriverOlderThanTestModel();
}
void GeneratedTestBase::SkipIfDriverOlderThanTestModel() {
int32_t deviceVersion;
ASSERT_TRUE(kDevice->getInterfaceVersion(&deviceVersion).isOk());
const int32_t modelVersion = kTestModel.getAidlVersionInt();
if (deviceVersion < modelVersion) {
GTEST_SKIP() << "Device interface version " << deviceVersion
<< " is older than test model's minimum supported HAL version " << modelVersion
<< ". Skipping test.";
}
}
std::vector<NamedModel> getNamedModels(const FilterFn& filter) {

View File

@@ -34,6 +34,9 @@ class GeneratedTestBase : public testing::TestWithParam<GeneratedTestParam> {
void SetUp() override;
const std::shared_ptr<IDevice> kDevice = getData(std::get<NamedDevice>(GetParam()));
const test_helper::TestModel& kTestModel = *getData(std::get<NamedModel>(GetParam()));
private:
void SkipIfDriverOlderThanTestModel();
};
using FilterFn = std::function<bool(const test_helper::TestModel&)>;

View File

@@ -1122,6 +1122,7 @@ static bool removeOperationInputSkip(const Operation& op, size_t input) {
// align_corners and half_pixel_centers parameters.
// - L2_NORMALIZATION, LOCAL_RESPONSE_NORMALIZATION, SOFTMAX can have an optional axis
// parameter.
// - PACK has at least 2 inputs, with the first element being INT32.
switch (op.type) {
case OperationType::CONCATENATION: {
if (op.inputs.size() > 2 && input != op.inputs.size() - 1) {
@@ -1178,6 +1179,11 @@ static bool removeOperationInputSkip(const Operation& op, size_t input) {
return true;
}
} break;
case OperationType::PACK: {
if (op.inputs.size() > 2 && input != 0) {
return true;
}
} break;
default:
break;
}