From 12128d1f906892309b190ead5c5954361157ba2b Mon Sep 17 00:00:00 2001 From: Paddle CI_MAC Date: Thu, 2 Sep 2021 14:07:25 +0800 Subject: [PATCH] mirgate_35215 --- paddle/fluid/framework/details/build_strategy.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/framework/details/build_strategy.h b/paddle/fluid/framework/details/build_strategy.h index 81d2d5e6da..0629f1b915 100644 --- a/paddle/fluid/framework/details/build_strategy.h +++ b/paddle/fluid/framework/details/build_strategy.h @@ -100,6 +100,9 @@ struct BuildStrategy { // while running. bool cache_runtime_context_{false}; + // Fix the op run order. + bool fix_op_run_order_{false}; + // Operator fusion // TODO(dev-paddle): fuse_elewise_add_act_ops may cause some models have // cycle. @@ -109,8 +112,8 @@ struct BuildStrategy { bool enable_auto_fusion_{false}; // Fuse_all_optimizer_ops and fuse_all_reduce_ops require that gradients // should not be sparse types - boost::optional fuse_all_optimizer_ops_{false}; - boost::optional fuse_all_reduce_ops_{boost::none}; + paddle::optional fuse_all_optimizer_ops_{false}; + paddle::optional fuse_all_reduce_ops_{paddle::none}; // fuse_relu_depthwise_conv can fuse the `relu -> // depthwise_conv` bool fuse_relu_depthwise_conv_{false}; @@ -118,7 +121,7 @@ struct BuildStrategy { // faster. Because fusing broadcast OP equals delaying the execution of all // broadcast Ops, in this case, all nccl streams are used only for reduce // operations for a period of time. - boost::optional fuse_broadcast_ops_{boost::none}; + paddle::optional fuse_broadcast_ops_{paddle::none}; // replace batch_norm with sync_batch_norm. bool sync_batch_norm_{false}; @@ -132,7 +135,7 @@ struct BuildStrategy { // By default, memory_optimize would be opened if gc is disabled, and // be closed if gc is enabled. // Users can forcely enable/disable memory_optimize by setting True/False. - boost::optional memory_optimize_{boost::none}; + paddle::optional memory_optimize_{paddle::none}; // Turn on inplace by default. bool enable_inplace_{true}; @@ -177,6 +180,11 @@ struct BuildStrategy { bool IsFinalized() const { return is_finalized_; } + void ClearFinalized() { + pass_builder_ = nullptr; + is_finalized_ = false; + } + bool IsMultiDevPass(const std::string &pass_name) const; // Apply the passes built by the pass_builder_. The passes will be -- Gitee