Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff7d6c54 authored by Michael Butler's avatar Michael Butler Committed by Slava Shklyaev
Browse files

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 9b9a804f)
parent a37c2c84
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -625,11 +625,11 @@ bbeee9604128ede83ee755b67e73b5ad29e6e1dbac9ec41fea6ffe2745b0c50a android.hardwar
adb0efdf1462e9b2e742c0dcadd598666aac551f178be06e755bfcdf5797abd0 android.hardware.keymaster@4.1::IOperation
ddcf89cd8ee2df0d32aee55050826446fb64f7aafde0a7cd946c64f61b1a364c android.hardware.keymaster@4.1::types
65c16331e57f6dd68b3971f06f78fe9e3209afb60630c31705aa355f9a52bf0d android.hardware.neuralnetworks@1.3::IBuffer
9db064ee44268a876be0367ff771e618362d39ec603b6ecab17e1575725fcd87 android.hardware.neuralnetworks@1.3::IDevice
4167dc3ad35e9cd0d2057d4868c7675ae2c3c9d05bbd614c1f5dccfa5fd68797 android.hardware.neuralnetworks@1.3::IExecutionCallback
2fa3679ad7c94b5e88724adcd560c561041068a4ca565c63830e68101988746a android.hardware.neuralnetworks@1.3::IFencedExecutionCallback
43088ffc71945b463a7279262cfe2e290f6ed2f15d3fd6032798a3be299fb08f android.hardware.neuralnetworks@1.3::IPreparedModel
0439a1fbbec7f16e5e4c653d85ac685d51bfafbae15b8f8cca530acdd7d6a8ce android.hardware.neuralnetworks@1.3::IPreparedModelCallback
278817920bfd5292a7713f97f1832cca53de3de640f7670e413d97c6e7fd581c android.hardware.neuralnetworks@1.3::IDevice
127ba11efb8220dc3aec9a8f441b59eaf1c68d7f03f577833e1824de75a36b17 android.hardware.neuralnetworks@1.3::IExecutionCallback
6e904be0ddca5ae1de8eba020e6c38ed935ea7d80cd08f47787f137a0ca58555 android.hardware.neuralnetworks@1.3::IFencedExecutionCallback
2b0b10d2ea7a18a4048cd0eb83d35c19a817aeee95f65807fc31f4ef21381397 android.hardware.neuralnetworks@1.3::IPreparedModel
eee3430cc86c97c7b407495863d8fb61da6f1a64b7721e77b9b4909b11b174e9 android.hardware.neuralnetworks@1.3::IPreparedModelCallback
dd39887aa4fb60ce60ea9cc043edeadbbae6e922d09d3946311b0b410024ae14 android.hardware.neuralnetworks@1.3::types
3e01d4446cd69fd1c48f8572efd97487bc179564b32bd795800b97bbe10be37b android.hardware.wifi@1.4::IWifi
a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardware.wifi.supplicant@1.3::ISupplicant
+15 −35
Original line number Diff line number Diff line
@@ -47,19 +47,6 @@ interface IDevice extends @1.2::IDevice {
     */
    getCapabilities_1_3() generates (ErrorStatus status, Capabilities capabilities);

    /**
     * Returns whether the device is able to complete or abort a task within a
     * specified duration.
     *
     * @return prepareModelDeadline 'true' if the device supports completing or
     *     aborting model preparation by the deadline when the deadline is supplied,
     *     'false' otherwise.
     * @return executionDeadline 'true' if the device supports completing or
     *     aborting an execution by the deadline when the deadline is supplied,
     *     'false' otherwise.
     */
    supportsDeadlines() generates (bool prepareModelDeadline, bool executionDeadline);

    /**
     * Gets the supported operations in a model.
     *
@@ -140,14 +127,10 @@ interface IDevice extends @1.2::IDevice {
     *
     * prepareModel_1_3 can be called with an optional deadline. If the model
     * is not able to be prepared before the provided deadline, the model
     * preparation must be aborted, and either {@link
     * preparation may be aborted, and either {@link
     * ErrorStatus::MISSED_DEADLINE_TRANSIENT} or {@link
     * ErrorStatus::MISSED_DEADLINE_PERSISTENT} must be returned. The error due
     * ErrorStatus::MISSED_DEADLINE_PERSISTENT} may be returned. The error due
     * to an abort must be sent the same way as other errors, described above.
     * If the service reports that it does not support preparation deadlines via
     * IDevice::supportsDeadlines, and prepareModel_1_3 is called with a
     * deadline, then the argument is invalid, and {@link
     * ErrorStatus::INVALID_ARGUMENT} must be returned.
     *
     * Optionally, the driver may save the prepared model to cache during the
     * asynchronous preparation. Any error that occurs when saving to cache must
@@ -172,9 +155,9 @@ interface IDevice extends @1.2::IDevice {
     *     model.
     * @param priority The priority of the prepared model relative to other
     *     prepared models owned by the client.
     * @param deadline The time by which the model must be prepared. If the
     *     model cannot be prepared by the deadline, the preparation must be
     *     aborted.
     * @param deadline The time by which the model is expected to be prepared.
     *     If the model cannot be prepared by the deadline, the preparation may
     *     be aborted.
     * @param modelCache A vector of handles with each entry holding exactly one
     *     cache file descriptor for the security-sensitive cache. The length of
     *     the vector must either be 0 indicating that caching information is
@@ -209,8 +192,8 @@ interface IDevice extends @1.2::IDevice {
     *     - GENERAL_FAILURE if there is an unspecified error
     *     - INVALID_ARGUMENT if one of the input arguments related to preparing
     *       the model is invalid
     *     - MISSED_DEADLINE_* if the deadline for preparing a model cannot be
     *       met
     *     - MISSED_DEADLINE_* if the preparation is aborted because the model
     *       cannot be prepared by the deadline
     *     - RESOURCE_EXHAUSTED_* if the task was aborted by the driver
     */
    prepareModel_1_3(Model model, ExecutionPreference preference,
@@ -262,14 +245,11 @@ interface IDevice extends @1.2::IDevice {
     *
     * prepareModelFromCache_1_3 can be called with an optional deadline. If the
     * model is not able to prepared before the provided deadline, the model
     * preparation must be aborted, and either {@link
     * preparation may be aborted, and either {@link
     * ErrorStatus::MISSED_DEADLINE_TRANSIENT}
     * or {@link ErrorStatus::MISSED_DEADLINE_PERSISTENT} must be returned. The
     * or {@link ErrorStatus::MISSED_DEADLINE_PERSISTENT} may be returned. The
     * error due to an abort must be sent the same way as other errors,
     * described above. If the service reports that it does not support
     * preparation deadlines via IDevice::supportsDeadlines, and
     * prepareModelFromCache_1_3 is called with a deadline, then the argument is
     * invalid, and {@link ErrorStatus::INVALID_ARGUMENT} must be returned.
     * described above.
     *
     * The only information that may be unknown to the model at this stage is
     * the shape of the tensors, which may only be known at execution time. As
@@ -279,9 +259,9 @@ interface IDevice extends @1.2::IDevice {
     * used with different shapes of inputs on different (possibly concurrent)
     * executions.
     *
     * @param deadline The time by which the model must be prepared. If the
     *     model cannot be prepared by the deadline, the preparation must be
     *     aborted.
     * @param deadline The time by which the model is expected to be prepared.
     *     If the model cannot be prepared by the deadline, the preparation may
     *     be aborted.
     * @param modelCache A vector of handles with each entry holding exactly one
     *     cache file descriptor for the security-sensitive cache. The length of
     *     the vector must match the numModelCache returned from getNumberOfCacheFilesNeeded.
@@ -307,8 +287,8 @@ interface IDevice extends @1.2::IDevice {
     *     - GENERAL_FAILURE if caching is not supported or if there is an
     *       unspecified error
     *     - INVALID_ARGUMENT if one of the input arguments is invalid
     *     - MISSED_DEADLINE_* if the deadline for preparing a model cannot be
     *       met
     *     - MISSED_DEADLINE_* if the preparation is aborted because the model
     *       cannot be prepared by the deadline
     *     - RESOURCE_EXHAUSTED_* if the task was aborted by the driver
     */
    prepareModelFromCache_1_3(OptionalTimePoint deadline,
+2 −1
Original line number Diff line number Diff line
@@ -47,7 +47,8 @@ interface IExecutionCallback extends @1.2::IExecutionCallback {
     *                 corresponding output
     *               - INVALID_ARGUMENT if one of the input arguments to
     *                 prepareModel is invalid
     *               - MISSED_DEADLINE_* if the deadline could not be met
     *               - MISSED_DEADLINE_* if the execution is aborted because it
     *                 cannot be completed by the deadline
     *               - RESOURCE_EXHAUSTED_* if the task was aborted by the driver
     * @param outputShapes A list of shape information of model output operands.
     *                     The index into "outputShapes" corresponds with to index
+2 −2
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@ interface IFencedExecutionCallback {
     *                - DEVICE_UNAVAILABLE if driver is offline or busy
     *                - GENERAL_FAILURE if the asynchronous task resulted in an
     *                  unspecified error
     *                - MISSED_DEADLINE_* if the deadline for executing a model
     *                  cannot be met
     *                - MISSED_DEADLINE_* if the execution is aborted because it
     *                  cannot be completed by the deadline
     *                - RESOURCE_EXHAUSTED_* if the task was aborted by the
     *                  driver
     * @return timingLaunched The duration starts when executeFenced is called and ends when
+27 −39
Original line number Diff line number Diff line
@@ -70,14 +70,10 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     *
     * execute_1_3 can be called with an optional deadline. If the execution
     * is not able to be completed before the provided deadline, the execution
     * must be aborted, and either {@link
     * may be aborted, and either {@link
     * ErrorStatus::MISSED_DEADLINE_TRANSIENT} or {@link
     * ErrorStatus::MISSED_DEADLINE_PERSISTENT} must be returned. The error due
     * ErrorStatus::MISSED_DEADLINE_PERSISTENT} may be returned. The error due
     * to an abort must be sent the same way as other errors, described above.
     * If the service reports that it does not support execution deadlines via
     * IDevice::supportsDeadlines, and execute_1_3 is called with a deadline,
     * then the argument is invalid, and {@link ErrorStatus::INVALID_ARGUMENT}
     * must be returned.
     *
     * Any number of calls to the execute* and executeSynchronously* functions,
     * in any combination, may be made concurrently, even on the same
@@ -89,9 +85,9 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     *                The duration runs from the time the driver sees the call
     *                to the execute_1_3 function to the time the driver invokes
     *                the callback.
     * @param deadline The time by which the execution must complete. If the
     *                 execution cannot be finished by the deadline, the
     *                 execution must be aborted.
     * @param deadline The time by which the execution is expected to complete.
     *                 If the execution cannot be completed by the deadline, the
     *                 execution may be aborted.
     * @param loopTimeoutDuration The maximum amount of time that should be spent
     *                            executing a {@link OperationType::WHILE}
     *                            operation. If a loop condition model does not
@@ -116,8 +112,8 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     *                  not large enough to store the resultant values
     *                - INVALID_ARGUMENT if one of the input arguments is
     *                  invalid
     *                - MISSED_DEADLINE_* if the deadline for executing a model
     *                  cannot be met
     *                - MISSED_DEADLINE_* if the execution is aborted because it
     *                  cannot be completed by the deadline
     *                - RESOURCE_EXHAUSTED_* if the task was aborted by the
     *                  driver
     */
@@ -150,16 +146,12 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     * (ErrorStatus::NONE): There must be no failure unless the device itself is
     * in a bad state.
     *
     * executeSynchronously_1_3 can be called with an optional deadline. If the
     * executeSynchronously_1_3 may be called with an optional deadline. If the
     * execution is not able to be completed before the provided deadline, the
     * execution must be aborted, and either {@link
     * execution may be aborted, and either {@link
     * ErrorStatus::MISSED_DEADLINE_TRANSIENT} or {@link
     * ErrorStatus::MISSED_DEADLINE_PERSISTENT} must be returned. The error due
     * ErrorStatus::MISSED_DEADLINE_PERSISTENT} may be returned. The error due
     * to an abort must be sent the same way as other errors, described above.
     * If the service reports that it does not support execution deadlines via
     * IDevice::supportsDeadlines, and executeSynchronously_1_3 is called with a
     * deadline, then the argument is invalid, and
     * {@link ErrorStatus::INVALID_ARGUMENT} must be returned.
     *
     * Any number of calls to the execute* and executeSynchronously* functions,
     * in any combination, may be made concurrently, even on the same
@@ -171,9 +163,9 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     *                The duration runs from the time the driver sees the call
     *                to the executeSynchronously_1_3 function to the time the driver
     *                returns from the function.
     * @param deadline The time by which the execution must complete. If the
     *                 execution cannot be finished by the deadline, the
     *                 execution must be aborted.
     * @param deadline The time by which the execution is expected to complete.
     *                 If the execution cannot be finished by the deadline, the
     *                 execution may be aborted.
     * @param loopTimeoutDuration The maximum amount of time that should be spent
     *                            executing a {@link OperationType::WHILE}
     *                            operation. If a loop condition model does not
@@ -194,8 +186,8 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     *                  corresponding output
     *                - INVALID_ARGUMENT if one of the input arguments is
     *                  invalid
     *                - MISSED_DEADLINE_* if the deadline for executing a model
     *                  cannot be met
     *                - MISSED_DEADLINE_* if the execution is aborted because it
     *                  cannot be completed by the deadline
     *                - RESOURCE_EXHAUSTED_* if the task was aborted by the
     *                  driver
     * @return outputShapes A list of shape information of model output operands.
@@ -236,17 +228,13 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     * any data object referenced by 'request' (described by the
     * {@link @1.0::DataLocation} of a {@link @1.0::RequestArgument}).
     *
     * executeFenced can be called with an optional deadline and an optional duration.
     * executeFenced may be called with an optional deadline and an optional duration.
     * If the execution is not able to be completed before the provided deadline or
     * within the timeout duration (measured from when all sync fences in waitFor are
     * signaled), whichever comes earlier, the execution must be aborted, and either
     * signaled), whichever comes earlier, the execution may be aborted, and either
     * {@link ErrorStatus::MISSED_DEADLINE_TRANSIENT} or {@link
     * ErrorStatus::MISSED_DEADLINE_PERSISTENT} must be returned. The error due
     * ErrorStatus::MISSED_DEADLINE_PERSISTENT} may be returned. The error due
     * to an abort must be sent the same way as other errors, described above.
     * If the service reports that it does not support execution deadlines via
     * IDevice::supportsDeadlines, and executeFenced is called with a
     * deadline or duration, then the argument is invalid, and
     * {@link ErrorStatus::INVALID_ARGUMENT} must be returned.
     *
     * If any of the sync fences in waitFor changes to error status after the executeFenced
     * call succeeds, or the execution is aborted because it cannot finish before the deadline
@@ -263,9 +251,9 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     * @param waitFor A vector of sync fence file descriptors.
     *                Execution must not start until all sync fences have been signaled.
     * @param measure Specifies whether or not to measure duration of the execution.
     * @param deadline The time by which the execution must complete. If the
     *                 execution cannot be finished by the deadline, the
     *                 execution must be aborted.
     * @param deadline The time by which the execution is expected to complete.
     *                 If the execution cannot be finished by the deadline, the
     *                 execution may be aborted.
     * @param loopTimeoutDuration The maximum amount of time that should be spent
     *                            executing a {@link OperationType::WHILE}
     *                            operation. If a loop condition model does not
@@ -277,18 +265,18 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     *                            LoopTimeoutDurationNs::DEFAULT}. When
     *                            provided, the duration must not exceed {@link
     *                            LoopTimeoutDurationNs::MAXIMUM}.
     * @param duration The length of time within which the execution must
     *                 complete after all sync fences in waitFor are signaled. If the
     *                 execution cannot be finished within the duration, the execution
     *                 must be aborted.
     * @param duration The length of time within which the execution is expected
     *                 to complete after all sync fences in waitFor are signaled.
     *                 If the execution cannot be finished within the duration,
     *                 the execution may be aborted.
     * @return status Error status of the call, must be:
     *                - NONE if task is successfully launched
     *                - DEVICE_UNAVAILABLE if driver is offline or busy
     *                - GENERAL_FAILURE if there is an unspecified error
     *                - INVALID_ARGUMENT if one of the input arguments is invalid, including
     *                                   fences in error states.
     *                - MISSED_DEADLINE_* if the deadline for executing a model
     *                  cannot be met
     *                - MISSED_DEADLINE_* if the execution is aborted because it
     *                  cannot be completed by the deadline
     *                - RESOURCE_EXHAUSTED_* if the task was aborted by the
     *                  driver
     * @return syncFence The sync fence that will be signaled when the task is completed.
Loading