1 /* Copyright 2020 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 TENSORFLOW_COMPILER_XLA_SERVICE_HLO_MODULE_UTIL_H_ 17 #define TENSORFLOW_COMPILER_XLA_SERVICE_HLO_MODULE_UTIL_H_ 18 19 #include <memory> 20 21 #include "absl/types/optional.h" 22 #include "absl/types/span.h" 23 #include "tensorflow/compiler/xla/service/compiler.h" 24 #include "tensorflow/compiler/xla/service/hlo_module_config.h" 25 #include "tensorflow/compiler/xla/shape.h" 26 #include "tensorflow/compiler/xla/status.h" 27 #include "tensorflow/compiler/xla/statusor.h" 28 29 namespace xla { 30 31 // Creates an HloModuleConfig for a given program shape and arguments. 32 // If execution_options does not set num_replicas, default_num_replicas is used. 33 // num_threads is optional; if not given, intra_op_parallelism_threads not set. 34 // aot_options is optional; if not given a default is used. 35 StatusOr<std::unique_ptr<HloModuleConfig>> CreateModuleConfig( 36 const ProgramShape& program_shape, 37 absl::Span<const Shape* const> argument_shapes, 38 const ExecutionOptions* execution_options, int default_num_replicas, 39 absl::optional<int> num_threads = absl::nullopt, 40 const AotCompilationOptions* aot_options = nullptr); 41 42 } // namespace xla 43 44 #endif // TENSORFLOW_COMPILER_XLA_SERVICE_HLO_MODULE_UTIL_H_ 45