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 23 namespace xla { 24 namespace cpu { 25 26 // These routines emit LLVM IR implementing tiled GEMM and GEMV routines. 27 28 void EmitRowMajorGemv(PrimitiveType scalar_type, int64_t tile_rows, 29 int64_t tile_cols, int64_t m, int64_t k, llvm::Value* lhs, 30 llvm::Value* rhs, llvm::Value* addend, 31 llvm::Value* result, llvm::IRBuilder<>* b, 32 const HloModuleConfig& module_config); 33 34 void EmitColumnMajorGemv(PrimitiveType scalar_type, int64_t tile_rows, 35 int64_t tile_cols, int64_t m, int64_t k, 36 llvm::Value* lhs, llvm::Value* rhs, 37 llvm::Value* addend, llvm::Value* result, 38 llvm::IRBuilder<>* b, 39 const HloModuleConfig& module_config); 40 41 void EmitSmallGemm(PrimitiveType scalar_type, int64_t m, int64_t k, int64_t n, 42 int64_t max_vectorization_width, int64_t max_vector_count, 43 int64_t min_vectorization_width, int64_t tile_size_m, 44 int64_t tile_size_k, llvm::Value* lhs, llvm::Value* rhs, 45 llvm::Value* result, llvm::IRBuilder<>* b, 46 const HloModuleConfig& module_config); 47 48 } // namespace cpu 49 } // namespace xla 50 51 #endif // TENSORFLOW_COMPILER_XLA_SERVICE_CPU_TILED_DOT_EMITTER_H_ 52