• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2018 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_TILED_DOT_EMITTER_H_
17 #define TENSORFLOW_COMPILER_XLA_SERVICE_CPU_TILED_DOT_EMITTER_H_
18 
19 #include "llvm/IR/IRBuilder.h"
20 #include "tensorflow/compiler/xla/service/hlo_module_config.h"
21 #include "tensorflow/compiler/xla/xla_data.pb.h"
22 #include "tensorflow/core/platform/types.h"
23 
24 namespace xla {
25 namespace cpu {
26 
27 // These routines emit LLVM IR implementing tiled GEMM and GEMV routines.
28 
29 void EmitRowMajorGemv(PrimitiveType scalar_type, tensorflow::int64 tile_rows,
30                       tensorflow::int64 tile_cols, tensorflow::int64 m,
31                       tensorflow::int64 k, llvm::Value* lhs, llvm::Value* rhs,
32                       llvm::Value* addend, llvm::Value* result,
33                       llvm::IRBuilder<>* b,
34                       const HloModuleConfig& module_config);
35 
36 void EmitColumnMajorGemv(PrimitiveType scalar_type, tensorflow::int64 tile_rows,
37                          tensorflow::int64 tile_cols, tensorflow::int64 m,
38                          tensorflow::int64 k, llvm::Value* lhs,
39                          llvm::Value* rhs, llvm::Value* addend,
40                          llvm::Value* result, llvm::IRBuilder<>* b,
41                          const HloModuleConfig& module_config);
42 
43 void EmitSmallGemm(PrimitiveType scalar_type, tensorflow::int64 m,
44                    tensorflow::int64 k, tensorflow::int64 n,
45                    tensorflow::int64 max_vectorization_width,
46                    tensorflow::int64 max_vector_count,
47                    tensorflow::int64 min_vectorization_width,
48                    tensorflow::int64 tile_size_m, tensorflow::int64 tile_size_k,
49                    llvm::Value* lhs, llvm::Value* rhs, llvm::Value* result,
50                    llvm::IRBuilder<>* b, const HloModuleConfig& module_config);
51 
52 }  // namespace cpu
53 }  // namespace xla
54 
55 #endif  // TENSORFLOW_COMPILER_XLA_SERVICE_CPU_TILED_DOT_EMITTER_H_
56