Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Hackathon 6th Fundable Projects 2 No.29】 Fix modernize-concat-nested-namespaces-part-21 #64781

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions paddle/fluid/distributed/collective/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

#include "paddle/fluid/distributed/collective/common.h"

namespace paddle {
namespace distributed {
namespace paddle::distributed {

std::vector<Place> GetPlaceList(const std::vector<phi::DenseTensor>& tensors) {
std::vector<Place> places;
Expand Down Expand Up @@ -65,5 +64,4 @@ bool CheckTensorsInXPUPlace(const std::vector<phi::DenseTensor>& tensors) {
});
}

} // namespace distributed
} // namespace paddle
} // namespace paddle::distributed
6 changes: 2 additions & 4 deletions paddle/fluid/distributed/fleet_executor/runtime_graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

#include "paddle/fluid/distributed/fleet_executor/task_node.h"

namespace paddle {
namespace distributed {
namespace paddle::distributed {

std::string RuntimeGraph::DebugString() const {
std::ostringstream os;
Expand All @@ -29,5 +28,4 @@ std::string RuntimeGraph::DebugString() const {
return os.str();
}

} // namespace distributed
} // namespace paddle
} // namespace paddle::distributed
6 changes: 2 additions & 4 deletions paddle/fluid/distributed/fleet_executor/task_loop_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/errors.h"

namespace paddle {
namespace distributed {
namespace paddle::distributed {

TaskLoopThread::TaskLoopThread() : start_(false), loop_(nullptr) {}

Expand Down Expand Up @@ -56,5 +55,4 @@ void TaskLoopThread::Loop() {
loop_ = nullptr;
}

} // namespace distributed
} // namespace paddle
} // namespace paddle::distributed
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include "paddle/fluid/distributed/ps/table/table.h"
#include "paddle/fluid/framework/archive.h"
#include "paddle/fluid/platform/profiler/event_tracing.h"
namespace paddle {
namespace distributed {
namespace paddle::distributed {
std::vector<std::string> GraphPyService::split(const std::string& str,
const char pattern) {
std::vector<std::string> res;
Expand Down Expand Up @@ -507,5 +506,4 @@ void GraphPyClient::StopServer() {
if (status.get() == 0) stoped_ = true;
}
void GraphPyClient::FinalizeWorker() { this->worker_ptr->FinalizeWorker(); }
} // namespace distributed
} // namespace paddle
} // namespace paddle::distributed
8 changes: 2 additions & 6 deletions paddle/fluid/framework/details/broadcast_op_handle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
#include "paddle/fluid/platform/place.h"
#include "paddle/fluid/platform/profiler/event_tracing.h"

namespace paddle {
namespace framework {
namespace details {
namespace paddle::framework::details {

void BroadcastOpHandle::RunImpl() {
platform::RecordEvent record_event(
Expand Down Expand Up @@ -266,6 +264,4 @@ void BroadcastOpHandle::InitOutputValue(
}

std::string BroadcastOpHandle::Name() const { return "broadcast"; }
} // namespace details
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::details
8 changes: 2 additions & 6 deletions paddle/fluid/framework/details/computation_op_handle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

COMMON_DECLARE_bool(allreduce_record_one_event);

namespace paddle {
namespace framework {
namespace details {
namespace paddle::framework::details {
struct VarHandleBase;

ComputationOpHandle::ComputationOpHandle(ir::Node *node,
Expand Down Expand Up @@ -55,6 +53,4 @@ bool ComputationOpHandle::NeedWait(VarHandleBase *in_var) {
}

std::string ComputationOpHandle::Name() const { return op_->Type(); }
} // namespace details
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::details
6 changes: 2 additions & 4 deletions paddle/fluid/framework/executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ limitations under the License. */
PD_DECLARE_bool(benchmark);
COMMON_DECLARE_bool(use_mkldnn);

namespace paddle {
namespace framework {
namespace paddle::framework {
namespace {
// block id starts from 0. This id is used to represent the codeblock
// wrapping the first block 0.
Expand Down Expand Up @@ -609,5 +608,4 @@ void Executor::EnableMKLDNN(const ProgramDesc& program) {
<< "'MKLDNN' is not supported, Please re-compile with WITH_ONEDNN option";
#endif
}
} // namespace framework
} // namespace paddle
} // namespace paddle::framework
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ limitations under the License. */
#include "paddle/fluid/framework/op_version_registry.h"
#include "paddle/fluid/platform/enforce.h"

namespace paddle {
namespace framework {
namespace ir {
namespace paddle::framework::ir {

AdaptivePool2dConvertGlobalPass::AdaptivePool2dConvertGlobalPass() { // NOLINT
AddOpCompat(OpCompat("pool2d"))
Expand Down Expand Up @@ -99,9 +97,7 @@ void AdaptivePool2dConvertGlobalPass::ApplyImpl(ir::Graph* graph) const {
AddStatis(num);
}

} // namespace ir
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::ir

REGISTER_PASS(adaptive_pool2d_convert_global_pass,
paddle::framework::ir::AdaptivePool2dConvertGlobalPass);
Expand Down
8 changes: 2 additions & 6 deletions paddle/fluid/framework/ir/fuse_relu_depthwise_conv_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
#include "paddle/fluid/framework/operator.h"
#include "paddle/fluid/platform/enforce.h"

namespace paddle {
namespace framework {
namespace ir {
namespace paddle::framework::ir {

void FuseReluDepthwiseConvPass::ApplyImpl(ir::Graph *graph) const {
graph = FuseReluDepthwiseConv(graph, true);
Expand Down Expand Up @@ -186,9 +184,7 @@ ir::Graph *FuseReluDepthwiseConvPass::FuseReluDepthwiseConv(
return graph;
}

} // namespace ir
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::ir

REGISTER_PASS(fuse_relu_depthwise_conv_pass,
paddle::framework::ir::FuseReluDepthwiseConvPass);
8 changes: 2 additions & 6 deletions paddle/fluid/framework/ir/graph_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ PADDLE_DEFINE_EXPORTED_string(print_sub_graph_dir,
"FLAGS_print_sub_graph_dir is used "
"to print the nodes of sub_graphs.");

namespace paddle {
namespace framework {
namespace ir {
namespace paddle::framework::ir {
namespace {

template <class NodeComparator = ir::NodeComp>
Expand Down Expand Up @@ -964,6 +962,4 @@ std::vector<std::vector<std::vector<ir::Node::Dep>>> GetOpDependencies(
return deps;
}

} // namespace ir
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::ir
14 changes: 4 additions & 10 deletions paddle/fluid/framework/ir/graph_to_program_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@ limitations under the License. */
#include "paddle/common/flags.h"
#include "paddle/fluid/framework/op_proto_maker.h"

namespace paddle {
namespace framework {
namespace paddle::framework {
class ProgramDesc;
} // namespace framework
} // namespace paddle
} // namespace paddle::framework

namespace paddle {
namespace framework {
namespace ir {
namespace paddle::framework::ir {

void GraphToProgramPass::ApplyImpl(ir::Graph* graph) const {
auto& program = Get<ProgramDesc>("program");
Expand All @@ -39,8 +35,6 @@ void GraphToProgramPass::ApplyImpl(ir::Graph* graph) const {
}
}

} // namespace ir
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::ir

REGISTER_PASS(graph_to_program_pass, paddle::framework::ir::GraphToProgramPass);
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#include "paddle/fluid/framework/ir/pass.h"
#include "paddle/fluid/operators/controlflow/conditional_block_op_helper.h"
#include "paddle/fluid/operators/controlflow/op_variant.h"
namespace paddle {
namespace framework {
namespace ir {
namespace paddle::framework::ir {
using OpVariant = operators::OpVariant;
class ConditionalOpEagerDeletionPass : public Pass {
protected:
Expand Down Expand Up @@ -94,9 +92,7 @@ class ConditionalOpEagerDeletionPass : public Pass {
}
};

} // namespace ir
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::ir

REGISTER_PASS(conditional_block_op_eager_deletion_pass,
paddle::framework::ir::ConditionalOpEagerDeletionPass);
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#include "paddle/fluid/framework/op_version_registry.h"
#include "paddle/utils/string/pretty_log.h"

namespace paddle {
namespace framework {
namespace ir {
namespace paddle::framework::ir {

using string::PrettyLogDetail;

Expand Down Expand Up @@ -373,9 +371,7 @@ ConvActivationMkldnnFusePass::ConvActivationMkldnnFusePass() {
.End();
}

} // namespace ir
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::ir

REGISTER_PASS(conv_activation_onednn_fuse_pass,
paddle::framework::ir::ConvActivationMkldnnFusePass);
Expand Down
8 changes: 2 additions & 6 deletions paddle/fluid/framework/ir/onednn/cpu_bfloat16_pass_tester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#include "paddle/fluid/framework/ir/onednn/cpu_bfloat16_pass.h"
#include "paddle/fluid/imperative/type_defs.h"

namespace paddle {
namespace framework {
namespace ir {
namespace paddle::framework::ir {

void SetOp(ProgramDesc* prog,
const std::string& type,
Expand Down Expand Up @@ -230,8 +228,6 @@ TEST(CpuBfloat16Pass, double_outputs_ops) {
added_nodes);
}

} // namespace ir
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::ir

USE_PASS(cpu_bfloat16_pass);
20 changes: 6 additions & 14 deletions paddle/fluid/framework/ir/preln_skip_layernorm_fuse_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,11 @@ limitations under the License. */
#include "paddle/fluid/framework/ir/graph_pattern_detector.h"
#include "paddle/fluid/framework/op_version_registry.h"

namespace paddle {
namespace framework {
namespace ir {
namespace paddle::framework::ir {
class Node;
} // namespace ir
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::ir

namespace paddle {
namespace framework {
namespace ir {
namespace patterns {
namespace paddle::framework::ir::patterns {

struct PrelnSkipLayerNorm : public PatternBase {
PrelnSkipLayerNorm(PDPattern *pattern, const std::string &name_scope)
Expand Down Expand Up @@ -102,7 +95,8 @@ void PrelnSkipLayerNorm::operator()(PDNode *x, PDNode *y) {
{layer_norm_out_var, layer_norm_mean_var, layer_norm_variance_var});
}

} // namespace patterns
} // namespace paddle::framework::ir::patterns
namespace paddle::framework::ir {

void PrelnSkipLayerNormFusePass::ApplyImpl(ir::Graph *graph) const {
PADDLE_ENFORCE_NOT_NULL(
Expand Down Expand Up @@ -220,9 +214,7 @@ void PrelnSkipLayerNormFusePass::ApplyImpl(ir::Graph *graph) const {
AddStatis(found_subgraph_count);
}

} // namespace ir
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::ir

REGISTER_PASS(preln_skip_layernorm_fuse_pass,
paddle::framework::ir::PrelnSkipLayerNormFusePass);
Expand Down
8 changes: 2 additions & 6 deletions paddle/fluid/framework/ir/vit_attention_fuse_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@
GET_IR_NODE(reshape2_op); \
GET_IR_NODE(reshape2_out);

namespace paddle {
namespace framework {
namespace ir {
namespace paddle::framework::ir {

bool HasScale(OpDesc* const op_ptr,
std::string* name,
Expand Down Expand Up @@ -160,9 +158,7 @@ void VitAttentionFusePass::ApplyImpl(ir::Graph* graph) const {
AddStatis(fusion_count);
}

} // namespace ir
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::ir

REGISTER_PASS(vit_attention_fuse_pass,
paddle::framework::ir::VitAttentionFusePass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
COMMON_DECLARE_bool(dynamic_static_unified_comm);
#endif

namespace paddle {
namespace framework {
namespace interpreter {
namespace paddle::framework::interpreter {

using DeviceContext = platform::DeviceContext;
using DeviceEvent = platform::DeviceEvent;
Expand Down Expand Up @@ -847,6 +845,4 @@ PirStreamAnalyzer::GetEventInfo() const {
return event_info_;
}

} // namespace interpreter
} // namespace framework
} // namespace paddle
} // namespace paddle::framework::interpreter
6 changes: 2 additions & 4 deletions paddle/fluid/framework/shape_inference.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ limitations under the License. */

#include "paddle/fluid/platform/enforce.h"

namespace paddle {
namespace framework {
namespace paddle::framework {

std::vector<DDim> InferShapeContext::GetReaderDims(
const std::string &name) const {
Expand Down Expand Up @@ -45,5 +44,4 @@ void InferShapeContext::SetReaderDims(const std::string &name,
return this->SetRepeatedDims(arg_names[0], dims);
}

} // namespace framework
} // namespace paddle
} // namespace paddle::framework
8 changes: 2 additions & 6 deletions paddle/fluid/inference/analysis/ir_pass_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
#include "paddle/phi/common/data_type.h"
#include "paddle/utils/string/pretty_log.h"

namespace paddle {
namespace inference {
namespace analysis {
namespace paddle::inference::analysis {
using string::PrettyLogEndl;
using string::Style;

Expand Down Expand Up @@ -341,6 +339,4 @@ std::unique_ptr<Graph> IRPassManager::Apply(std::unique_ptr<Graph> graph) {
return graph;
}

} // namespace analysis
} // namespace inference
} // namespace paddle
} // namespace paddle::inference::analysis
Loading