xref: /aosp_15_r20/external/tensorflow/tensorflow/core/util/autotune_maps/conv_autotune_maps.h (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1 /* Copyright 2021 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 // For Google-internal use only.
17 //
18 // This file defines the map data structure for storing autotuning results for
19 // fused_conv2d_bias_activation_op_kernels.
20 //
21 // The key of the map uniquely identifies a convolution operation that runs on a
22 // particular device model while the value might be the autotuned algorithm we
23 // choose for the conv.
24 //
25 // This map will be merged after fused_conv2d_bias_activation_op_kernels is
26 // merged into conv_ops_fused_impl.h (b/177365158, b/189530096)
27 
28 #ifndef TENSORFLOW_CORE_UTIL_AUTOTUNE_MAPS_FUSED_CONV_BIAS_ACTIVATION_AUTOTUNE_MAP_H_
29 #define TENSORFLOW_CORE_UTIL_AUTOTUNE_MAPS_FUSED_CONV_BIAS_ACTIVATION_AUTOTUNE_MAP_H_
30 
31 #if GOOGLE_CUDA || TENSORFLOW_USE_ROCM
32 #include <string>
33 
34 #include "tensorflow/core/kernels/gpu_utils.h"
35 #include "tensorflow/core/platform/stream_executor.h"
36 #include "tensorflow/core/util/autotune_maps/conv_parameters.h"
37 
38 namespace tensorflow {
39 
40 // A dummy type to group forward convolution autotune results together.
41 struct ConvAutotuneGroup {
nameConvAutotuneGroup42   static string name() { return "Conv"; }
43 };
44 
45 using ConvAutotuneMap = AutotuneSingleton<ConvAutotuneGroup, ConvParameters,
46                                           AutotuneEntry<se::dnn::ConvOp>>;
47 
48 // A dummy type to group fused convolution autotune results together.
49 struct ConvFusedAutotuneGroup {
nameConvFusedAutotuneGroup50   static string name() { return "FusedConv"; }
51 };
52 
53 using FusedConvAutotuneMap =
54     AutotuneSingleton<ConvAutotuneGroup, ConvParameters,
55                       AutotuneEntry<se::dnn::FusedConvOp>>;
56 
57 }  // namespace tensorflow
58 #endif  // GOOGLE_CUDA || TENSORFLOW_USE_ROCM
59 
60 #endif  // TENSORFLOW_CORE_UTIL_AUTOTUNE_MAPS_FUSED_CONV_BIAS_ACTIVATION_AUTOTUNE_MAP_H_
61