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