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 #ifndef TENSORFLOW_COMPILER_XLA_SERVICE_CPU_LLVM_IR_RUNTIME_H_
17 #define TENSORFLOW_COMPILER_XLA_SERVICE_CPU_LLVM_IR_RUNTIME_H_
18 
19 #include "llvm/IR/Module.h"
20 #include "llvm/IR/Operator.h"
21 #include "tensorflow/compiler/xla/service/llvm_ir/llvm_util.h"
22 
23 namespace xla {
24 namespace cpu {
25 namespace runtime {
26 
27 extern const char* const kTanhV4F32SymbolName;
28 extern const char* const kTanhV8F32SymbolName;
29 extern const char* const kTanhV16F32SymbolName;
30 extern const char* const kExpV4F32SymbolName;
31 extern const char* const kExpV8F32SymbolName;
32 extern const char* const kExpV16F32SymbolName;
33 extern const char* const kLogV4F32SymbolName;
34 extern const char* const kLogV8F32SymbolName;
35 extern const char* const kLogV16F32SymbolName;
36 
37 // The following CPU runtime functions have LLVM-IR only implementations:
38 //
39 //  - __xla_cpu_runtime_TanhV4F32
40 //  - __xla_cpu_runtime_TanhV8F32
41 //
42 // |LinkIRRuntimeFunctions| rewrites calls to these functions into generic LLVM
43 // IR.
44 
45 void RewriteIRRuntimeFunctions(llvm::Module* module,
46                                llvm::FastMathFlags fast_math_flags);
47 
48 }  // namespace runtime
49 }  // namespace cpu
50 }  // namespace xla
51 
52 #endif  // TENSORFLOW_COMPILER_XLA_SERVICE_CPU_LLVM_IR_RUNTIME_H_
53