Michael Butler | 0e2ac1b | 2017-09-01 10:59:38 -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 | |
| 17 | /* This HAL is a work in progress */ |
| 18 | |
| 19 | package android.hardware.neuralnetworks@1.0; |
| 20 | |
| 21 | /** |
| 22 | * The IEvent interface is a callback object passed by the |
| 23 | * Neuralnetworks runtime to the vendor service. It is used as a |
| 24 | * synchronization primitive between one or more runtime threads and a |
| 25 | * single asynchronous vendor thread. An event object is passed as an |
| 26 | * argument to a HIDL call that is expected to take a non-trivial |
| 27 | * amount of time. When the asynchronous execution thread has |
| 28 | * completed its computation, it must call "notify" on the event to |
| 29 | * indicate to the Neuralnetworks runtime whether the computation was |
| 30 | * successful or not, and that the corresponding output is ready to be |
| 31 | * consumed if the execution was successful. |
| 32 | * |
| 33 | * TODO: Mention that "notify" is also called by a runtime thread |
| 34 | * during CPU fallback execution? Depends on whether the HIDL comments |
| 35 | * are strictly for vendors or not. |
| 36 | */ |
| 37 | interface IEvent { |
| 38 | |
| 39 | /** |
| 40 | * IEvent::notify is called by the server thread (i.e. the thread doing the |
| 41 | * work) to mark the event as completed so that any threads requiring the |
| 42 | * corresponding resources can continue executing. |
| 43 | * |
| 44 | * @param status Status of the execution associated with the Event. |
| 45 | * Should be SUCCESS or ERROR. |
| 46 | */ |
| 47 | oneway notify(Status status); |
| 48 | |
| 49 | }; |