1 /* Copyright 2020 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_SPMD_CONVOLUTION_HANDLER_H_
17 #define TENSORFLOW_COMPILER_XLA_SERVICE_SPMD_CONVOLUTION_HANDLER_H_
18 
19 #include "tensorflow/compiler/xla/service/dot_as_convolution_util.h"
20 #include "tensorflow/compiler/xla/service/hlo_computation.h"
21 #include "tensorflow/compiler/xla/service/hlo_instruction.h"
22 #include "tensorflow/compiler/xla/service/hlo_sharding.h"
23 #include "tensorflow/compiler/xla/service/spmd/spmd_partitioner.h"
24 
25 namespace xla {
26 namespace spmd {
27 
28 // Partition convolution.
29 StatusOr<HloInstruction*> PartitionConvolution(
30     PartitionedHlo lhs, PartitionedHlo rhs, const Shape& output_base_shape,
31     const HloSharding& output_sharding, const DotConvDimsMapping& dims_mapping,
32     const std::function<StatusOr<HloInstruction*>(
33         HloInstruction*, HloInstruction*, SpmdBuilder*,
34         const Window& conv_window)>& create_sharded_conv,
35     const Window& conv_window, HloInstruction* original_hlo,
36     int64 num_partitions, const SpmdPartitionerOptions& options,
37     HloInstruction* partition_id, HloModule* module, SpmdBuilder* b);
38 
39 }  // namespace spmd
40 }  // namespace xla
41 
42 #endif  // TENSORFLOW_COMPILER_XLA_SERVICE_SPMD_CONVOLUTION_HANDLER_H_
43