1/* 2 * Copyright (C) 2019 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.3; 18 19import @1.2::IExecutionCallback; 20import @1.2::OutputShape; 21import @1.2::Timing; 22 23/** 24 * IExecutionCallback must be used to return the error status result from an 25 * execution asynchronously launched from IPreparedModel::execute*. 26 */ 27interface IExecutionCallback extends @1.2::IExecutionCallback { 28 29 /** 30 * There are three notify methods declared for the IExecutionCallback 31 * interface: notify_1_3, notify_1_2, and notify. One of the three notify 32 * methods must be invoked immediately after the asynchronous task has 33 * finished performing the execution. One of the notify methods must be 34 * provided with the ErrorStatus from the execution. If the asynchronous 35 * task is not launched, one of the notify methods must be invoked with the 36 * appropriate error. 37 * 38 * @param status Error status returned from launching the asynchronous task 39 * (if the launch fails) or from the asynchronous task itself 40 * (if the launch succeeds). Must be: 41 * - NONE if the asynchronous execution was successful 42 * - DEVICE_UNAVAILABLE if driver is offline or busy 43 * - GENERAL_FAILURE if the asynchronous task resulted in an 44 * unspecified error 45 * - OUTPUT_INSUFFICIENT_SIZE if at least one output 46 * operand buffer is not large enough to store the 47 * corresponding output 48 * - INVALID_ARGUMENT if one of the input arguments to 49 * prepareModel is invalid 50 * - MISSED_DEADLINE_* if the execution is aborted because it 51 * cannot be completed by the deadline 52 * - RESOURCE_EXHAUSTED_* if the task was aborted by the driver 53 * @param outputShapes A list of shape information of model output operands. 54 * The index into "outputShapes" corresponds with to index 55 * of the output operand in the Request outputs vector. 56 * outputShapes must be empty unless the status is either 57 * NONE or OUTPUT_INSUFFICIENT_SIZE. 58 * @param timing Duration of execution. Unless MeasureTiming::YES was passed when 59 * launching the execution and status is NONE, all times must 60 * be reported as UINT64_MAX. A driver may choose to report 61 * any time as UINT64_MAX, indicating that particular measurement is 62 * not available. 63 */ 64 oneway notify_1_3(ErrorStatus status, vec<OutputShape> outputShapes, Timing timing); 65}; 66