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

Commit a2bf06e9 authored by Slava Shklyaev's avatar Slava Shklyaev Committed by Android (Google) Code Review
Browse files

Merge "Add NNAPI loop timeout API"

parents 6b95246d f034bf9c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -674,9 +674,9 @@ a3eddd9bbdc87e8c22764070037dd1154f1cf006e6fba93364c4f85d4c134a19 android.hardwar
9db064ee44268a876be0367ff771e618362d39ec603b6ecab17e1575725fcd87 android.hardware.neuralnetworks@1.3::IDevice
4167dc3ad35e9cd0d2057d4868c7675ae2c3c9d05bbd614c1f5dccfa5fd68797 android.hardware.neuralnetworks@1.3::IExecutionCallback
2fa3679ad7c94b5e88724adcd560c561041068a4ca565c63830e68101988746a android.hardware.neuralnetworks@1.3::IFencedExecutionCallback
237b23b126a66f3432658020fed78cdd06ba6297459436fe6bae0ba753370833 android.hardware.neuralnetworks@1.3::IPreparedModel
43088ffc71945b463a7279262cfe2e290f6ed2f15d3fd6032798a3be299fb08f android.hardware.neuralnetworks@1.3::IPreparedModel
0439a1fbbec7f16e5e4c653d85ac685d51bfafbae15b8f8cca530acdd7d6a8ce android.hardware.neuralnetworks@1.3::IPreparedModelCallback
5e2a14b40dc11da9d478185838f4401b652739922d14cecea0a0ce4c1359fe21 android.hardware.neuralnetworks@1.3::types
306fda32ac969fd51d75d066352cadcb769944ec4823be4cdd3f86fdb9e97511 android.hardware.neuralnetworks@1.3::types
3e01d4446cd69fd1c48f8572efd97487bc179564b32bd795800b97bbe10be37b android.hardware.wifi@1.4::IWifi
c67aaf26a7a40d14ea61e70e20afacbd0bb906df1704d585ac8599fbb69dd44b android.hardware.wifi.hostapd@1.2::IHostapd
2b5a7ea572b736030c64a3b4043af244425477c4672301780fe15aba5ed393d9 android.hardware.wifi.hostapd@1.2::types
+38 −3
Original line number Diff line number Diff line
@@ -92,6 +92,17 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     * @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 loopTimeoutDuration The maximum amount of time that should be spent
     *                            executing a {@link OperationType::WHILE}
     *                            operation. If a loop condition model does not
     *                            output false within this duration, the
     *                            execution must be aborted. If the model
     *                            contains a {@link OperationType::WHILE}
     *                            operation and no loop timeout duration is
     *                            provided, the maximum amount of time is {@link
     *                            LoopTimeoutDurationNs::DEFAULT}. When
     *                            provided, the duration must not exceed {@link
     *                            LoopTimeoutDurationNs::MAXIMUM}.
     * @param callback A callback object used to return the error status of
     *                 the execution, shape information of model output operands, and
     *                 duration of execution. The callback object's notify function must
@@ -111,7 +122,7 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     *                  driver
     */
    execute_1_3(Request request, MeasureTiming measure, OptionalTimePoint deadline,
                IExecutionCallback callback)
                OptionalTimeoutDuration loopTimeoutDuration, IExecutionCallback callback)
        generates (ErrorStatus status);

    /**
@@ -163,6 +174,17 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     * @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 loopTimeoutDuration The maximum amount of time that should be spent
     *                            executing a {@link OperationType::WHILE}
     *                            operation. If a loop condition model does not
     *                            output false within this duration, the
     *                            execution must be aborted. If the model
     *                            contains a {@link OperationType::WHILE}
     *                            operation and no loop timeout duration is
     *                            provided, the maximum amount of time is {@link
     *                            LoopTimeoutDurationNs::DEFAULT}. When
     *                            provided, the duration must not exceed {@link
     *                            LoopTimeoutDurationNs::MAXIMUM}.
     * @return status Error status of the execution, must be:
     *                - NONE if execution is performed successfully
     *                - DEVICE_UNAVAILABLE if driver is offline or busy
@@ -187,7 +209,8 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     *                measurement is not available.
     */
    executeSynchronously_1_3(Request request, MeasureTiming measure,
                             OptionalTimePoint deadline)
                             OptionalTimePoint deadline,
                             OptionalTimeoutDuration loopTimeoutDuration)
                  generates (ErrorStatus status, vec<OutputShape> outputShapes,
                             Timing timing);

@@ -243,6 +266,17 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     * @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 loopTimeoutDuration The maximum amount of time that should be spent
     *                            executing a {@link OperationType::WHILE}
     *                            operation. If a loop condition model does not
     *                            output false within this duration, the
     *                            execution must be aborted. If the model
     *                            contains a {@link OperationType::WHILE}
     *                            operation and no loop timeout duration is
     *                            provided, the maximum amount of time is {@link
     *                            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
@@ -264,6 +298,7 @@ interface IPreparedModel extends @1.2::IPreparedModel {
     *                  and error status when the execution is completed.
     */
    executeFenced(Request request, vec<handle> waitFor, MeasureTiming measure,
                  OptionalTimePoint deadline, OptionalTimeoutDuration duration)
                  OptionalTimePoint deadline, OptionalTimeoutDuration loopTimeoutDuration,
                  OptionalTimeoutDuration duration)
        generates (ErrorStatus status, handle syncFence, IFencedExecutionCallback callback);
};
+11 −0
Original line number Diff line number Diff line
@@ -5671,3 +5671,14 @@ enum ErrorStatus : @1.0::ErrorStatus {
     */
    RESOURCE_EXHAUSTED_PERSISTENT,
};

/**
 * Each {@link OperationType::WHILE} operation in the model has an implicit
 * execution timeout duration associated with it ("loop timeout duration").
 * This duration is configurable on a per-execution basis and must not exceed
 * 15 seconds. The default value is 2 seconds.
 */
enum LoopTimeoutDurationNs : uint64_t {
    DEFAULT = 2000000000,
    MAXIMUM = 15000000000,
};
+11 −0
Original line number Diff line number Diff line
@@ -598,3 +598,14 @@ enum ErrorStatus : @1.0::ErrorStatus {
     */
    RESOURCE_EXHAUSTED_PERSISTENT,
};

/**
 * Each {@link OperationType::WHILE} operation in the model has an implicit
 * execution timeout duration associated with it ("loop timeout duration").
 * This duration is configurable on a per-execution basis and must not exceed
 * 15 seconds. The default value is 2 seconds.
 */
enum LoopTimeoutDurationNs : uint64_t {
    DEFAULT = 2000000000,
    MAXIMUM = 15000000000,
};
+3 −3
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ static std::vector<TestBuffer> getOutputBuffers(const TestModel& testModel, cons
static Return<ErrorStatus> ExecutePreparedModel(const sp<IPreparedModel>& preparedModel,
                                                const Request& request, MeasureTiming measure,
                                                sp<ExecutionCallback>& callback) {
    return preparedModel->execute_1_3(request, measure, {}, callback);
    return preparedModel->execute_1_3(request, measure, {}, {}, callback);
}
static Return<ErrorStatus> ExecutePreparedModel(const sp<IPreparedModel>& preparedModel,
                                                const Request& request, MeasureTiming measure,
@@ -504,7 +504,7 @@ static Return<ErrorStatus> ExecutePreparedModel(const sp<IPreparedModel>& prepar
                                                Timing* timing) {
    ErrorStatus result;
    Return<void> ret = preparedModel->executeSynchronously_1_3(
            request, measure, {},
            request, measure, {}, {},
            [&result, outputShapes, timing](ErrorStatus error, const hidl_vec<OutputShape>& shapes,
                                            const Timing& time) {
                result = error;
@@ -612,7 +612,7 @@ void EvaluatePreparedModel(const sp<IDevice>& device, const sp<IPreparedModel>&
            hidl_handle syncFenceHandle;
            sp<IFencedExecutionCallback> fencedCallback;
            Return<void> ret = preparedModel->executeFenced(
                    request, {}, testConfig.measureTiming, {}, {},
                    request, {}, testConfig.measureTiming, {}, {}, {},
                    [&result, &syncFenceHandle, &fencedCallback](
                            ErrorStatus error, const hidl_handle& handle,
                            const sp<IFencedExecutionCallback>& callback) {
Loading