Michael Butler | 376ec0c | 2017-07-27 18:28:20 -0700 | [diff] [blame] | 1 | /* |
| 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 Butler | 376ec0c | 2017-07-27 18:28:20 -0700 | [diff] [blame] | 17 | package android.hardware.neuralnetworks@1.0; |
| 18 | |
Michael Butler | 0e2ac1b | 2017-09-01 10:59:38 -0700 | [diff] [blame] | 19 | import IEvent; |
| 20 | |
Michael Butler | c782110 | 2017-09-11 16:03:36 -0700 | [diff] [blame] | 21 | /** |
| 22 | * IPreparedModel describes a model that has been prepared for execution and |
| 23 | * is used to launch executions. |
| 24 | */ |
Michael Butler | 376ec0c | 2017-07-27 18:28:20 -0700 | [diff] [blame] | 25 | interface IPreparedModel { |
Michael Butler | c782110 | 2017-09-11 16:03:36 -0700 | [diff] [blame] | 26 | /** |
| 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 Butler | 61ae6ed | 2017-09-11 20:27:50 -0700 | [diff] [blame] | 45 | execute(Request request, IEvent event) generates (ErrorStatus status); |
Michael Butler | 376ec0c | 2017-07-27 18:28:20 -0700 | [diff] [blame] | 46 | }; |