1 /* Copyright 2021 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 #ifndef TENSORFLOW_LITE_EXPERIMENTAL_ACCELERATION_MINI_BENCHMARK_STATUS_CODES_H_ 16 #define TENSORFLOW_LITE_EXPERIMENTAL_ACCELERATION_MINI_BENCHMARK_STATUS_CODES_H_ 17 18 namespace tflite { 19 namespace acceleration { 20 // A unified set of status codes for mini-benchmark. 21 // 22 // The overall mini benchmark infrastructure is multi-layered and its behaviour 23 // depends on app packaging, Android target and device SDK version, delegates 24 // and drivers. We want to get detailed telemetry so that issues in-the-wild can 25 // be diagnosed and potentially reproduced. 26 // 27 // This enum is used as a single source of truth for the possible error 28 // conditions encountered. Layers can pass status codes upwards unchanged. 29 // 30 // (absl::Status and friends are not allowed in the TFLite codebase for version 31 // skew and binary size reasons). 32 enum MinibenchmarkStatus { 33 kMinibenchmarkUnknownStatus = 0, 34 35 // First set of error codes that are used as process exit codes to communicate 36 // between the parent and child process. The values need to be between 1 and 37 // 126 to be passed through popen(). 38 // 39 // Runner main status codes used to indicate inability to dynamically load and 40 // execute the validation code. 41 // LINT.IfChange 42 kMinibenchmarkRunnerMainDlopenFailed = 11, 43 kMinibenchmarkRunnerMainSymbolLookupFailed = 12, 44 kMinibenchmarkRunnerMainTooFewArguments = 13, 45 kMinibenchmarkUnsupportedPlatform = 14, 46 // LINT.ThenChange(//tensorflow/lite/experimental/acceleration/mini_benchmark/runner_main.c) 47 // General status codes that may be used anywhere 48 kMinibenchmarkPreconditionNotMet = 119, 49 kMinibenchmarkSuccess = 120, 50 // Storage status codes. These are used when storage can not be used to pass 51 // status. 52 kMinibenchmarkCorruptSizePrefixedFlatbufferFile = 21, 53 kMinibenchmarkCantCreateStorageFile = 22, 54 kMinibenchmarkFlockingStorageFileFailed = 23, 55 kMinibenchmarkErrorReadingStorageFile = 24, 56 kMinibenchmarkFailedToOpenStorageFileForWriting = 25, 57 kMinibenchmarkErrorWritingStorageFile = 26, 58 kMinibenchmarkErrorFsyncingStorageFile = 27, 59 kMinibenchmarkErrorClosingStorageFile = 28, 60 61 // Second set of error codes that are used either before launching the child 62 // process or communicated through the storage mechanism. These can be > 127. 63 // 64 // Runner status codes. 65 kMinibenchmarkDladdrReturnedZero = 502, 66 kMinibenchmarkDliFnameWasNull = 503, 67 kMinibenchmarkDliFnameHasApkNameOnly = 504, 68 kMinibenchmarkRequestAndroidInfoFailed = 505, 69 kMinibenchmarkDliFnameDoesntContainSlashes = 506, 70 kMinibenchmarkCouldntOpenTemporaryFileForBinary = 507, 71 kMinibenchmarkCouldntChmodTemporaryFile = 508, 72 kMinibenchmarkPopenFailed = 509, 73 kMinibenchmarkCommandFailed = 510, 74 kMiniBenchmarkCannotLoadSupportLibrary = 511, 75 kMiniBenchmarkInvalidSupportLibraryConfiguration = 512, 76 kMinibenchmarkPipeFailed = 513, 77 // Validator status codes. 78 kMinibenchmarkDelegateNotSupported = 1000, 79 kMinibenchmarkDelegatePluginNotFound = 1001, 80 kMinibenchmarkDelegateCreateFailed = 1013, 81 kMinibenchmarkModelTooLarge = 1002, // Safety limit currently set at 100M. 82 kMinibenchmarkSeekToModelOffsetFailed = 1003, 83 kMinibenchmarkModelReadFailed = 1004, 84 kMinibenchmarkInterpreterBuilderFailed = 1005, 85 kMinibenchmarkValidationSubgraphNotFound = 1006, 86 kMinibenchmarkModifyGraphWithDelegateFailed = 1007, 87 kMinibenchmarkAllocateTensorsFailed = 1008, 88 kMinibenchmarkInvokeFailed = 1009, 89 kMinibenchmarkModelBuildFailed = 1010, 90 kMinibenchmarkValidationSubgraphHasTooFewInputs = 1011, 91 kMinibenchmarkValidationSubgraphHasTooFewOutputs = 1011, 92 kMinibenchmarkValidationSubgraphInputsDontMatchOutputs = 1012, 93 94 // Validator runner status codes. 95 kMinibenchmarkChildProcessAlreadyRunning = 1501, 96 kMinibenchmarkValidationEntrypointSymbolNotFound = 1502, 97 kMinibenchmarkNoValidationRequestFound = 1503, 98 99 // Validator runner recoverable errors 100 kMinibenchmarkUnableToSetCpuAffinity = 1601, 101 }; 102 } // namespace acceleration 103 } // namespace tflite 104 105 #endif // TENSORFLOW_LITE_EXPERIMENTAL_ACCELERATION_MINI_BENCHMARK_STATUS_CODES_H_ 106