From cd0f1523202eeacbc04ff3759645d5e34eab5852 Mon Sep 17 00:00:00 2001 From: Ruibin Cheung Date: Fri, 21 Jul 2023 16:50:35 +0800 Subject: [PATCH] [clang-tidy] enable modernize-use-override (#55491) --- .clang-tidy | 2 +- .../framework/ir/coalesce_grad_tensor_pass.cc | 2 +- .../fuse_adam_op_pass.cc | 6 ++-- .../fuse_momentum_op_pass.cc | 8 ++--- .../fuse_sgd_op_pass.cc | 8 ++--- .../new_executor/workqueue/workqueue.cc | 4 +-- paddle/fluid/framework/phi_utils.cc | 2 +- .../memory/allocation/allocator_facade.cc | 6 ++-- .../operators/collective/allreduce_op.cc | 2 +- .../fluid/operators/collective/alltoall_op.cc | 2 +- .../fluid/operators/collective/barrier_op.cc | 2 +- .../operators/collective/c_allgather_op.cc | 2 +- .../operators/collective/c_broadcast_op.cc | 2 +- .../collective/c_comm_init_all_op.cc | 2 +- .../collective/c_comm_init_multitrainer_op.cc | 2 +- .../fluid/operators/collective/c_concat_op.cc | 2 +- .../operators/collective/c_identity_op.cc | 2 +- .../collective/c_reducescatter_op.cc | 2 +- .../operators/collective/c_scatter_op.cc | 2 +- .../c_softmax_with_cross_entropy_op.cc | 2 +- .../fluid/operators/collective/c_split_op.cc | 2 +- .../collective/c_sync_calc_stream_op.cc | 2 +- .../collective/c_sync_comm_stream_op.cc | 2 +- .../operators/collective/c_wait_comm_op.cc | 2 +- .../operators/collective/c_wait_compute_op.cc | 2 +- .../operators/collective/global_gather_op.cc | 2 +- .../operators/collective/global_scatter_op.cc | 2 +- .../collective/mp_allreduce_sum_op.cc | 2 +- .../collective/partial_allgather_op.cc | 2 +- .../operators/collective/partial_recv_op.cc | 2 +- .../operators/collective/partial_send_op.cc | 2 +- .../fluid/operators/collective/recv_v2_op.cc | 2 +- .../fluid/operators/collective/send_v2_op.cc | 2 +- .../operators/fused/fused_gemm_epilogue_op.cc | 4 +-- .../fluid/operators/fused/resnet_unit_op.cc | 10 +++---- .../fluid/operators/fused/yolo_box_head_op.cc | 4 +-- .../fluid/operators/fused/yolo_box_post_op.cc | 4 +-- paddle/fluid/operators/marker_op.cc | 2 +- paddle/fluid/operators/mul_op.cc | 4 +-- paddle/fluid/operators/nop_op.cc | 2 +- .../pow2_decay_with_linear_warmup_op.cc | 2 +- .../operators/pscore/fetch_barrier_op.cc | 2 +- .../pscore/heter_listen_and_serv_op.cc | 2 +- .../operators/pscore/listen_and_serv_op.cc | 2 +- .../operators/pscore/send_and_recv_op.cc | 2 +- .../fluid/operators/pscore/send_barrier_op.cc | 2 +- paddle/fluid/operators/pscore/send_op.cc | 2 +- .../operators/reduce_ops/reduce_mean_op.cc | 4 +-- paddle/fluid/operators/tdm_child_op.cc | 2 +- paddle/fluid/operators/tdm_sampler_op.cc | 2 +- paddle/fluid/pybind/imperative.cc | 2 +- paddle/ir/pass/ir_printing.cc | 2 +- paddle/ir/pass/pass_timing.cc | 2 +- paddle/phi/api/profiler/device_tracer.cc | 29 ++++++++++--------- 54 files changed, 88 insertions(+), 87 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 9c3f6daa4eb..3ae8f6a9b61 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -185,7 +185,7 @@ Checks: ' -modernize-use-equals-delete, -modernize-use-noexcept, -modernize-use-nullptr, --modernize-use-override, +modernize-use-override, -modernize-use-transparent-functors, -modernize-use-uncaught-exceptions, -performance-faster-string-find, diff --git a/paddle/fluid/framework/ir/coalesce_grad_tensor_pass.cc b/paddle/fluid/framework/ir/coalesce_grad_tensor_pass.cc index 4aabf345342..b6261cbfad6 100644 --- a/paddle/fluid/framework/ir/coalesce_grad_tensor_pass.cc +++ b/paddle/fluid/framework/ir/coalesce_grad_tensor_pass.cc @@ -69,7 +69,7 @@ double GetFuseParameterMemorySize() { return FLAGS_fuse_parameter_memory_size; } class CoalesceGradTensorPass : public ir::Pass { protected: - void ApplyImpl(ir::Graph *graph) const { + void ApplyImpl(ir::Graph *graph) const override { if (Get(details::kNRanks) <= 1) { VLOG(6) << "The number of place is" << Get(details::kNRanks) << ", there doesn't need apply FuseAllReduceOpPass."; diff --git a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_adam_op_pass.cc b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_adam_op_pass.cc index 3a7a0445005..9cb8ce26068 100644 --- a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_adam_op_pass.cc +++ b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_adam_op_pass.cc @@ -30,9 +30,9 @@ class Node; class FuseAdamOpPass : public FuseOptimizerOpPass { private: - const std::string GetOpType() const { return "adam"; } + const std::string GetOpType() const override { return "adam"; } - const std::vector GetAuxiliaryVarNames() const { + const std::vector GetAuxiliaryVarNames() const override { return {"Moment1", "Moment2", "Beta1Pow", "Beta2Pow"}; } @@ -41,7 +41,7 @@ class FuseAdamOpPass : public FuseOptimizerOpPass { &aux_var_set, const std::unordered_map &fused_vars_name, const std::vector &adam_ops, - ir::Graph *graph) const { + ir::Graph *graph) const override { auto fused_adam_node = FuseAdamOps(aux_var_set, fused_vars_name, adam_ops, graph); return fused_adam_node; diff --git a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_momentum_op_pass.cc b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_momentum_op_pass.cc index 4038f39fc53..d24322ede7e 100644 --- a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_momentum_op_pass.cc +++ b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_momentum_op_pass.cc @@ -29,18 +29,18 @@ class Node; class FuseMomentumOpPass : public FuseOptimizerOpPass { private: - virtual const std::string GetOpType() const { return "momentum"; } + const std::string GetOpType() const override { return "momentum"; } - virtual const std::vector GetAuxiliaryVarNames() const { + const std::vector GetAuxiliaryVarNames() const override { return {"Velocity"}; } // Fuse Momentum Ops - virtual ir::Node *FuseOptimizerOps( + ir::Node *FuseOptimizerOps( const std::unordered_map> &vars_set, const std::unordered_map &fused_vars_name, const std::vector &momentum_ops, - ir::Graph *graph) const { + ir::Graph *graph) const override { PADDLE_ENFORCE_GT( momentum_ops.size(), static_cast(0), diff --git a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_sgd_op_pass.cc b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_sgd_op_pass.cc index e56679bd125..a3ec33d8b2f 100644 --- a/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_sgd_op_pass.cc +++ b/paddle/fluid/framework/ir/fuse_optimizer_ops_pass/fuse_sgd_op_pass.cc @@ -28,18 +28,18 @@ class Node; class FuseSgdOpPass : public FuseOptimizerOpPass { private: - virtual const std::string GetOpType() const { return "sgd"; } + const std::string GetOpType() const override { return "sgd"; } - virtual const std::vector GetAuxiliaryVarNames() const { + const std::vector GetAuxiliaryVarNames() const override { return {}; } // Fuse Sgd Ops - virtual ir::Node *FuseOptimizerOps( + ir::Node *FuseOptimizerOps( const std::unordered_map> &vars_set, const std::unordered_map &fused_vars_name, const std::vector &sgd_ops, - ir::Graph *graph) const { + ir::Graph *graph) const override { PADDLE_ENFORCE_GT( sgd_ops.size(), static_cast(0), diff --git a/paddle/fluid/framework/new_executor/workqueue/workqueue.cc b/paddle/fluid/framework/new_executor/workqueue/workqueue.cc index ad4a51152c4..95fc97c3cf0 100644 --- a/paddle/fluid/framework/new_executor/workqueue/workqueue.cc +++ b/paddle/fluid/framework/new_executor/workqueue/workqueue.cc @@ -53,7 +53,7 @@ class WorkQueueImpl : public WorkQueue { options_.always_spinning); } - virtual ~WorkQueueImpl() { + ~WorkQueueImpl() override { delete queue_; if (tracker_ != nullptr) { tracker_->~TaskTracker(); @@ -94,7 +94,7 @@ class WorkQueueGroupImpl : public WorkQueueGroup { explicit WorkQueueGroupImpl( const std::vector& queue_options); - ~WorkQueueGroupImpl(); + ~WorkQueueGroupImpl() override; void AddTask(size_t queue_idx, std::function fn) override; diff --git a/paddle/fluid/framework/phi_utils.cc b/paddle/fluid/framework/phi_utils.cc index 01b28e364a5..7ac4a4bf27e 100644 --- a/paddle/fluid/framework/phi_utils.cc +++ b/paddle/fluid/framework/phi_utils.cc @@ -40,7 +40,7 @@ class KernelArgsNameMakerByOpProto : public KernelArgsNameMaker { platform::errors::InvalidArgument("Op proto cannot be nullptr.")); } - ~KernelArgsNameMakerByOpProto() {} + ~KernelArgsNameMakerByOpProto() override {} const paddle::small_vector& GetInputArgsNames() override; const paddle::small_vector& GetOutputArgsNames() override; diff --git a/paddle/fluid/memory/allocation/allocator_facade.cc b/paddle/fluid/memory/allocation/allocator_facade.cc index 804136e57b7..51de895be3d 100644 --- a/paddle/fluid/memory/allocation/allocator_facade.cc +++ b/paddle/fluid/memory/allocation/allocator_facade.cc @@ -127,7 +127,7 @@ class CUDAGraphAllocator : underlying_allocator_(allocator) {} public: - ~CUDAGraphAllocator() {} + ~CUDAGraphAllocator() override {} static std::shared_ptr Create( const std::shared_ptr& allocator) { @@ -135,14 +135,14 @@ class CUDAGraphAllocator } protected: - phi::Allocation* AllocateImpl(size_t size) { + phi::Allocation* AllocateImpl(size_t size) override { VLOG(10) << "Allocate " << size << " for CUDA Graph"; return new PrivateAllocation(this, static_unique_ptr_cast( underlying_allocator_->Allocate(size))); } - void FreeImpl(phi::Allocation* allocation) { + void FreeImpl(phi::Allocation* allocation) override { VLOG(10) << "delete for CUDA Graph"; delete allocation; } diff --git a/paddle/fluid/operators/collective/allreduce_op.cc b/paddle/fluid/operators/collective/allreduce_op.cc index 40305cc2106..dc3dfff58e9 100644 --- a/paddle/fluid/operators/collective/allreduce_op.cc +++ b/paddle/fluid/operators/collective/allreduce_op.cc @@ -36,7 +36,7 @@ class AllReduceDelOp : public framework::OperatorWithKernel { class AllReduceDelOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor), tensor to be allreduced."); AddOutput("Out", "(Tensor) the result of allreduced."); AddAttr("reduce_type", "(int) determine the reduce type.") diff --git a/paddle/fluid/operators/collective/alltoall_op.cc b/paddle/fluid/operators/collective/alltoall_op.cc index 8c0346b5dd3..a8e3b280809 100644 --- a/paddle/fluid/operators/collective/alltoall_op.cc +++ b/paddle/fluid/operators/collective/alltoall_op.cc @@ -45,7 +45,7 @@ class AllToAllBaseOp : public framework::OperatorWithKernel { class AllToAllBaseOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor send."); AddOutput("Out", "(Tensor) the result of alltoall."); AddAttr("ring_id", "(int default 0) nccl communication ring id.") diff --git a/paddle/fluid/operators/collective/barrier_op.cc b/paddle/fluid/operators/collective/barrier_op.cc index 039bd7789ad..d73c215566d 100644 --- a/paddle/fluid/operators/collective/barrier_op.cc +++ b/paddle/fluid/operators/collective/barrier_op.cc @@ -27,7 +27,7 @@ class BarrierOp : public framework::OperatorWithKernel { class BarrierOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) Input data (only used in CUDAKernel)."); AddOutput("Out", "(Tensor) Output data (only used in CUDAKernel)."); AddAttr("ring_id", "(int default 0) communication ring id.") diff --git a/paddle/fluid/operators/collective/c_allgather_op.cc b/paddle/fluid/operators/collective/c_allgather_op.cc index b78d9504daf..ab5d28b3a9d 100644 --- a/paddle/fluid/operators/collective/c_allgather_op.cc +++ b/paddle/fluid/operators/collective/c_allgather_op.cc @@ -44,7 +44,7 @@ class CAllGatherOp : public framework::OperatorWithKernel { class CAllGatherOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor to be allgather"); AddOutput("Out", "(Tensor) the allgather result"); AddAttr("ring_id", "(int default 0) communication ring id.") diff --git a/paddle/fluid/operators/collective/c_broadcast_op.cc b/paddle/fluid/operators/collective/c_broadcast_op.cc index 1b980e64a5c..670b69c0570 100644 --- a/paddle/fluid/operators/collective/c_broadcast_op.cc +++ b/paddle/fluid/operators/collective/c_broadcast_op.cc @@ -35,7 +35,7 @@ class CBroadcastOp : public framework::OperatorWithKernel { class CBroadcastOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor to be broadcasted."); AddOutput("Out", "(Tensor) the result of broadcast."); AddAttr("ring_id", "(int default 0) nccl communication ring id.") diff --git a/paddle/fluid/operators/collective/c_comm_init_all_op.cc b/paddle/fluid/operators/collective/c_comm_init_all_op.cc index 8c1a0db5714..d125354353d 100644 --- a/paddle/fluid/operators/collective/c_comm_init_all_op.cc +++ b/paddle/fluid/operators/collective/c_comm_init_all_op.cc @@ -38,7 +38,7 @@ namespace operators { class CCommInitAllInferShape : public framework::InferShapeBase { public: - ~CCommInitAllInferShape() {} + ~CCommInitAllInferShape() override {} void operator()(framework::InferShapeContext* ctx) const override{}; }; diff --git a/paddle/fluid/operators/collective/c_comm_init_multitrainer_op.cc b/paddle/fluid/operators/collective/c_comm_init_multitrainer_op.cc index 655053708de..cf209fab7c8 100644 --- a/paddle/fluid/operators/collective/c_comm_init_multitrainer_op.cc +++ b/paddle/fluid/operators/collective/c_comm_init_multitrainer_op.cc @@ -38,7 +38,7 @@ namespace operators { class CCommInitMultiTrainerInferShape : public framework::InferShapeBase { public: - ~CCommInitMultiTrainerInferShape() {} + ~CCommInitMultiTrainerInferShape() override {} void operator()(framework::InferShapeContext* ctx) const override{}; }; diff --git a/paddle/fluid/operators/collective/c_concat_op.cc b/paddle/fluid/operators/collective/c_concat_op.cc index 86890edbb35..27c1141f8b6 100644 --- a/paddle/fluid/operators/collective/c_concat_op.cc +++ b/paddle/fluid/operators/collective/c_concat_op.cc @@ -81,7 +81,7 @@ class CConcatOpGradMaker : public framework::SingleGradOpMaker { class CConcatOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor to be concated."); AddOutput("Out", "(Tensor) the result of concat."); AddAttr("rank", "(int default 0) rank id.").SetDefault(0); diff --git a/paddle/fluid/operators/collective/c_identity_op.cc b/paddle/fluid/operators/collective/c_identity_op.cc index 64049cdfab7..ca47e3c983c 100644 --- a/paddle/fluid/operators/collective/c_identity_op.cc +++ b/paddle/fluid/operators/collective/c_identity_op.cc @@ -44,7 +44,7 @@ class CIdentityOp : public framework::OperatorWithKernel { class CIdentityOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) identity tensor."); AddOutput("Out", "(Tensor) identity tensor."); AddAttr("ring_id", "(int default 0) nccl communication ring id.") diff --git a/paddle/fluid/operators/collective/c_reducescatter_op.cc b/paddle/fluid/operators/collective/c_reducescatter_op.cc index 7ee1539328f..11c0094340f 100644 --- a/paddle/fluid/operators/collective/c_reducescatter_op.cc +++ b/paddle/fluid/operators/collective/c_reducescatter_op.cc @@ -42,7 +42,7 @@ class CReduceScatterOp : public framework::OperatorWithKernel { class CReduceScatterOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor to be allgather"); AddOutput("Out", "(Tensor) the allgather result"); AddAttr("ring_id", "(int default 0) communication ring id.") diff --git a/paddle/fluid/operators/collective/c_scatter_op.cc b/paddle/fluid/operators/collective/c_scatter_op.cc index eaaf27e2f59..162f4d14785 100644 --- a/paddle/fluid/operators/collective/c_scatter_op.cc +++ b/paddle/fluid/operators/collective/c_scatter_op.cc @@ -61,7 +61,7 @@ class CScatterOp : public framework::OperatorWithKernel { class CScatterOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor to be broadcasted."); AddOutput("Out", "(Tensor) the result of broadcast."); AddAttr("ring_id", "(int default 0) nccl communication ring id.") diff --git a/paddle/fluid/operators/collective/c_softmax_with_cross_entropy_op.cc b/paddle/fluid/operators/collective/c_softmax_with_cross_entropy_op.cc index e98e841cef1..e4de0ceb136 100644 --- a/paddle/fluid/operators/collective/c_softmax_with_cross_entropy_op.cc +++ b/paddle/fluid/operators/collective/c_softmax_with_cross_entropy_op.cc @@ -83,7 +83,7 @@ class CSoftmaxWithCrossEntropyOp : public framework::OperatorWithKernel { class CSoftmaxWithCrossEntropyOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("Logits", "(Tensor, default: Tensor), The input tensor of unscaled " "log probabilities, whose dimension :attr:`axis` should be scaled " diff --git a/paddle/fluid/operators/collective/c_split_op.cc b/paddle/fluid/operators/collective/c_split_op.cc index 0adffeb60fa..1bca682dbab 100644 --- a/paddle/fluid/operators/collective/c_split_op.cc +++ b/paddle/fluid/operators/collective/c_split_op.cc @@ -89,7 +89,7 @@ class CSplitOpGradMaker : public framework::SingleGradOpMaker { class CSplitOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor to be split."); AddOutput("Out", "(Tensor) the result of split."); AddAttr("rank", "(int default 0) rank id.").SetDefault(0); diff --git a/paddle/fluid/operators/collective/c_sync_calc_stream_op.cc b/paddle/fluid/operators/collective/c_sync_calc_stream_op.cc index c9f129610bd..3a75775e7a9 100644 --- a/paddle/fluid/operators/collective/c_sync_calc_stream_op.cc +++ b/paddle/fluid/operators/collective/c_sync_calc_stream_op.cc @@ -18,7 +18,7 @@ namespace operators { class CSyncCalcStreamOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) Dependency of the variable need to sync"); AddOutput("Out", "(Tensor) Dependency of the variable need to sync"); AddComment(R"DOC( diff --git a/paddle/fluid/operators/collective/c_sync_comm_stream_op.cc b/paddle/fluid/operators/collective/c_sync_comm_stream_op.cc index 2b34747fd12..935de19b948 100644 --- a/paddle/fluid/operators/collective/c_sync_comm_stream_op.cc +++ b/paddle/fluid/operators/collective/c_sync_comm_stream_op.cc @@ -31,7 +31,7 @@ class CSyncCommStreamOp : public framework::OperatorWithKernel { class CSyncCommStreamOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) Dependency of the variable need to sync") .AsDuplicable(); AddOutput("Out", "(Tensor) Dependency of the variable need to sync") diff --git a/paddle/fluid/operators/collective/c_wait_comm_op.cc b/paddle/fluid/operators/collective/c_wait_comm_op.cc index bacbe014a34..a9615d2f3d1 100644 --- a/paddle/fluid/operators/collective/c_wait_comm_op.cc +++ b/paddle/fluid/operators/collective/c_wait_comm_op.cc @@ -73,7 +73,7 @@ class CWaitCommOp : public framework::OperatorBase { class CWaitCommOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) Dependency of the variable need to sync") .AsDuplicable(); AddOutput("Out", "(Tensor) Dependency of the variable need to sync") diff --git a/paddle/fluid/operators/collective/c_wait_compute_op.cc b/paddle/fluid/operators/collective/c_wait_compute_op.cc index 34569b0a4b6..bdd0d9b3ba1 100644 --- a/paddle/fluid/operators/collective/c_wait_compute_op.cc +++ b/paddle/fluid/operators/collective/c_wait_compute_op.cc @@ -74,7 +74,7 @@ class CWaitComputeOp : public framework::OperatorBase { class CWaitComputeOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) Dependency of the variable need to sync") .AsDuplicable(); AddOutput("Out", "(Tensor) Dependency of the variable need to sync") diff --git a/paddle/fluid/operators/collective/global_gather_op.cc b/paddle/fluid/operators/collective/global_gather_op.cc index e97a1a81f31..a78f40686e9 100644 --- a/paddle/fluid/operators/collective/global_gather_op.cc +++ b/paddle/fluid/operators/collective/global_gather_op.cc @@ -58,7 +58,7 @@ class GlobalGatherOp : public framework::OperatorWithKernel { class GlobalGatherOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor send."); AddInput("local_count", "(Tensor) Tensor which has n_expert * world_size elements that " diff --git a/paddle/fluid/operators/collective/global_scatter_op.cc b/paddle/fluid/operators/collective/global_scatter_op.cc index d4652b4885c..dc6f1fd735b 100644 --- a/paddle/fluid/operators/collective/global_scatter_op.cc +++ b/paddle/fluid/operators/collective/global_scatter_op.cc @@ -61,7 +61,7 @@ class GlobalScatterOp : public framework::OperatorWithKernel { class GlobalScatterOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor send."); AddInput("local_count", "(Tensor) Tensor which has n_expert * world_size elements that " diff --git a/paddle/fluid/operators/collective/mp_allreduce_sum_op.cc b/paddle/fluid/operators/collective/mp_allreduce_sum_op.cc index dcc59f703ff..f680818da2d 100644 --- a/paddle/fluid/operators/collective/mp_allreduce_sum_op.cc +++ b/paddle/fluid/operators/collective/mp_allreduce_sum_op.cc @@ -37,7 +37,7 @@ class MpAllReduceSumOp : public framework::OperatorWithKernel { class MpAllReduceSumOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor), tensor to be allreduced in model parallel."); AddOutput("Out", "(Tensor) the allreduced result in model parallel."); AddAttr("ring_id", "(int default 0) communication ring id.") diff --git a/paddle/fluid/operators/collective/partial_allgather_op.cc b/paddle/fluid/operators/collective/partial_allgather_op.cc index 7f9e5f3f3e3..75220ea5b30 100644 --- a/paddle/fluid/operators/collective/partial_allgather_op.cc +++ b/paddle/fluid/operators/collective/partial_allgather_op.cc @@ -45,7 +45,7 @@ class PartialAllGatherOp : public framework::OperatorWithKernel { class PartialAllGatherOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor to be partial allgather"); AddOutput("Out", "(Tensor) the allgather result"); AddAttr("ring_id", "(int default 0) communication ring id.") diff --git a/paddle/fluid/operators/collective/partial_recv_op.cc b/paddle/fluid/operators/collective/partial_recv_op.cc index 5cd4a72ea7e..681864e4e1a 100644 --- a/paddle/fluid/operators/collective/partial_recv_op.cc +++ b/paddle/fluid/operators/collective/partial_recv_op.cc @@ -91,7 +91,7 @@ class PartialRecvOp : public framework::OperatorWithKernel { class PartialRecvOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddOutput("Out", "(Tensor) tensor to receive."); AddAttr("ring_id", "(int default 0) nccl communication ring id.") .SetDefault(0); diff --git a/paddle/fluid/operators/collective/partial_send_op.cc b/paddle/fluid/operators/collective/partial_send_op.cc index 936336ce74a..a655479d3d8 100644 --- a/paddle/fluid/operators/collective/partial_send_op.cc +++ b/paddle/fluid/operators/collective/partial_send_op.cc @@ -60,7 +60,7 @@ class PartialSendOp : public framework::OperatorWithKernel { class PartialSendMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor to be sent."); AddAttr("ring_id", "(int default 0) nccl communication ring id.") .SetDefault(0); diff --git a/paddle/fluid/operators/collective/recv_v2_op.cc b/paddle/fluid/operators/collective/recv_v2_op.cc index 6658b65a4dd..260e676affd 100644 --- a/paddle/fluid/operators/collective/recv_v2_op.cc +++ b/paddle/fluid/operators/collective/recv_v2_op.cc @@ -80,7 +80,7 @@ class RecvOpV2 : public framework::OperatorWithKernel { class RecvOpV2Maker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddOutput("Out", "(Tensor) tensor to receive."); AddAttr("ring_id", "(int default 0) nccl communication ring id.") .SetDefault(0); diff --git a/paddle/fluid/operators/collective/send_v2_op.cc b/paddle/fluid/operators/collective/send_v2_op.cc index 9a52b9996ae..862a6a67813 100644 --- a/paddle/fluid/operators/collective/send_v2_op.cc +++ b/paddle/fluid/operators/collective/send_v2_op.cc @@ -56,7 +56,7 @@ class SendOpV2 : public framework::OperatorWithKernel { class SendOpV2Maker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) tensor to be sent."); AddAttr("ring_id", "(int default 0) nccl communication ring id.") .SetDefault(0); diff --git a/paddle/fluid/operators/fused/fused_gemm_epilogue_op.cc b/paddle/fluid/operators/fused/fused_gemm_epilogue_op.cc index d87bb97edf3..fb0550b0c10 100644 --- a/paddle/fluid/operators/fused/fused_gemm_epilogue_op.cc +++ b/paddle/fluid/operators/fused/fused_gemm_epilogue_op.cc @@ -127,7 +127,7 @@ class FusedGemmEpilogueOp : public framework::OperatorWithKernel { } phi::KernelKey GetExpectedKernelType( - const framework::ExecutionContext& ctx) const { + const framework::ExecutionContext& ctx) const override { auto data_type = OperatorWithKernel::IndicateVarDataType(ctx, "X"); return phi::KernelKey(data_type, ctx.GetPlace()); } @@ -277,7 +277,7 @@ class FusedGemmEpilogueGradOp : public framework::OperatorWithKernel { } phi::KernelKey GetExpectedKernelType( - const framework::ExecutionContext& ctx) const { + const framework::ExecutionContext& ctx) const override { auto data_type = OperatorWithKernel::IndicateVarDataType(ctx, "DOut"); return phi::KernelKey(data_type, ctx.GetPlace()); } diff --git a/paddle/fluid/operators/fused/resnet_unit_op.cc b/paddle/fluid/operators/fused/resnet_unit_op.cc index 05aa019a5a4..1547f20801b 100644 --- a/paddle/fluid/operators/fused/resnet_unit_op.cc +++ b/paddle/fluid/operators/fused/resnet_unit_op.cc @@ -35,7 +35,7 @@ class ResNetUnitOp : public framework::OperatorWithKernel { public: using framework::OperatorWithKernel::OperatorWithKernel; - void InferShape(framework::InferShapeContext* ctx) const { + void InferShape(framework::InferShapeContext* ctx) const override { // Check input OP_INOUT_CHECK(ctx->HasInput("X"), "Input", "X", "ResNetUnitOp"); OP_INOUT_CHECK( @@ -201,7 +201,7 @@ class ResNetUnitOp : public framework::OperatorWithKernel { protected: phi::KernelKey GetExpectedKernelType( - const framework::ExecutionContext& ctx) const { + const framework::ExecutionContext& ctx) const override { auto input_data_type = OperatorWithKernel::IndicateVarDataType(ctx, "X"); // By default, the type of the scale, bias, mean, // and var tensors should be float when input tensor's dtype is float16. @@ -223,7 +223,7 @@ class ResNetUnitOp : public framework::OperatorWithKernel { class ResNetUnitOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "The input 1 tensor"); AddInput("FilterX", "Filter tensor of input 1"); AddInput("ScaleX", "Scale tensor of input 1 used in batchnorm"); @@ -283,7 +283,7 @@ class ResNetUnitGradOp : public framework::OperatorWithKernel { public: using framework::OperatorWithKernel::OperatorWithKernel; - void InferShape(framework::InferShapeContext* ctx) const { + void InferShape(framework::InferShapeContext* ctx) const override { // check input OP_INOUT_CHECK(ctx->HasInput("X"), "Input", "X", "ResNetUnitGradOp"); OP_INOUT_CHECK( @@ -390,7 +390,7 @@ class ResNetUnitGradOp : public framework::OperatorWithKernel { protected: phi::KernelKey GetExpectedKernelType( - const framework::ExecutionContext& ctx) const { + const framework::ExecutionContext& ctx) const override { PADDLE_ENFORCE_NOT_NULL( ctx.InputVar(framework::GradVarName("Y")), platform::errors::NotFound( diff --git a/paddle/fluid/operators/fused/yolo_box_head_op.cc b/paddle/fluid/operators/fused/yolo_box_head_op.cc index 58df4e61bbb..9a4e7b56434 100644 --- a/paddle/fluid/operators/fused/yolo_box_head_op.cc +++ b/paddle/fluid/operators/fused/yolo_box_head_op.cc @@ -21,7 +21,7 @@ class YoloBoxHeadOp : public framework::OperatorWithKernel { public: using framework::OperatorWithKernel::OperatorWithKernel; - void InferShape(framework::InferShapeContext* ctx) const { + void InferShape(framework::InferShapeContext* ctx) const override { OP_INOUT_CHECK(ctx->HasInput("X"), "Input", "X", "yolo_box_head"); OP_INOUT_CHECK(ctx->HasOutput("Out"), "Output", "Out", "yolo_box_head"); ctx->SetOutputDim("Out", ctx->GetInputDim("X")); @@ -30,7 +30,7 @@ class YoloBoxHeadOp : public framework::OperatorWithKernel { class YoloBoxHeadOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "The input tensor"); AddAttr>("anchors", "The anchor width and height, " diff --git a/paddle/fluid/operators/fused/yolo_box_post_op.cc b/paddle/fluid/operators/fused/yolo_box_post_op.cc index 92ca4bfaf68..d13789be546 100644 --- a/paddle/fluid/operators/fused/yolo_box_post_op.cc +++ b/paddle/fluid/operators/fused/yolo_box_post_op.cc @@ -21,7 +21,7 @@ class YoloBoxPostOp : public framework::OperatorWithKernel { public: using framework::OperatorWithKernel::OperatorWithKernel; - void InferShape(framework::InferShapeContext* ctx) const { + void InferShape(framework::InferShapeContext* ctx) const override { OP_INOUT_CHECK(ctx->HasInput("Boxes0"), "Input", "Boxes0", "yolo_box_post"); OP_INOUT_CHECK(ctx->HasInput("Boxes1"), "Input", "Boxes1", "yolo_box_post"); OP_INOUT_CHECK(ctx->HasInput("Boxes2"), "Input", "Boxes2", "yolo_box_post"); @@ -37,7 +37,7 @@ class YoloBoxPostOp : public framework::OperatorWithKernel { class YoloBoxPostOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("Boxes0", "The Boxes0 tensor"); AddInput("Boxes1", "The Boxes1 tensor"); AddInput("Boxes2", "The Boxes2 tensor"); diff --git a/paddle/fluid/operators/marker_op.cc b/paddle/fluid/operators/marker_op.cc index 91a2131ec8e..0735e63c229 100644 --- a/paddle/fluid/operators/marker_op.cc +++ b/paddle/fluid/operators/marker_op.cc @@ -38,7 +38,7 @@ class MarkerOp : public framework::OperatorWithKernel { class MarkerOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddAttr("marker_role", "(string, default forward)forward or backward," " mark different stages of porcess.") diff --git a/paddle/fluid/operators/mul_op.cc b/paddle/fluid/operators/mul_op.cc index 8236bdd5993..e06f7d443b8 100644 --- a/paddle/fluid/operators/mul_op.cc +++ b/paddle/fluid/operators/mul_op.cc @@ -32,7 +32,7 @@ class MulOp : public framework::OperatorWithKernel { using framework::OperatorWithKernel::OperatorWithKernel; phi::KernelKey GetExpectedKernelType( - const framework::ExecutionContext& ctx) const { + const framework::ExecutionContext& ctx) const override { auto input_data_type = OperatorWithKernel::IndicateVarDataType(ctx, "X"); return phi::KernelKey(input_data_type, ctx.GetPlace()); } @@ -104,7 +104,7 @@ class MulGradOp : public framework::OperatorWithKernel { using framework::OperatorWithKernel::OperatorWithKernel; phi::KernelKey GetExpectedKernelType( - const framework::ExecutionContext& ctx) const { + const framework::ExecutionContext& ctx) const override { auto input_data_type = OperatorWithKernel::IndicateVarDataType(ctx, "X"); return phi::KernelKey(input_data_type, ctx.GetPlace()); } diff --git a/paddle/fluid/operators/nop_op.cc b/paddle/fluid/operators/nop_op.cc index 69f0bfb2abc..a3d00594d74 100644 --- a/paddle/fluid/operators/nop_op.cc +++ b/paddle/fluid/operators/nop_op.cc @@ -33,7 +33,7 @@ class NopOp : public framework::OperatorWithKernel { class NopOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) The input tensor of nop op.").AsDuplicable(); AddOutput("Out", "(Tensor) The output tensor of nop op.").AsDuplicable(); AddComment(R"DOC( diff --git a/paddle/fluid/operators/optimizers/pow2_decay_with_linear_warmup_op.cc b/paddle/fluid/operators/optimizers/pow2_decay_with_linear_warmup_op.cc index 105c698355e..625db9f375a 100644 --- a/paddle/fluid/operators/optimizers/pow2_decay_with_linear_warmup_op.cc +++ b/paddle/fluid/operators/optimizers/pow2_decay_with_linear_warmup_op.cc @@ -40,7 +40,7 @@ class Pow2DecayWithLinearWarmupOp : public framework::OperatorWithKernel { class Pow2DecayWithLinearWarmupOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("LearningRate", "(Tensor) The input learning rate Tensor."); AddInput("Step", "(Tensor) The input global step Tensor."); AddOutput("LearningRateOut", diff --git a/paddle/fluid/operators/pscore/fetch_barrier_op.cc b/paddle/fluid/operators/pscore/fetch_barrier_op.cc index ab085207af5..fcdf33be061 100644 --- a/paddle/fluid/operators/pscore/fetch_barrier_op.cc +++ b/paddle/fluid/operators/pscore/fetch_barrier_op.cc @@ -46,7 +46,7 @@ class FetchBarrierOp : public framework::OperatorBase { class FetchBarrierOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Any) Dummy inputs, used for control dependency") .AsDispensable() .AsDuplicable(); diff --git a/paddle/fluid/operators/pscore/heter_listen_and_serv_op.cc b/paddle/fluid/operators/pscore/heter_listen_and_serv_op.cc index 5a39de9fa4d..ca27fbba9e4 100644 --- a/paddle/fluid/operators/pscore/heter_listen_and_serv_op.cc +++ b/paddle/fluid/operators/pscore/heter_listen_and_serv_op.cc @@ -177,7 +177,7 @@ void HeterListenAndServOp::RunImpl(const framework::Scope &scope, class HeterListenAndServOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) Variables that server recv.").AsDuplicable(); AddComment( R"DOC(" + "HeterListenAndServ operator" + "\n" + "This operator" + diff --git a/paddle/fluid/operators/pscore/listen_and_serv_op.cc b/paddle/fluid/operators/pscore/listen_and_serv_op.cc index 6d98ee3cc0e..23840017afd 100644 --- a/paddle/fluid/operators/pscore/listen_and_serv_op.cc +++ b/paddle/fluid/operators/pscore/listen_and_serv_op.cc @@ -52,7 +52,7 @@ class ListenAndServOp : public framework::OperatorBase { class ListenAndServOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor) Variables that server recv.").AsDuplicable(); AddComment(R"DOC(" + "ListenAndServ operator" + "\n" + "This operator" + " will start a RPC server which can receive variables from send_op and send" + diff --git a/paddle/fluid/operators/pscore/send_and_recv_op.cc b/paddle/fluid/operators/pscore/send_and_recv_op.cc index 99e8d04a9e3..4f118565396 100644 --- a/paddle/fluid/operators/pscore/send_and_recv_op.cc +++ b/paddle/fluid/operators/pscore/send_and_recv_op.cc @@ -69,7 +69,7 @@ class SendAndRecvOp : public framework::OperatorWithKernel { class SendAndRecvOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "Tensor Input variable to be sent").AsDuplicable(); AddOutput("Out", "Tensor Output varibale to be recv").AsDuplicable(); AddAttr("message_name", ""); diff --git a/paddle/fluid/operators/pscore/send_barrier_op.cc b/paddle/fluid/operators/pscore/send_barrier_op.cc index 81660b86cd1..eacc01e1315 100644 --- a/paddle/fluid/operators/pscore/send_barrier_op.cc +++ b/paddle/fluid/operators/pscore/send_barrier_op.cc @@ -47,7 +47,7 @@ class SendBarrierOp : public framework::OperatorBase { class SendBarrierOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Any) Dummy inputs, used for control dependency") .AsDuplicable(); AddOutput("Out", "(Any) Dummy outputs, used for control dependency") diff --git a/paddle/fluid/operators/pscore/send_op.cc b/paddle/fluid/operators/pscore/send_op.cc index f32f5093790..8a543389998 100644 --- a/paddle/fluid/operators/pscore/send_op.cc +++ b/paddle/fluid/operators/pscore/send_op.cc @@ -75,7 +75,7 @@ class SendOp : public framework::OperatorBase { class SendOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "(Tensor, SelectedRows) Input variables to be sent") .AsDuplicable(); AddOutput("Out", "(Any) Dummy outputs, used for control dependency") diff --git a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc index 0048ec1e724..ba4f188274d 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc @@ -94,8 +94,8 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(ReduceMeanGradNoNeedBufferVarInferer, "X"); class __reduce_meanMaker__ : public ops::ReduceBaseOpMaker { protected: - virtual std::string GetName() const { return "reduce_mean"; } - virtual std::string GetOpType() const { return "Reduce reduce_mean"; } + std::string GetName() const override { return "reduce_mean"; } + std::string GetOpType() const override { return "Reduce reduce_mean"; } }; DECLARE_INFER_SHAPE_FUNCTOR( diff --git a/paddle/fluid/operators/tdm_child_op.cc b/paddle/fluid/operators/tdm_child_op.cc index 266bbb9657d..64c67d67b77 100644 --- a/paddle/fluid/operators/tdm_child_op.cc +++ b/paddle/fluid/operators/tdm_child_op.cc @@ -24,7 +24,7 @@ namespace paddle { namespace operators { class TDMChildOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "X(Tensor), dtype support int32/int64, X variable is the " "node id of TDM-Tree"); diff --git a/paddle/fluid/operators/tdm_sampler_op.cc b/paddle/fluid/operators/tdm_sampler_op.cc index cb667342f07..f5e835ca2f7 100644 --- a/paddle/fluid/operators/tdm_sampler_op.cc +++ b/paddle/fluid/operators/tdm_sampler_op.cc @@ -25,7 +25,7 @@ namespace operators { class TDMSamplerOpMaker : public framework::OpProtoAndCheckerMaker { public: - void Make() { + void Make() override { AddInput("X", "X(Tensor), Input variable which" "mapping the leaf node idx of tdm tree," diff --git a/paddle/fluid/pybind/imperative.cc b/paddle/fluid/pybind/imperative.cc index 761cde9153c..51dd1949ef5 100644 --- a/paddle/fluid/pybind/imperative.cc +++ b/paddle/fluid/pybind/imperative.cc @@ -89,7 +89,7 @@ class PyVariableWrapperHook : public imperative::VariableWrapperHook { Py_INCREF(py_func_); } - ~PyVariableWrapperHook() { + ~PyVariableWrapperHook() override { py::gil_scoped_acquire gil; Py_DECREF(py_func_); } diff --git a/paddle/ir/pass/ir_printing.cc b/paddle/ir/pass/ir_printing.cc index dd3b00c1dd8..87e0af4831f 100644 --- a/paddle/ir/pass/ir_printing.cc +++ b/paddle/ir/pass/ir_printing.cc @@ -45,7 +45,7 @@ class IRPrinting : public PassInstrumentation { explicit IRPrinting(std::unique_ptr option) : option_(std::move(option)) {} - ~IRPrinting() = default; + ~IRPrinting() override = default; void RunBeforePass(Pass *pass, Operation *op) override { if (option_->print_on_change()) { diff --git a/paddle/ir/pass/pass_timing.cc b/paddle/ir/pass/pass_timing.cc index 9b6d02ced03..595320308dc 100644 --- a/paddle/ir/pass/pass_timing.cc +++ b/paddle/ir/pass/pass_timing.cc @@ -51,7 +51,7 @@ class Timer { class PassTimer : public PassInstrumentation { public: explicit PassTimer(bool print_module) : print_module_(print_module) {} - ~PassTimer() = default; + ~PassTimer() override = default; void RunBeforePipeline(ir::Operation* op) override { pipeline_timers_[op] = Timer(); diff --git a/paddle/phi/api/profiler/device_tracer.cc b/paddle/phi/api/profiler/device_tracer.cc index ae026683f15..da7d8050110 100644 --- a/paddle/phi/api/profiler/device_tracer.cc +++ b/paddle/phi/api/profiler/device_tracer.cc @@ -323,7 +323,7 @@ class DeviceTracerImpl : public DeviceTracer { #endif } - void AddAnnotation(uint32_t id, Event *event) { + void AddAnnotation(uint32_t id, Event *event) override { #ifdef PADDLE_WITH_SW std::forward_list> *local_correlations_pairs = nullptr; @@ -339,7 +339,8 @@ class DeviceTracerImpl : public DeviceTracer { local_correlations_pairs->push_front(std::make_pair(id, event)); } - void AddAnnotations(const std::map &thr_events) { + void AddAnnotations( + const std::map &thr_events) override { for (auto &tmp : active_kind_records_) { for (const ActiveKindRecord &r : tmp) { auto iter = thr_events.find(r.thread_id); @@ -384,7 +385,7 @@ class DeviceTracerImpl : public DeviceTracer { uint64_t start_ns, uint64_t end_ns, int64_t device_id, - uint64_t thread_id) { + uint64_t thread_id) override { if (anno.empty()) { VLOG(1) << "Empty timeline annotation."; return; @@ -409,7 +410,7 @@ class DeviceTracerImpl : public DeviceTracer { int64_t device_id, int64_t stream_id, uint32_t correlation_id, - uint64_t bytes) { + uint64_t bytes) override { // 0 means timestamp information could not be collected for the kernel. if (start_ns == 0 || end_ns == 0 || start_ns == end_ns) { VLOG(3) << name << " cannot be traced"; @@ -427,7 +428,7 @@ class DeviceTracerImpl : public DeviceTracer { const Place &place, const std::string &alloc_in, const std::string &free_in, - uint64_t thread_id) { + uint64_t thread_id) override { if (0 == start_ns || 0 == end_ns) { VLOG(3) << alloc_in << ", " << free_in << " Cannot be traced."; return; @@ -452,7 +453,7 @@ class DeviceTracerImpl : public DeviceTracer { uint64_t end_ns, int64_t device_id, uint64_t thread_id, - uint32_t correlation_id) { + uint32_t correlation_id) override { if (anno.empty()) { VLOG(1) << "Empty timeline annotation."; return; @@ -478,7 +479,7 @@ class DeviceTracerImpl : public DeviceTracer { uint64_t end, int64_t device_id, int64_t stream_id, - uint32_t correlation_id) { + uint32_t correlation_id) override { // 0 means timestamp information could not be collected for the kernel. if (start == 0 || end == 0 || start == end) { VLOG(3) << correlation_id << " cannot be traced"; @@ -490,12 +491,12 @@ class DeviceTracerImpl : public DeviceTracer { KernelRecord{name, start, end, device_id, stream_id, correlation_id}); } - bool IsEnabled() { + bool IsEnabled() override { std::lock_guard l(trace_mu_); return enabled_; } - void Enable() { + void Enable() override { std::lock_guard l(trace_mu_); if (enabled_) { return; @@ -544,7 +545,7 @@ class DeviceTracerImpl : public DeviceTracer { enabled_ = true; } - void Reset() { + void Reset() override { #ifdef PADDLE_WITH_CUPTI CUPTI_CALL( dynload::cuptiActivityFlushAll(CUPTI_ACTIVITY_FLAG_FLUSH_FORCED)); @@ -559,7 +560,7 @@ class DeviceTracerImpl : public DeviceTracer { for (auto &tmp : active_kind_records_) tmp.clear(); } - void GenEventKernelCudaElapsedTime() { + void GenEventKernelCudaElapsedTime() override { #ifdef PADDLE_WITH_CUPTI if (correlations_.empty()) for (auto &tmp : correlations_pairs) @@ -591,7 +592,7 @@ class DeviceTracerImpl : public DeviceTracer { #endif } - proto::Profile GenProfile(const std::string &profile_path) { + proto::Profile GenProfile(const std::string &profile_path) override { proto::Profile profile_pb = this->GetProfile(); std::ofstream profile_f; profile_f.open(profile_path, @@ -601,7 +602,7 @@ class DeviceTracerImpl : public DeviceTracer { return profile_pb; } - proto::Profile GetProfile() { + proto::Profile GetProfile() override { int miss = 0, find = 0; std::lock_guard l(trace_mu_); proto::Profile profile_pb; @@ -711,7 +712,7 @@ class DeviceTracerImpl : public DeviceTracer { return profile_pb; } - void Disable() { + void Disable() override { #ifdef PADDLE_WITH_CUPTI // flush might cause additional calls to DeviceTracker. CUPTI_CALL( -- GitLab