1 /* Copyright 2017 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 // LLVM-based compiler backend. 17 #ifndef TENSORFLOW_COMPILER_XLA_SERVICE_GPU_LLVM_GPU_BACKEND_NVPTX_BACKEND_LIB_H_ 18 #define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_LLVM_GPU_BACKEND_NVPTX_BACKEND_LIB_H_ 19 20 #include <string> 21 #include <utility> 22 23 #include "absl/strings/string_view.h" 24 #include "llvm/IR/Module.h" 25 #include "tensorflow/compiler/xla/service/hlo_module_config.h" 26 #include "tensorflow/compiler/xla/statusor.h" 27 #include "tensorflow/compiler/xla/types.h" 28 29 namespace xla { 30 namespace gpu { 31 32 // Compiles the argument module and returns it. libdevice_dir_path is the parent 33 // directory of the libdevice bitcode libraries. The contents of the module may 34 // be changed. 35 // 36 // The Compile.* interfaces each create their own llvm::LLVMContext objects for 37 // thread safety, but note that LLVM's multithreaded support is very 38 // preliminary; multithreaded use is not recommended at this time. 39 StatusOr<string> CompileToPtx(llvm::Module* module, 40 std::pair<int, int> compute_capability, 41 const HloModuleConfig& hlo_module_config, 42 const string& libdevice_dir_path); 43 44 } // namespace gpu 45 } // namespace xla 46 47 #endif // TENSORFLOW_COMPILER_XLA_SERVICE_GPU_LLVM_GPU_BACKEND_NVPTX_BACKEND_LIB_H_ 48