blob: a7c33420932c09435e6ab4b5f302d13041fb5e69 [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.
39 * prepared model.
40 * @param event A callback used for synchronization that must be signaled
41 * once the execution has finished.
42 * @return status ErrorStatus::NONE if the asynchronous task was
43 * successfully launched.
44 */
Michael Butler61ae6ed2017-09-11 20:27:50 -070045 execute(Request request, IEvent event) generates (ErrorStatus status);
Michael Butler376ec0c2017-07-27 18:28:20 -070046};