Skip to content

Commit 64eaa4c

Browse files
committed
clean
1 parent 10786a2 commit 64eaa4c

16 files changed

+49
-113
lines changed

paddle/fluid/framework/details/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ cc_library(fetch_op_handle SRCS fetch_op_handle.cc DEPS op_handle_base scope lod
55
cc_library(computation_op_handle SRCS computation_op_handle.cc DEPS framework_proto scope place operator op_registry)
66
cc_library(rpc_op_handle SRCS rpc_op_handle.cc DEPS framework_proto scope place operator op_registry)
77

8-
cc_library(ssa_graph SRCS ssa_graph.cc DEPS var_handle op_handle_base)
9-
cc_library(ssa_graph_builder SRCS ssa_graph_builder.cc DEPS ssa_graph)
8+
cc_library(ssa_graph_builder SRCS ssa_graph_builder.cc DEPS graph)
109
cc_library(ssa_graph_printer SRCS ssa_graph_printer.cc DEPS ssa_graph_builder)
1110
cc_library(ssa_graph_checker SRCS ssa_graph_checker.cc DEPS ssa_graph_builder)
1211

@@ -35,7 +34,7 @@ cc_library(multi_devices_graph_builder SRCS multi_devices_graph_builder.cc DEPS
3534

3635
cc_library(ssa_graph_builder_factory SRCS ssa_graph_builder_factory.cc DEPS multi_devices_graph_builder ssa_graph_printer ssa_graph_checker)
3736

38-
cc_library(ssa_graph_executor SRCS ssa_graph_executor.cc DEPS ssa_graph framework_proto)
37+
cc_library(ssa_graph_executor SRCS ssa_graph_executor.cc DEPS graph framework_proto)
3938
cc_library(threaded_ssa_graph_executor SRCS threaded_ssa_graph_executor.cc DEPS fetch_op_handle ssa_graph_executor scope
4039
simple_threadpool device_context)
4140

paddle/fluid/framework/details/op_handle_base.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ namespace details {
2727

2828
constexpr char kLocalExecScopeName[] = "@LCOAL_SCOPE@";
2929

30+
// Wraps ir::Node and provide helper utilities.
31+
// It's responsible for populating necessary fields of ir::Node.
3032
class OpHandleBase {
3133
public:
3234
explicit OpHandleBase(ir::Node *node) : node_(node) {}

paddle/fluid/framework/details/scope_buffered_ssa_graph_executor.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#include <memory>
1818
#include <string>
1919
#include <vector>
20+
#include "paddle/fluid/framework/details/op_handle_base.h"
21+
#include "paddle/fluid/framework/details/var_handle.h"
22+
2023
#include "paddle/fluid/framework/details/execution_strategy.h"
2124
#include "paddle/fluid/framework/details/ssa_graph_executor.h"
2225
#include "paddle/fluid/framework/scope.h"

paddle/fluid/framework/details/ssa_graph.cc

Lines changed: 0 additions & 15 deletions
This file was deleted.

paddle/fluid/framework/details/ssa_graph.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

paddle/fluid/framework/details/ssa_graph_builder.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ void SSAGraphBuilder::CreateOpOutput(Graph *graph, OpHandleBase *op_handle,
8181
}
8282

8383
void SSAGraphBuilder::AddOutputToLeafOps(Graph *graph) {
84-
GraphOps &all_ops = graph->Get<GraphOps>("ops");
85-
86-
for (auto &op : all_ops) {
84+
for (auto &op : graph->Get<GraphOps>("ops")) {
8785
if (!op->Outputs().empty()) {
8886
continue;
8987
}

paddle/fluid/framework/details/ssa_graph_builder.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
#include <string>
1919
#include <vector>
2020

21-
#include "paddle/fluid/framework/details/ssa_graph.h"
21+
#include "paddle/fluid/framework/details/op_handle_base.h"
22+
#include "paddle/fluid/framework/details/var_handle.h"
23+
2224
#include "paddle/fluid/framework/program_desc.h"
2325
#include "paddle/fluid/platform/place.h"
2426

@@ -29,10 +31,20 @@ namespace paddle {
2931
namespace framework {
3032
namespace details {
3133

34+
// all variable in each devices.
35+
// The outside vector is the device vector. Each element of this vector is a
36+
// map from variable name to variables. The variables, who have the same name,
37+
// will have a differsent version. The offset in the
38+
// `std::vector<std::unique_ptr<VarHandle>>` is the version of varaibles.
3239
typedef std::vector<
3340
std::unordered_map<std::string, std::vector<std::unique_ptr<VarHandle>>>>
3441
GraphVars;
42+
43+
// aux variables to represent dependency. Useful to resolve data hazard.
3544
typedef std::unordered_set<std::unique_ptr<VarHandleBase>> GraphDepVars;
45+
46+
// all operators. NOTE that even we use a vector here, the operators is
47+
// unordered.
3648
typedef std::vector<std::unique_ptr<OpHandleBase>> GraphOps;
3749

3850
class SSAGraphBuilder : public ir::Pass {

paddle/fluid/framework/details/ssa_graph_checker.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "paddle/fluid/framework/details/ssa_graph.h"
16-
#include <string>
1715
#include "paddle/fluid/framework/details/ssa_graph_checker.h"
16+
#include <string>
17+
#include "paddle/fluid/framework/ir/graph.h"
1818

1919
namespace paddle {
2020
namespace framework {

paddle/fluid/framework/details/ssa_graph_executor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include <string>
1919
#include <vector>
2020

21-
#include "paddle/fluid/framework/details/ssa_graph.h"
2221
#include "paddle/fluid/framework/feed_fetch_type.h"
22+
#include "paddle/fluid/framework/ir/graph.h"
2323

2424
namespace paddle {
2525
namespace framework {

paddle/fluid/framework/details/ssa_graph_printer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include "paddle/fluid/framework/details/ssa_graph_printer.h"
1616
#include <string>
17-
#include "paddle/fluid/framework/details/ssa_graph.h"
17+
#include "paddle/fluid/framework/ir/graph.h"
1818

1919
namespace paddle {
2020
namespace framework {

0 commit comments

Comments
 (0)