blob: 5df883e1d2b3fabdbd906a41df4af3867046bdec [file] [log] [blame]
Michael Butler376ec0c2017-07-27 18:28:20 -07001/*
2 * Copyright (C) 2017 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
Michael Butler376ec0c2017-07-27 18:28:20 -070017package android.hardware.neuralnetworks@1.0;
18
Michael Butler0e2ac1b2017-09-01 10:59:38 -070019import IEvent;
20
Michael Butlerc7821102017-09-11 16:03:36 -070021/**
22 * IPreparedModel describes a model that has been prepared for execution and
23 * is used to launch executions.
24 */
Michael Butler376ec0c2017-07-27 18:28:20 -070025interface IPreparedModel {
Michael Butlerc7821102017-09-11 16:03:36 -070026 /**
27 * Spawns an asynchronous execution on a prepared model.
28 *
29 * Executions are asynchronous with respect to the Neuralnetworks runtime.
30 * To support this, IPreparedModel::execute must spawn a new task and return
31 * whether the task was successfully launched. The asynchronous task which
32 * performs the execution must call event's IEvent::notify with the status
33 * of the execution immediately after the execution has finished.
34 *
35 * Multiple threads can call this execute function concurrently.
36 *
37 * @param request The input and output information on which the prepared
38 * model is to be executed.
Michael Butlerc7821102017-09-11 16:03:36 -070039 * @param event A callback used for synchronization that must be signaled
40 * once the execution has finished.
Michael Butler926df1e2017-09-19 16:26:47 -070041 * @return status Error status of the call, must be:
42 * - NONE if task is successfully launched
43 * - DEVICE_UNAVAILABLE if driver is offline or busy
44 * - GENERAL_FAILURE if there is an unspecified error
45 * - OUTPUT_INSUFFICIENT_SIZE if provided output buffer is
46 * not large enough to store the resultant values
47 * - INVALID_ARGUMENT when one of the input arguments is
48 * invalid
Michael Butlerc7821102017-09-11 16:03:36 -070049 */
Michael Butler61ae6ed2017-09-11 20:27:50 -070050 execute(Request request, IEvent event) generates (ErrorStatus status);
Michael Butler376ec0c2017-07-27 18:28:20 -070051};