Xusong Wang | 62a760c | 2019-10-25 12:07:17 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | package android.hardware.neuralnetworks@1.3; |
| 18 | |
Xusong Wang | 62a760c | 2019-10-25 12:07:17 -0700 | [diff] [blame] | 19 | import @1.2::IPreparedModel; |
Xusong Wang | ebd88ba | 2019-10-28 11:11:19 -0700 | [diff] [blame] | 20 | import @1.2::MeasureTiming; |
| 21 | import @1.2::OutputShape; |
| 22 | import @1.2::Timing; |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 23 | import ErrorStatus; |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 24 | import OptionalTimeoutDuration; |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 25 | import OptionalTimePoint; |
Xusong Wang | 931d5a1 | 2019-11-27 12:46:48 -0800 | [diff] [blame] | 26 | import Request; |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 27 | import IExecutionCallback; |
Miao Wang | 90cf3dd | 2019-11-12 14:02:16 -0800 | [diff] [blame] | 28 | import IFencedExecutionCallback; |
Xusong Wang | 62a760c | 2019-10-25 12:07:17 -0700 | [diff] [blame] | 29 | |
| 30 | /** |
| 31 | * IPreparedModel describes a model that has been prepared for execution and |
| 32 | * is used to launch executions. |
| 33 | */ |
| 34 | interface IPreparedModel extends @1.2::IPreparedModel { |
| 35 | /** |
| 36 | * Launches an asynchronous execution on a prepared model. |
| 37 | * |
| 38 | * The execution is performed asynchronously with respect to the caller. |
Xusong Wang | 931d5a1 | 2019-11-27 12:46:48 -0800 | [diff] [blame] | 39 | * execute_1_3 must verify the inputs to the function are correct, and the usages |
| 40 | * of memory pools allocated by IDevice::allocate are valid. If there is |
Xusong Wang | 62a760c | 2019-10-25 12:07:17 -0700 | [diff] [blame] | 41 | * an error, execute_1_3 must immediately invoke the callback with the |
| 42 | * appropriate ErrorStatus value, then return with the same ErrorStatus. If |
| 43 | * the inputs to the function are valid and there is no error, execute_1_3 must |
| 44 | * launch an asynchronous task to perform the execution in the background, |
| 45 | * and immediately return with ErrorStatus::NONE. If the asynchronous task |
| 46 | * fails to launch, execute_1_3 must immediately invoke the callback with |
| 47 | * ErrorStatus::GENERAL_FAILURE, then return with |
| 48 | * ErrorStatus::GENERAL_FAILURE. |
| 49 | * |
| 50 | * When the asynchronous task has finished its execution, it must |
| 51 | * immediately invoke the callback object provided as an input to the |
| 52 | * execute_1_3 function. This callback must be provided with the ErrorStatus of |
| 53 | * the execution. |
| 54 | * |
| 55 | * If the launch is successful, the caller must not change the content of |
| 56 | * any data object referenced by 'request' (described by the |
| 57 | * {@link @1.0::DataLocation} of a {@link @1.0::RequestArgument}) until the |
| 58 | * asynchronous task has invoked the callback object. The asynchronous task |
| 59 | * must not change the content of any of the data objects corresponding to |
| 60 | * 'request' inputs. |
| 61 | * |
| 62 | * If the prepared model was prepared from a model wherein all tensor |
| 63 | * operands have fully specified dimensions, and the inputs to the function |
| 64 | * are valid, then: |
| 65 | * - the execution should launch successfully (ErrorStatus::NONE): There |
| 66 | * must be no failure unless the device itself is in a bad state. |
| 67 | * - if at execution time every operation's input operands have legal |
| 68 | * values, the execution should complete successfully (ErrorStatus::NONE): |
| 69 | * There must be no failure unless the device itself is in a bad state. |
| 70 | * |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 71 | * execute_1_3 can be called with an optional deadline. If the execution |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 72 | * is not able to be completed before the provided deadline, the execution |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 73 | * may be aborted, and either {@link |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 74 | * ErrorStatus::MISSED_DEADLINE_TRANSIENT} or {@link |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 75 | * ErrorStatus::MISSED_DEADLINE_PERSISTENT} may be returned. The error due |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 76 | * to an abort must be sent the same way as other errors, described above. |
Michael Butler | b8cf54c | 2021-03-18 21:15:09 -0700 | [diff] [blame] | 77 | * The deadline is represented as nanoseconds since the epoch of the steady |
| 78 | * clock (as if from std::chrono::steady_clock::time_point), but the service |
| 79 | * may convert it to the nanoseconds since boot time (as if from |
| 80 | * clock_gettime(CLOCK_BOOTTIME, &ts) or |
| 81 | * android::base::boot_clock::time_point) to account for time when the |
| 82 | * system is suspended. This conversion can by done by finding the timeout |
| 83 | * duration remaining compared to the steady_clock and adding it to the |
| 84 | * current boot_clock time. |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 85 | * |
Xusong Wang | ebd88ba | 2019-10-28 11:11:19 -0700 | [diff] [blame] | 86 | * Any number of calls to the execute* and executeSynchronously* functions, |
| 87 | * in any combination, may be made concurrently, even on the same |
Xusong Wang | 62a760c | 2019-10-25 12:07:17 -0700 | [diff] [blame] | 88 | * IPreparedModel object. |
| 89 | * |
| 90 | * @param request The input and output information on which the prepared |
| 91 | * model is to be executed. |
| 92 | * @param measure Specifies whether or not to measure duration of the execution. |
| 93 | * The duration runs from the time the driver sees the call |
| 94 | * to the execute_1_3 function to the time the driver invokes |
| 95 | * the callback. |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 96 | * @param deadline The time by which the execution is expected to complete. |
| 97 | * If the execution cannot be completed by the deadline, the |
| 98 | * execution may be aborted. |
Slava Shklyaev | f034bf9 | 2020-02-11 14:27:02 +0000 | [diff] [blame] | 99 | * @param loopTimeoutDuration The maximum amount of time that should be spent |
| 100 | * executing a {@link OperationType::WHILE} |
| 101 | * operation. If a loop condition model does not |
| 102 | * output false within this duration, the |
Slava Shklyaev | 6a222a3 | 2020-04-07 13:20:47 +0100 | [diff] [blame] | 103 | * execution must be aborted. If no loop timeout |
| 104 | * duration is provided, the maximum amount of |
| 105 | * time is {@link LoopTimeoutDurationNs::DEFAULT}. |
| 106 | * When provided, the duration must not exceed |
| 107 | * {@link LoopTimeoutDurationNs::MAXIMUM}. |
Xusong Wang | 62a760c | 2019-10-25 12:07:17 -0700 | [diff] [blame] | 108 | * @param callback A callback object used to return the error status of |
Miao Wang | 90cf3dd | 2019-11-12 14:02:16 -0800 | [diff] [blame] | 109 | * the execution, shape information of model output operands, and |
| 110 | * duration of execution. The callback object's notify function must |
Xusong Wang | 62a760c | 2019-10-25 12:07:17 -0700 | [diff] [blame] | 111 | * be called exactly once, even if the execution was |
| 112 | * unsuccessful. |
| 113 | * @return status Error status of the call, must be: |
| 114 | * - NONE if task is successfully launched |
| 115 | * - DEVICE_UNAVAILABLE if driver is offline or busy |
| 116 | * - GENERAL_FAILURE if there is an unspecified error |
| 117 | * - OUTPUT_INSUFFICIENT_SIZE if provided output buffer is |
| 118 | * not large enough to store the resultant values |
| 119 | * - INVALID_ARGUMENT if one of the input arguments is |
| 120 | * invalid |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 121 | * - MISSED_DEADLINE_* if the execution is aborted because it |
| 122 | * cannot be completed by the deadline |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 123 | * - RESOURCE_EXHAUSTED_* if the task was aborted by the |
| 124 | * driver |
Xusong Wang | 62a760c | 2019-10-25 12:07:17 -0700 | [diff] [blame] | 125 | */ |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 126 | execute_1_3(Request request, MeasureTiming measure, OptionalTimePoint deadline, |
Slava Shklyaev | f034bf9 | 2020-02-11 14:27:02 +0000 | [diff] [blame] | 127 | OptionalTimeoutDuration loopTimeoutDuration, IExecutionCallback callback) |
Xusong Wang | 62a760c | 2019-10-25 12:07:17 -0700 | [diff] [blame] | 128 | generates (ErrorStatus status); |
Xusong Wang | ebd88ba | 2019-10-28 11:11:19 -0700 | [diff] [blame] | 129 | |
| 130 | /** |
| 131 | * Performs a synchronous execution on a prepared model. |
| 132 | * |
| 133 | * The execution is performed synchronously with respect to the caller. |
| 134 | * executeSynchronously_1_3 must verify the inputs to the function are |
Xusong Wang | 931d5a1 | 2019-11-27 12:46:48 -0800 | [diff] [blame] | 135 | * correct, and the usages of memory pools allocated by IDevice::allocate |
| 136 | * are valid. If there is an error, executeSynchronously_1_3 must immediately |
Xusong Wang | ebd88ba | 2019-10-28 11:11:19 -0700 | [diff] [blame] | 137 | * return with the appropriate ErrorStatus value. If the inputs to the |
| 138 | * function are valid and there is no error, executeSynchronously_1_3 must |
| 139 | * perform the execution, and must not return until the execution is |
| 140 | * complete. |
| 141 | * |
| 142 | * The caller must not change the content of any data object referenced by |
| 143 | * 'request' (described by the {@link @1.0::DataLocation} of a |
| 144 | * {@link @1.0::RequestArgument}) until executeSynchronously_1_3 |
| 145 | * returns. executeSynchronously_1_3 must not change the content of any of the |
| 146 | * data objects corresponding to 'request' inputs. |
| 147 | * |
| 148 | * If the prepared model was prepared from a model wherein all tensor |
| 149 | * operands have fully specified dimensions, and the inputs to the function |
| 150 | * are valid, and at execution time every operation's input operands have |
| 151 | * legal values, then the execution should complete successfully |
| 152 | * (ErrorStatus::NONE): There must be no failure unless the device itself is |
| 153 | * in a bad state. |
| 154 | * |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 155 | * executeSynchronously_1_3 may be called with an optional deadline. If the |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 156 | * execution is not able to be completed before the provided deadline, the |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 157 | * execution may be aborted, and either {@link |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 158 | * ErrorStatus::MISSED_DEADLINE_TRANSIENT} or {@link |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 159 | * ErrorStatus::MISSED_DEADLINE_PERSISTENT} may be returned. The error due |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 160 | * to an abort must be sent the same way as other errors, described above. |
Michael Butler | b8cf54c | 2021-03-18 21:15:09 -0700 | [diff] [blame] | 161 | * The deadline is represented as nanoseconds since the epoch of the steady |
| 162 | * clock (as if from std::chrono::steady_clock::time_point), but the service |
| 163 | * may convert it to the nanoseconds since boot time (as if from |
| 164 | * clock_gettime(CLOCK_BOOTTIME, &ts) or |
| 165 | * android::base::boot_clock::time_point) to account for time when the |
| 166 | * system is suspended. This conversion can by done by finding the timeout |
| 167 | * duration remaining compared to the steady_clock and adding it to the |
| 168 | * current boot_clock time. |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 169 | * |
Xusong Wang | ebd88ba | 2019-10-28 11:11:19 -0700 | [diff] [blame] | 170 | * Any number of calls to the execute* and executeSynchronously* functions, |
| 171 | * in any combination, may be made concurrently, even on the same |
| 172 | * IPreparedModel object. |
| 173 | * |
| 174 | * @param request The input and output information on which the prepared |
| 175 | * model is to be executed. |
| 176 | * @param measure Specifies whether or not to measure duration of the execution. |
| 177 | * The duration runs from the time the driver sees the call |
| 178 | * to the executeSynchronously_1_3 function to the time the driver |
| 179 | * returns from the function. |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 180 | * @param deadline The time by which the execution is expected to complete. |
| 181 | * If the execution cannot be finished by the deadline, the |
| 182 | * execution may be aborted. |
Slava Shklyaev | f034bf9 | 2020-02-11 14:27:02 +0000 | [diff] [blame] | 183 | * @param loopTimeoutDuration The maximum amount of time that should be spent |
| 184 | * executing a {@link OperationType::WHILE} |
| 185 | * operation. If a loop condition model does not |
| 186 | * output false within this duration, the |
Slava Shklyaev | 6a222a3 | 2020-04-07 13:20:47 +0100 | [diff] [blame] | 187 | * execution must be aborted. If no loop timeout |
| 188 | * duration is provided, the maximum amount of |
| 189 | * time is {@link LoopTimeoutDurationNs::DEFAULT}. |
| 190 | * When provided, the duration must not exceed |
| 191 | * {@link LoopTimeoutDurationNs::MAXIMUM}. |
Xusong Wang | ebd88ba | 2019-10-28 11:11:19 -0700 | [diff] [blame] | 192 | * @return status Error status of the execution, must be: |
| 193 | * - NONE if execution is performed successfully |
| 194 | * - DEVICE_UNAVAILABLE if driver is offline or busy |
| 195 | * - GENERAL_FAILURE if there is an unspecified error |
| 196 | * - OUTPUT_INSUFFICIENT_SIZE if at least one output |
| 197 | * operand buffer is not large enough to store the |
| 198 | * corresponding output |
| 199 | * - INVALID_ARGUMENT if one of the input arguments is |
| 200 | * invalid |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 201 | * - MISSED_DEADLINE_* if the execution is aborted because it |
| 202 | * cannot be completed by the deadline |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 203 | * - RESOURCE_EXHAUSTED_* if the task was aborted by the |
| 204 | * driver |
Xusong Wang | ebd88ba | 2019-10-28 11:11:19 -0700 | [diff] [blame] | 205 | * @return outputShapes A list of shape information of model output operands. |
| 206 | * The index into "outputShapes" corresponds to the index |
| 207 | * of the output operand in the Request outputs vector. |
| 208 | * outputShapes must be empty unless the status is either |
| 209 | * NONE or OUTPUT_INSUFFICIENT_SIZE. |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 210 | * @return timing Duration of execution. Unless measure is YES and status is |
Xusong Wang | ebd88ba | 2019-10-28 11:11:19 -0700 | [diff] [blame] | 211 | * NONE, all times must be reported as UINT64_MAX. A driver may |
| 212 | * choose to report any time as UINT64_MAX, indicating that |
| 213 | * measurement is not available. |
| 214 | */ |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 215 | executeSynchronously_1_3(Request request, MeasureTiming measure, |
Slava Shklyaev | f034bf9 | 2020-02-11 14:27:02 +0000 | [diff] [blame] | 216 | OptionalTimePoint deadline, |
| 217 | OptionalTimeoutDuration loopTimeoutDuration) |
Michael Butler | c2499ec | 2019-12-11 18:31:12 -0800 | [diff] [blame] | 218 | generates (ErrorStatus status, vec<OutputShape> outputShapes, |
| 219 | Timing timing); |
Miao Wang | 90cf3dd | 2019-11-12 14:02:16 -0800 | [diff] [blame] | 220 | |
| 221 | /** |
| 222 | * Launch a fenced asynchronous execution on a prepared model. |
| 223 | * |
| 224 | * The execution is performed asynchronously with respect to the caller. |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 225 | * executeFenced must verify the inputs to the function are correct, and the usages |
| 226 | * of memory pools allocated by IDevice::allocate are valid. If there is an error, |
| 227 | * executeFenced must immediately return with the corresponding ErrorStatus, an empty |
| 228 | * handle for syncFence, and nullptr for callback. If the inputs to the function |
| 229 | * are valid and there is no error, executeFenced must dispatch an asynchronous task |
| 230 | * to perform the execution in the background, and immediately return with |
| 231 | * ErrorStatus::NONE, a sync fence that will be signaled once the execution is completed, |
| 232 | * and a callback that can be used by the client to query the duration and runtime error |
| 233 | * status. If the task has finished before the call returns, an empty handle may be returned |
| 234 | * for syncFence. The execution must wait for all the sync fences (if any) in waitFor |
| 235 | * to be signaled before starting the actual execution. |
Miao Wang | 90cf3dd | 2019-11-12 14:02:16 -0800 | [diff] [blame] | 236 | * |
| 237 | * When the asynchronous task has finished its execution, it must |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 238 | * immediately signal the syncFence returned from the executeFenced call. After |
| 239 | * the syncFence is signaled, the task must not modify the content of |
Miao Wang | 90cf3dd | 2019-11-12 14:02:16 -0800 | [diff] [blame] | 240 | * any data object referenced by 'request' (described by the |
| 241 | * {@link @1.0::DataLocation} of a {@link @1.0::RequestArgument}). |
| 242 | * |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 243 | * executeFenced may be called with an optional deadline and an optional duration. |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 244 | * If the execution is not able to be completed before the provided deadline or |
| 245 | * within the timeout duration (measured from when all sync fences in waitFor are |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 246 | * signaled), whichever comes earlier, the execution may be aborted, and either |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 247 | * {@link ErrorStatus::MISSED_DEADLINE_TRANSIENT} or {@link |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 248 | * ErrorStatus::MISSED_DEADLINE_PERSISTENT} may be returned. The error due |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 249 | * to an abort must be sent the same way as other errors, described above. |
Michael Butler | b8cf54c | 2021-03-18 21:15:09 -0700 | [diff] [blame] | 250 | * The deadline is represented as nanoseconds since the epoch of the steady |
| 251 | * clock (as if from std::chrono::steady_clock::time_point), but the service |
| 252 | * may convert it to the nanoseconds since boot time (as if from |
| 253 | * clock_gettime(CLOCK_BOOTTIME, &ts) or |
| 254 | * android::base::boot_clock::time_point) to account for time when the |
| 255 | * system is suspended. This conversion can by done by finding the timeout |
| 256 | * duration remaining compared to the steady_clock and adding it to the |
| 257 | * current boot_clock time. |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 258 | * |
| 259 | * If any of the sync fences in waitFor changes to error status after the executeFenced |
| 260 | * call succeeds, or the execution is aborted because it cannot finish before the deadline |
| 261 | * has been reached or the duration has elapsed, the driver must immediately set the returned |
| 262 | * syncFence to error status. |
| 263 | * |
Miao Wang | 90cf3dd | 2019-11-12 14:02:16 -0800 | [diff] [blame] | 264 | * Any number of calls to the executeFenced, execute* and executeSynchronously* |
| 265 | * functions, in any combination, may be made concurrently, even on the same |
| 266 | * IPreparedModel object. |
| 267 | * |
| 268 | * @param request The input and output information on which the prepared |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 269 | * model is to be executed. The outputs in the request must have |
| 270 | * fully specified dimensions. |
Miao Wang | 90cf3dd | 2019-11-12 14:02:16 -0800 | [diff] [blame] | 271 | * @param waitFor A vector of sync fence file descriptors. |
| 272 | * Execution must not start until all sync fences have been signaled. |
| 273 | * @param measure Specifies whether or not to measure duration of the execution. |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 274 | * @param deadline The time by which the execution is expected to complete. |
| 275 | * If the execution cannot be finished by the deadline, the |
| 276 | * execution may be aborted. |
Slava Shklyaev | f034bf9 | 2020-02-11 14:27:02 +0000 | [diff] [blame] | 277 | * @param loopTimeoutDuration The maximum amount of time that should be spent |
| 278 | * executing a {@link OperationType::WHILE} |
| 279 | * operation. If a loop condition model does not |
| 280 | * output false within this duration, the |
Slava Shklyaev | 6a222a3 | 2020-04-07 13:20:47 +0100 | [diff] [blame] | 281 | * execution must be aborted. If no loop timeout |
| 282 | * duration is provided, the maximum amount of |
| 283 | * time is {@link LoopTimeoutDurationNs::DEFAULT}. |
| 284 | * When provided, the duration must not exceed |
| 285 | * {@link LoopTimeoutDurationNs::MAXIMUM}. |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 286 | * @param duration The length of time within which the execution is expected |
| 287 | * to complete after all sync fences in waitFor are signaled. |
| 288 | * If the execution cannot be finished within the duration, |
| 289 | * the execution may be aborted. |
Miao Wang | 90cf3dd | 2019-11-12 14:02:16 -0800 | [diff] [blame] | 290 | * @return status Error status of the call, must be: |
| 291 | * - NONE if task is successfully launched |
| 292 | * - DEVICE_UNAVAILABLE if driver is offline or busy |
| 293 | * - GENERAL_FAILURE if there is an unspecified error |
| 294 | * - INVALID_ARGUMENT if one of the input arguments is invalid, including |
| 295 | * fences in error states. |
Michael Butler | 9b9a804 | 2020-02-13 16:37:22 -0800 | [diff] [blame] | 296 | * - MISSED_DEADLINE_* if the execution is aborted because it |
| 297 | * cannot be completed by the deadline |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 298 | * - RESOURCE_EXHAUSTED_* if the task was aborted by the |
| 299 | * driver |
| 300 | * @return syncFence The sync fence that will be signaled when the task is completed. |
Miao Wang | 90cf3dd | 2019-11-12 14:02:16 -0800 | [diff] [blame] | 301 | * The sync fence will be set to error if a critical error, |
| 302 | * e.g. hardware failure or kernel panic, occurs when doing execution. |
| 303 | * @return callback The IFencedExecutionCallback can be used to query information like duration |
| 304 | * and error status when the execution is completed. |
| 305 | */ |
Miao Wang | 3fd70b0 | 2020-01-21 13:15:09 -0800 | [diff] [blame] | 306 | executeFenced(Request request, vec<handle> waitFor, MeasureTiming measure, |
Slava Shklyaev | f034bf9 | 2020-02-11 14:27:02 +0000 | [diff] [blame] | 307 | OptionalTimePoint deadline, OptionalTimeoutDuration loopTimeoutDuration, |
| 308 | OptionalTimeoutDuration duration) |
Miao Wang | 90cf3dd | 2019-11-12 14:02:16 -0800 | [diff] [blame] | 309 | generates (ErrorStatus status, handle syncFence, IFencedExecutionCallback callback); |
Xusong Wang | 62a760c | 2019-10-25 12:07:17 -0700 | [diff] [blame] | 310 | }; |