/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.neuralnetworks@1.3;

import @1.2::Timing;
import ErrorStatus;

/**
 * IFencedExecutionCallback can be used to query the error status result
 * and duration information from an IPreparedModel::executeFenced call.
 */
interface IFencedExecutionCallback {

    /**
     * The getExecutionInfo method is used by the clients to query error status
     * result and duration information. The method must only be called after the actual
     * evaluation has finished or resulted in an runtime error, as indicated by the status
     * of the sync fence returned by the IPreparedModel::executeFenced call, otherwise
     * GENERAL_FAILURE must be returned.
     *
     * @return status Error status returned from the asynchronously dispatched execution
     *                must be:
     *                - NONE if the asynchronous execution was successful
     *                - DEVICE_UNAVAILABLE if driver is offline or busy
     *                - GENERAL_FAILURE if the asynchronous task resulted in an
     *                  unspecified error
     *                - MISSED_DEADLINE_* if the execution is aborted because it
     *                  cannot be completed by the deadline
     *                - RESOURCE_EXHAUSTED_* if the task was aborted by the
     *                  driver
     * @return timingLaunched The duration starts when executeFenced is called and ends when
     *                        executeFenced signals the returned syncFence.
     *                        Unless MeasureTiming::YES was passed when
     *                        launching the execution and status is NONE, all times
     *                        must be reported as UINT64_MAX. A driver may choose to
     *                        report any time as UINT64_MAX, indicating that particular
     *                        measurement is not available.
     * @return timingFenced The duration starts when all waitFor sync fences have been signaled
     *                      and ends when executeFenced signals the returned syncFence.
     *                      Unless MeasureTiming::YES was passed when
     *                      launching the execution and status is NONE, all times
     *                      must be reported as UINT64_MAX. A driver may choose to
     *                      report any time as UINT64_MAX, indicating that particular
     *                      measurement is not available.
     */
    getExecutionInfo() generates (ErrorStatus status, Timing timingLaunched, Timing timingFenced);
};
