diff --git a/.clang-tidy b/.clang-tidy index 9c3f6daa4eb719a3cb06710030c367cfc3a949de..3ae8f6a9b61bc5d8f75a72b21be8ac8c3555a6e6 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 4aabf3453423aaec57a3dd50c41c7f93546c001f..b6261cbfad6449014b0deb447512884773d26b3d 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 3a7a04450055df623bdcbb6635a577f025542420..9cb8ce260683f74f45e56541cad2ab7edffebb66 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 4038f39fc53d91adeca0c1cdade3a6e09a0401ce..d24322ede7e75321fd5484ad11cb437b27fb6d2d 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 e56679bd125a3db61e38e34b3038817fcaca5900..a3ec33d8b2fb622f417b0b87c7709b7ff2ff4c64 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 ad4a51152c4728ec9ac0978c89c940026a21b557..95fc97c3cf0439db2f8db3e11e0297badcddb1f0 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 01b28e364a5e70b23ec494f54bec52ae5a8c4c3d..7ac4a4bf27e8156952888708ddd6d3253a780707 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 804136e57b7e19b015391df50ee81ccf19d8b6bd..51de895be3d42426cb21a400458859ce21eba8aa 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 40305cc2106a5a93a68d2f03c8ec3876544c7b4a..dc3dfff58e96eed1170e045841e2f0d847677185 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 8c0346b5dd3c46b7ff70001dd766363b59a9e357..a8e3b2808092cfbdb416a96f6bf782cb2af47c45 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 039bd7789adb8be318963bd53ba45bb4ffdeb248..d73c215566d94e5fccd6b45cc085db07eaaf7b8f 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 b78d9504dafb76b6963433c55b7e9f58bd185753..ab5d28b3a9db27e012ffa910741cddb0cac36a85 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 1b980e64a5c1277c870e29cba89f7fd7580d1cac..670b69c05701cdb018de72ffd569d54ceb30857d 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 8c1a0db57149029f77e019f06a3d6b9f0083930a..d125354353d91d0ae99252d23c923bab570f2919 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 655053708de09eb516547a788d56cb91a2ef6540..cf209fab7c8428d44a105528b5bbd2991bb44c75 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 86890edbb357f4828f1726eaa79c1eb76ce7d91e..27c1141f8b67f46faed032da5556eacd0f77c63e 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 64049cdfab7e9e106e93e1bf2264c7e3429e66c3..ca47e3c983cb822efd53f9a25d4514f70c91bc9a 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 7ee1539328f989d19d8606c3bf241e899bf5b10a..11c0094340f08780a90677ab4b6bc19b2abaf8c2 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 eaaf27e2f5965a5e02cc0801382dcbd55ba6e9ba..162f4d1478584d9486e8dfe7a08d46769916f0c8 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 e98e841cef1652a70009ad49936f5e176237edd2..e4de0ceb136c113e57367f7901d4b3bd8f036fc8 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 0adffeb60fa2c6e0af5f9509bfc0dc0c18903389..1bca682dbab8f7041dbcde240da4885da5658729 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 c9f129610bd683d3ad2ee6136f188ebc4f5fa010..3a75775e7a98f1a3b2b674995ec44f393bb14914 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 2b34747fd124db6db5f19ccc9a8c6868bf6bfa27..935de19b948dcdc8b0dd7c03c1a98eff71036393 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 bacbe014a343cedf2901975208eefdbf00466d28..a9615d2f3d14bdf7ee88500ad9f0cfe96b5f1cbf 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 34569b0a4b600349821091741e315958e85afc8b..bdd0d9b3ba1ee0740cda2a605aea2d355d26fd5a 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 e97a1a81f31f598dd0d47b4eef351e63cab9999f..a78f40686e9250613dcb321a6b2fce7d00bd67d3 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 d4652b4885c6da8952bace62ba9a5460b9e3f743..dc6f1fd735bacac31d0a25570f306ea9bf80a1e7 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 dcc59f703fffa20e67bf2b8b24d63eafe9675a2e..f680818da2d9433a6edb324e55add7543334494c 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 7f9e5f3f3e37f0c07b4fae8469e199bbca3cd56a..75220ea5b30a5c90c1cd1e0d691b8d3052749d94 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 5cd4a72ea7ea9f5c8e2311e51d73221361e36e0e..681864e4e1aa4bf2e42ab80110465a40bd71a61e 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 936336ce74ad5257a88908a8792e9bb16f24f4db..a655479d3d8af9dd1f3c71dd3e41c3ac87f38560 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 6658b65a4dd2ed0db5368506f6e99edcacbd8474..260e676affdc366aa84ba8a8226292e14eedfd09 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 9a52b9996aea020fdafc6ff0cd6b626de4053ad5..862a6a67813c109dd4c9ba3c386c1a7f768cac72 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 d87bb97edf30f487a39ad82b342a7204362a7b5b..fb0550b0c10e5e8c5a1331fed475082c5decb3f6 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 05aa019a5a488fee55d49e8a32d015905f808019..1547f20801b56854e423f1b3eb317fc5b167078b 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 58df4e61bbbdff7b38ee75ff5e1c3085415f46a3..9a4e7b56434efc032e077d9f2d1602c364b51ed8 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 92ca4bfaf68c17c1e1129bc41ee1ae25e7c304e8..d13789be546526ca884a4757cb6adb68492726d1 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 91a2131ec8e2cbf916555085e0470488559a8ec3..0735e63c229b75961ab56809762268d52ab68f98 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 8236bdd5993e551526fc94d1b21246787cc9133c..e06f7d443b84dbf7728f743ccb910da0b9eb3f05 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 69f0bfb2abcd312b1a3fd8ebd567a44d4fb355a7..a3d00594d74c7f93d04b9db74e10b04101a997c8 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 105c698355e6d08219ededc4be7762e27c7f82d5..625db9f375ab02c61e380fd90f6ee6f5be0bc4be 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 ab085207af54db468148657ed28026efab192002..fcdf33be0617a0009c32eda6d6d36ed151ba4b37 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 5a39de9fa4d653021a0bcebba384ba28cbd5e0bc..ca27fbba9e4b7cac58fcd345d400bb1d41ca1463 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 6d98ee3cc0ec47a06b3f805db03fdae81240d2cd..23840017afd90bcd5e890bf62001d1cfd03739b0 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 99e8d04a9e329e10e307317ba157953fa5470d83..4f118565396e11f20ed12a908131f8dffe9bc862 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 81660b86cd122f5e177a9f8fd66dfd3d988453f1..eacc01e13151883d645e9dd8802e5eb8639554e5 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 f32f50937906b3d0574478a22e223d60138b0e0d..8a54338999869761c2fde0ced1d0cf0798d6fa91 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 0048ec1e7242a80f76b3896f1b1587d495fe6c87..ba4f188274d18aa0d334612e1f276bd8a741f179 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 266bbb9657db2093ad3d994551c2d02541b21137..64c67d67b776ab94f705eb85cc402b11c8b0a61e 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 cb667342f0784e3b6529165c11fbf664ea8309b6..f5e835ca2f7a79e7c4ee99b1cf831a264cde4466 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 761cde9153c08c5e1a1282efc5f4d01bfd666a6c..51dd1949ef56efb6b3ab3289477661c4a9b2ad71 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 dd3b00c1dd8a0f1adf893d1107a8e695660b2bc7..87e0af4831f5798ee25b06d20b0ddff944da990b 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 9b6d02ced03d070eaf6e57539468d78c55d5c62f..595320308dce37fccc8a8033f071a5e2bc93e0d4 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 ae026683f15090d891afe21e570b85046036d963..da7d80501108113380bd7cf49c0e1c6c048183a2 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(