Relax NNAPI QoS deadline parameter
Prior to this CL, the NNAPI QoS deadline is a strict deadline: a task
with a deadline must either complete or abort by the deadline. To
avoid as much overhead as possible, it is requested for Android R to
have a relaxed deadline, where the task *may* be aborted after the
deadline has passed or when the task is estimated to take too long.
Because the deadline is now relaxed, the querying method
IDevice::supportsDeadlines can be removed.
Bug: 149766387
Test: mma
Test: VtsHalNeuralnetworksV1_3TargetTest
Change-Id: Ib9937b5bb95646c2fd82e1aa17f2b0b639e2c420
Merged-In: Ib9937b5bb95646c2fd82e1aa17f2b0b639e2c420
(cherry picked from commit 9b9a804fe4c3394e04025d3646328c1f975e26bd)
diff --git a/neuralnetworks/1.3/vts/functional/ValidateModel.cpp b/neuralnetworks/1.3/vts/functional/ValidateModel.cpp
index 09e9922..8f2d4b7 100644
--- a/neuralnetworks/1.3/vts/functional/ValidateModel.cpp
+++ b/neuralnetworks/1.3/vts/functional/ValidateModel.cpp
@@ -44,18 +44,12 @@
}
static void validatePrepareModel(const sp<IDevice>& device, const std::string& message,
- const Model& model, ExecutionPreference preference,
- bool testDeadline) {
+ const Model& model, ExecutionPreference preference) {
SCOPED_TRACE(message + " [prepareModel_1_3]");
- OptionalTimePoint deadline;
- if (testDeadline) {
- deadline.nanosecondsSinceEpoch(std::numeric_limits<uint64_t>::max());
- }
-
sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback();
Return<ErrorStatus> prepareLaunchStatus = device->prepareModel_1_3(
- model, preference, kDefaultPriority, deadline, hidl_vec<hidl_handle>(),
+ model, preference, kDefaultPriority, {}, hidl_vec<hidl_handle>(),
hidl_vec<hidl_handle>(), HidlToken(), preparedModelCallback);
ASSERT_TRUE(prepareLaunchStatus.isOk());
ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, static_cast<ErrorStatus>(prepareLaunchStatus));
@@ -79,13 +73,12 @@
// to the model does not leave this function.
static void validate(const sp<IDevice>& device, const std::string& message, Model model,
const std::function<void(Model*)>& mutation,
- ExecutionPreference preference = ExecutionPreference::FAST_SINGLE_ANSWER,
- bool testDeadline = false) {
+ ExecutionPreference preference = ExecutionPreference::FAST_SINGLE_ANSWER) {
mutation(&model);
- if (validExecutionPreference(preference) && !testDeadline) {
+ if (validExecutionPreference(preference)) {
validateGetSupportedOperations(device, message, model);
}
- validatePrepareModel(device, message, model, preference, testDeadline);
+ validatePrepareModel(device, message, model, preference);
}
static uint32_t addOperand(Model* model) {
@@ -744,19 +737,9 @@
}
}
-///////////////////////// DEADLINE /////////////////////////
-
-static void deadlineTest(const sp<IDevice>& device, const Model& model) {
- const std::string message = "deadlineTest: deadline not supported";
- const auto noop = [](Model*) {};
- validate(device, message, model, noop, ExecutionPreference::FAST_SINGLE_ANSWER,
- /*testDeadline=*/true);
-}
-
////////////////////////// ENTRY POINT //////////////////////////////
-void validateModel(const sp<IDevice>& device, const Model& model,
- bool prepareModelDeadlineSupported) {
+void validateModel(const sp<IDevice>& device, const Model& model) {
mutateOperandTypeTest(device, model);
mutateOperandRankTest(device, model);
mutateOperandScaleTest(device, model);
@@ -772,9 +755,6 @@
addOperationInputTest(device, model);
addOperationOutputTest(device, model);
mutateExecutionPreferenceTest(device, model);
- if (!prepareModelDeadlineSupported) {
- deadlineTest(device, model);
- }
}
} // namespace android::hardware::neuralnetworks::V1_3::vts::functional