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 16 #ifndef TFRT_GOOGLE_BEF_EXECUTOR_DRIVER_FLAGS_H_ 17 #define TFRT_GOOGLE_BEF_EXECUTOR_DRIVER_FLAGS_H_ 18 19 #include "absl/flags/declare.h" 20 #include "absl/flags/flag.h" 21 #include "tfrt/bef_executor_driver/bef_executor_driver.h" // from @tf_runtime 22 23 namespace tfrt { 24 ABSL_CONST_INIT extern const char kDefaultInputFilename[]; 25 26 struct HostAllocatorTypeWrapper { HostAllocatorTypeWrapperHostAllocatorTypeWrapper27 HostAllocatorTypeWrapper(HostAllocatorType type) : type(type) {} HostAllocatorTypeHostAllocatorTypeWrapper28 operator HostAllocatorType() { return type; } 29 HostAllocatorType type; 30 }; 31 32 } // namespace tfrt 33 34 ABSL_DECLARE_FLAG(std::string, input_filename); 35 ABSL_DECLARE_FLAG(std::string, shared_libs); 36 ABSL_DECLARE_FLAG(std::string, functions); 37 ABSL_DECLARE_FLAG(std::string, test_init_function); 38 ABSL_DECLARE_FLAG(std::string, work_queue_type); 39 ABSL_DECLARE_FLAG(tfrt::HostAllocatorTypeWrapper, host_allocator_type); 40 41 namespace tfrt { 42 43 bool AbslParseFlag(absl::string_view text, 44 tfrt::HostAllocatorTypeWrapper* host_allocator_type, 45 std::string* error); 46 47 std::string AbslUnparseFlag(tfrt::HostAllocatorTypeWrapper host_allocator_type); 48 49 } // namespace tfrt 50 51 #endif // TFRT_GOOGLE_BEF_EXECUTOR_DRIVER_FLAGS_H_ 52