1 | /* Copyright 2022 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_CORE_COMMON_RUNTIME_OPTIMIZE_CROSS_HOST_CONTROL_DEPS_H_ |
17 | #define TENSORFLOW_CORE_COMMON_RUNTIME_OPTIMIZE_CROSS_HOST_CONTROL_DEPS_H_ |
18 | |
19 | #include "tensorflow/core/graph/graph.h" |
20 | #include "tensorflow/core/lib/core/status.h" |
21 | |
22 | namespace tensorflow { |
23 | |
24 | // Optimize the graph by reducing cross-host control output edges. |
25 | // Once we find any nodes in the graph having not less than |
26 | // `cross_host_edges_threshold` control output edges in one host, we create |
27 | // a `NoOp` node in the destination host to proxy the control edges between the |
28 | // oringal node and the destination control output nodes. |
29 | Status OptimizeCrossHostControlOutputEdges(Graph* graph, |
30 | int cross_host_edges_threshold); |
31 | |
32 | // Optimize the graph by reducing cross-host control input edges. |
33 | // Once we find any nodes in the graph having not less than |
34 | // `cross_host_edges_threshold` control input edges in one host, we create |
35 | // a `NoOp` node in the source host to proxy the control edges between the |
36 | // source control input nodes and oringal node. |
37 | Status OptimizeCrossHostControlInputEdges(Graph* graph, |
38 | int cross_host_edges_threshold); |
39 | |
40 | } // namespace tensorflow |
41 | |
42 | #endif // TENSORFLOW_CORE_COMMON_RUNTIME_OPTIMIZE_CROSS_HOST_CONTROL_DEPS_H_ |
43 | |