1/* 2 * Copyright (C) 2020 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::Timing; 20import ErrorStatus; 21 22/** 23 * IFencedExecutionCallback can be used to query the error status result 24 * and duration information from an IPreparedModel::executeFenced call. 25 */ 26interface IFencedExecutionCallback { 27 28 /** 29 * The getExecutionInfo method is used by the clients to query error status 30 * result and duration information. The method must only be called after the actual 31 * evaluation has finished or resulted in an runtime error, as indicated by the status 32 * of the sync fence returned by the IPreparedModel::executeFenced call, otherwise 33 * GENERAL_FAILURE must be returned. 34 * 35 * @return status Error status returned from the asynchronously dispatched execution 36 * must be: 37 * - NONE if the asynchronous execution was successful 38 * - DEVICE_UNAVAILABLE if driver is offline or busy 39 * - GENERAL_FAILURE if the asynchronous task resulted in an 40 * unspecified error 41 * - MISSED_DEADLINE_* if the execution is aborted because it 42 * cannot be completed by the deadline 43 * - RESOURCE_EXHAUSTED_* if the task was aborted by the 44 * driver 45 * @return timingLaunched The duration starts when executeFenced is called and ends when 46 * executeFenced signals the returned syncFence. 47 * Unless MeasureTiming::YES was passed when 48 * launching the execution and status is NONE, all times 49 * must be reported as UINT64_MAX. A driver may choose to 50 * report any time as UINT64_MAX, indicating that particular 51 * measurement is not available. 52 * @return timingFenced The duration starts when all waitFor sync fences have been signaled 53 * and ends when executeFenced signals the returned syncFence. 54 * Unless MeasureTiming::YES was passed when 55 * launching the execution and status is NONE, all times 56 * must be reported as UINT64_MAX. A driver may choose to 57 * report any time as UINT64_MAX, indicating that particular 58 * measurement is not available. 59 */ 60 getExecutionInfo() generates (ErrorStatus status, Timing timingLaunched, Timing timingFenced); 61}; 62