1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.neuralnetworks@1.2;
18
19import @1.0::ErrorStatus;
20import @1.0::IExecutionCallback;
21
22/**
23 * IExecutionCallback must be used to return the error status result from an
24 * execution asynchronously launched from IPreparedModel::execute.
25 */
26interface IExecutionCallback extends @1.0::IExecutionCallback {
27
28    /**
29     * Either notify_1_2 or notify must be invoked immediately after the asynchronous
30     * task has finished performing the execution. Either notify_1_2 or notify must be
31     * provided with the ErrorStatus from the execution. If the asynchronous task is
32     * not launched, either notify_1_2 or notify must be invoked with the appropriate
33     * error.
34     *
35     * @param status Error status returned from launching the asynchronous task
36     *               (if the launch fails) or from the asynchronous task itself
37     *               (if the launch succeeds). Must be:
38     *               - NONE if the asynchronous execution was successful
39     *               - DEVICE_UNAVAILABLE if driver is offline or busy
40     *               - GENERAL_FAILURE if the asynchronous task resulted in an
41     *                 unspecified error
42     *               - OUTPUT_INSUFFICIENT_SIZE if at least one output
43     *                 operand buffer is not large enough to store the
44     *                 corresponding output
45     *               - INVALID_ARGUMENT if one of the input arguments to
46     *                 prepareModel is invalid
47     * @param outputShapes A list of shape information of model output operands.
48     *                     The index into "outputShapes" corresponds with to index
49     *                     of the output operand in the Request outputs vector.
50     *                     outputShapes must be empty unless the status is either
51     *                     NONE or OUTPUT_INSUFFICIENT_SIZE.
52     * @return Timing Duration of execution. Unless MeasureTiming::YES was passed when
53     *                launching the execution and status is NONE, all times must
54     *                be reported as UINT64_MAX. A driver may choose to report
55     *                any time as UINT64_MAX, indicating that particular measurement is
56     *                not available.
57     */
58  oneway notify_1_2(ErrorStatus status, vec<OutputShape> outputShapes, Timing timing);
59};
60