xref: /aosp_15_r20/external/tensorflow/tensorflow/compiler/mlir/tf2xla/mlir_bridge_rollout_policy.cc (revision b6fb3261f9314811a0f4371741dbb8839866f948)
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 #include "tensorflow/compiler/mlir/tf2xla/mlir_bridge_rollout_policy.h"
17 
18 #include "tensorflow/compiler/jit/flags.h"
19 
20 namespace tensorflow {
21 
GetMlirBridgeRolloutPolicy(const tensorflow::Graph & graph,const FunctionLibraryDefinition * function_library,std::optional<ConfigProto> config_proto,bool uses_uninitialized_resource_args,bool is_v1_compat,bool record_stats)22 MlirBridgeRolloutPolicy GetMlirBridgeRolloutPolicy(
23     const tensorflow::Graph& graph,
24     const FunctionLibraryDefinition* function_library,
25     std::optional<ConfigProto> config_proto,
26     bool uses_uninitialized_resource_args, bool is_v1_compat,
27     bool record_stats) {
28   switch (GetMlirBridgeRolloutState(config_proto)) {
29     case ConfigProto::Experimental::MLIR_BRIDGE_ROLLOUT_ENABLED:
30       return MlirBridgeRolloutPolicy::kEnabledByUser;
31     case ConfigProto::Experimental::MLIR_BRIDGE_ROLLOUT_DISABLED:
32       return MlirBridgeRolloutPolicy::kDisabledByUser;
33     default:
34       // User did not explicitly enable or disable the bridge. For now, disable
35       // the bridge.
36       return MlirBridgeRolloutPolicy::kDisabledAfterGraphAnalysis;
37   }
38 }
39 
LogGraphFeatures(const Graph & graph,const FunctionLibraryDefinition * function_library,std::optional<ConfigProto> config_proto,bool uses_uninitialized_resource_args,bool is_v1_compat)40 void LogGraphFeatures(const Graph& graph,
41                       const FunctionLibraryDefinition* function_library,
42                       std::optional<ConfigProto> config_proto,
43                       bool uses_uninitialized_resource_args,
44                       bool is_v1_compat) {}
45 
46 }  // namespace tensorflow
47