• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_IR_EMISSION_UTILS_H_
17 #define TENSORFLOW_COMPILER_XLA_SERVICE_CPU_IR_EMISSION_UTILS_H_
18 
19 #include "llvm/IR/Value.h"
20 #include "tensorflow/compiler/xla/service/cpu/target_machine_features.h"
21 #include "tensorflow/compiler/xla/service/hlo_instruction.h"
22 
23 namespace xla {
24 namespace cpu {
25 
26 bool PotentiallyImplementedAsEigenConvolution(
27     const HloInstruction& convolution,
28     const TargetMachineFeatures& target_machine_features);
29 
30 // Computes the minimum alignment guaranteed for a tensor of shape `shape` on
31 // the target machine.
32 int64 GetMinimumAlignmentForArray(
33     const Shape& shape, const TargetMachineFeatures& target_machine_features);
34 
35 // Dynamic loop bounds are specified as an array of dimension index
36 // [start, limit) pairs of ir values (one for each partitioned outer dimension).
37 //
38 // EX: Let 'shape' = [8, 16, 32], with the loop bounds of the two-most major
39 //     dimensions dynamic. Then 'dynamic_loop_bounds' will contain the
40 //     following ir values for the two most-major dimensions:
41 //       [dim0_index_start_ir_value, dim0_index_limit_ir_value]
42 //       [dim1_index_start_ir_value, dim1_index_limit_ir_value]
43 //
44 // See IrFunction and ParallelLoopEmitter for details.
45 using DynamicLoopBounds = std::vector<std::pair<llvm::Value*, llvm::Value*>>;
46 
47 }  // namespace cpu
48 }  // namespace xla
49 
50 #endif  // TENSORFLOW_COMPILER_XLA_SERVICE_CPU_IR_EMISSION_UTILS_H_
51