Skip to content

Commit d41a473

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into eager_dygraph_codegen_debug
2 parents d19cd85 + 4e63d69 commit d41a473

File tree

97 files changed

+2650
-890
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2650
-890
lines changed

cmake/external/cinn.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ add_definitions(-w)
2626
######################################
2727
include(ExternalProject)
2828
set(CINN_PREFIX_DIR ${THIRD_PARTY_PATH}/CINN)
29-
# TODO(zhhsplendid): Modify git tag after we have release tag
30-
set(CINN_GIT_TAG develop)
29+
set(CINN_GIT_TAG release/v0.1)
3130
set(CINN_OPTIONAL_ARGS -DPY_VERSION=${PY_VERSION}
3231
-DWITH_CUDA=${WITH_GPU}
3332
-DWITH_CUDNN=${WITH_GPU}

paddle/fluid/distributed/fleet_executor/compute_interceptor.cc

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void ComputeInterceptor::IncreaseReady(int64_t up_id) {
6464

6565
// source node has no upstream, data_is_ready is send by carrier or others
6666
if (is_source_ && up_id == -1) {
67-
it->second.second = GetTaskNode()->max_run_times();
67+
it->second.second += GetTaskNode()->max_run_times();
6868
return;
6969
}
7070

@@ -121,16 +121,6 @@ bool ComputeInterceptor::CanWriteOutput() {
121121
return true;
122122
}
123123

124-
// only source node need reset
125-
bool ComputeInterceptor::ShouldReset() {
126-
if (is_source_ && step_ == node_->max_run_times()) {
127-
VLOG(3) << "Interceptor " << GetInterceptorId()
128-
<< " should reset for step: " << step_ << ".";
129-
return true;
130-
}
131-
return false;
132-
}
133-
134124
void ComputeInterceptor::SendDataReadyToDownStream() {
135125
for (auto& outs : out_buffs_) {
136126
auto down_id = outs.first;
@@ -186,24 +176,7 @@ void ComputeInterceptor::RunOps() {
186176
}
187177

188178
void ComputeInterceptor::Run() {
189-
// If there is no limit, source interceptor can be executed
190-
// an unlimited number of times.
191-
// Now source node can only run max_run_times.
192-
if (ShouldReset()) {
193-
for (auto& out_buff : out_buffs_) {
194-
// buffer is using
195-
if (out_buff.second.second != 0) {
196-
VLOG(3) << "Interceptor " << GetInterceptorId()
197-
<< " out buffer for downstream: " << out_buff.first
198-
<< "'s counter is: " << out_buff.second.second
199-
<< ". Cannot be reset.";
200-
return;
201-
}
202-
}
203-
step_ = 0; // reset
204-
}
205-
206-
while (IsInputReady() && CanWriteOutput() && !ShouldReset()) {
179+
while (IsInputReady() && CanWriteOutput()) {
207180
VLOG(3) << "id=" << GetInterceptorId() << " ComputeInterceptor running";
208181

209182
RunOps();

paddle/fluid/distributed/fleet_executor/compute_interceptor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class ComputeInterceptor : public Interceptor {
3939
void DecreaseBuff(int64_t down_id);
4040
bool IsInputReady();
4141
bool CanWriteOutput();
42-
bool ShouldReset();
4342

4443
void Run();
4544
void Compute(const InterceptorMessage& msg);

paddle/fluid/distributed/service/heter_server.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ class HeterServer {
336336

337337
bool IsExit() { return service_.IsExit(); }
338338

339-
HeterServer() { this->ready_ = 0; }
339+
HeterServer() : service_(), ready_(0) {}
340340

341341
void RegisterServiceHandler(std::string message_name,
342342
HeterServiceHandler func);
@@ -391,7 +391,7 @@ class HeterServer {
391391
DISABLE_COPY_AND_ASSIGN(HeterServer);
392392
std::mutex mutex_ready_;
393393

394-
int ready_ = 0;
394+
int ready_;
395395
};
396396

397397
} // end namespace distributed

paddle/fluid/eager/auto_code_generator/eager_generator.cc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ static std::unordered_set<std::string> operators_to_skip = {
3939
static std::unordered_set<std::string> operators_to_codegen = {};
4040
static std::unordered_set<std::string> skipped_operators = {};
4141

42+
static std::string LegalizeVariableName(const std::string& var_name) {
43+
std::string ret = var_name;
44+
std::replace(ret.begin(), ret.end(), '-', '_'); // replace all '-' to '_'
45+
return ret;
46+
}
47+
4248
static std::string AttrTypeToString(const proto::AttrType& type) {
4349
std::string ret;
4450
switch (type) {
@@ -1053,24 +1059,25 @@ static std::pair<std::string, std::string> GenerateForwardFunctionContents(
10531059
const std::string& output_name = output.name();
10541060
std::string out_tensor_str;
10551061
size_t return_position = fwd_outputs_name_pos_map.at(output_name);
1062+
std::string output_varname = LegalizeVariableName(output_name);
10561063

10571064
if (output.duplicable()) {
10581065
const char* FWD_OUT_TENSORS_TEMPLATE =
10591066
" std::vector<egr::EagerTensor> %s = "
10601067
"egr::EagerUtils::GetOutputs(outs[\"%s\"]);\n";
10611068
out_tensor_str = paddle::string::Sprintf(FWD_OUT_TENSORS_TEMPLATE,
1062-
output_name, output_name);
1069+
output_varname, output_name);
10631070
return_types[return_position] = "std::vector<egr::EagerTensor>";
10641071
} else {
10651072
const char* FWD_OUT_TENSOR_TEMPLATE =
10661073
" egr::EagerTensor %s = "
10671074
"egr::EagerUtils::GetOutput(outs[\"%s\"][0]);\n";
10681075
out_tensor_str = paddle::string::Sprintf(FWD_OUT_TENSOR_TEMPLATE,
1069-
output_name, output_name);
1076+
output_varname, output_name);
10701077
return_types[return_position] = "egr::EagerTensor";
10711078
}
10721079

1073-
return_contents[return_position] = output_name;
1080+
return_contents[return_position] = output_varname;
10741081
generated_function_body += out_tensor_str;
10751082
}
10761083
generated_function_body += "\n";

paddle/fluid/eager/auto_code_generator/op_list.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ spp
237237
floor
238238
gelu
239239
retinanet_detection_output
240-
minus
241240
push_dense
242241
silu
243242
sequence_erase

paddle/fluid/framework/garbage_collector.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ void XPUGarbageCollector::ClearCallback(const std::function<void()> &callback) {
5353
}
5454
#endif
5555

56+
#ifdef PADDLE_WITH_IPU
57+
IPUGarbageCollector::IPUGarbageCollector(const platform::IPUPlace &place,
58+
size_t max_memory_size)
59+
: GarbageCollector(place, max_memory_size) {}
60+
void IPUGarbageCollector::ClearCallback(const std::function<void()> &callback) {
61+
callback();
62+
}
63+
#endif
64+
5665
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
5766
UnsafeFastGPUGarbageCollector::UnsafeFastGPUGarbageCollector(
5867
const platform::CUDAPlace &place, size_t max_memory_size)

paddle/fluid/framework/garbage_collector.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ class XPUGarbageCollector : public GarbageCollector {
8080
};
8181
#endif
8282

83+
#ifdef PADDLE_WITH_IPU
84+
class IPUGarbageCollector : public GarbageCollector {
85+
public:
86+
IPUGarbageCollector(const platform::IPUPlace &place, size_t max_memory_size);
87+
88+
protected:
89+
void ClearCallback(const std::function<void()> &callback) override;
90+
};
91+
#endif
92+
8393
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
8494
class UnsafeFastGPUGarbageCollector : public GarbageCollector {
8595
public:

paddle/fluid/framework/heter_pipeline_trainer_test.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ TEST(HeterPipelineTrainerTest, GPU) {
115115
t3.add_trainers(1);
116116
t3.add_trainers(1);
117117
t3.add_trainers(1);
118-
t3.add_dump_fields("hello");
119-
t3.add_dump_param("fc_0");
120118
auto* heter_section_param3 = t3.mutable_heter_section_param();
121119
heter_section_param3->set_num_pipeline_stages(3);
122120
heter_section_param3->set_pipeline_stage(2);

paddle/fluid/framework/heter_section_worker.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ void HeterSectionWorker::CopyParameters(int microbatch_id,
277277
void HeterSectionWorker::Run() {
278278
if (debug_) {
279279
size_t total_ops_size = forward_ops_.size() + backward_ops_.size();
280-
op_name_.resize(total_ops_size);
280+
op_name_.reserve(total_ops_size);
281281
op_total_time_.resize(total_ops_size);
282282
platform::SetNumThreads(1);
283283
// forward op + backward op

0 commit comments

Comments
 (0)