Skip to content

Commit f94fdea

Browse files
authored
Merge pull request #13215 from panyx0718/clean
remove some unused codes
2 parents 04272c0 + 5ae052b commit f94fdea

File tree

2 files changed

+1
-34
lines changed

2 files changed

+1
-34
lines changed

paddle/fluid/framework/details/multi_devices_graph_pass.cc

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ std::unique_ptr<ir::Graph> MultiDevSSAGraphBuilder::ApplyImpl(
326326
ir::Graph &result = *graph;
327327

328328
for (auto &node : nodes) {
329-
if (node->NodeType() == ir::Node::Type::kVariable && node->Var()) {
329+
if (node->IsVar() && node->Var()) {
330330
all_vars_.emplace(node->Name(), node->Var());
331331
}
332332
}
@@ -583,18 +583,6 @@ void MultiDevSSAGraphBuilder::InsertDataBalanceOp(
583583
}
584584
}
585585

586-
bool MultiDevSSAGraphBuilder::IsParameterGradientOnce(
587-
const std::string &og,
588-
std::unordered_set<std::string> *og_has_been_broadcast) const {
589-
bool is_pg_once =
590-
grad_names_.count(og) != 0 && og_has_been_broadcast->count(og) == 0;
591-
if (is_pg_once) {
592-
// Insert NCCL AllReduce Op
593-
og_has_been_broadcast->insert(og);
594-
}
595-
return is_pg_once;
596-
}
597-
598586
int MultiDevSSAGraphBuilder::GetOpDeviceID(const ir::Graph &graph,
599587
ir::Node *node) const {
600588
if (strategy_.reduce_ != BuildStrategy::ReduceStrategy::kReduce) {
@@ -688,20 +676,6 @@ VarHandle *MultiDevSSAGraphBuilder::CreateReduceOp(ir::Graph *result,
688676
return var;
689677
}
690678

691-
// Find the first occurence of `prev_op_name` and make current `op` depend
692-
// on it.
693-
void MultiDevSSAGraphBuilder::ConnectOp(ir::Graph *result, OpHandleBase *op,
694-
const std::string &prev_op_name) const {
695-
for (auto &prev_op : result->Get<GraphOps>(kGraphOps)) {
696-
if (prev_op->Name() == prev_op_name) {
697-
auto *dep_var = new DummyVarHandle(result->CreateControlDepVar());
698-
prev_op->AddOutput(dep_var);
699-
result->Get<GraphDepVars>(kGraphDepVars).emplace(dep_var);
700-
op->AddInput(dep_var);
701-
}
702-
}
703-
}
704-
705679
void MultiDevSSAGraphBuilder::CreateDistTrainOp(ir::Graph *result,
706680
ir::Node *node) const {
707681
int op_dev_id = -1;

paddle/fluid/framework/details/multi_devices_graph_pass.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ class MultiDevSSAGraphBuilder : public ir::Pass {
6969
std::vector<std::string> FindDistTrainRecvVars(
7070
const std::vector<ir::Node *> &nodes) const;
7171

72-
void ConnectOp(ir::Graph *result, OpHandleBase *op,
73-
const std::string &prev_op_name) const;
74-
7572
void CreateComputationalOps(ir::Graph *result, ir::Node *node,
7673
size_t num_places) const;
7774

@@ -83,10 +80,6 @@ class MultiDevSSAGraphBuilder : public ir::Pass {
8380
void CreateComputationalOp(ir::Graph *result, ir::Node *node,
8481
int dev_id) const;
8582

86-
bool IsParameterGradientOnce(
87-
const std::string &og,
88-
std::unordered_set<std::string> *og_has_been_broadcast) const;
89-
9083
int GetOpDeviceID(const ir::Graph &graph, ir::Node *node) const;
9184

9285
void InsertAllReduceOp(ir::Graph *result, const std::string &og) const;

0 commit comments

Comments
 (0)