From dbb6269207c813e7192026a0aabdbada74c2620b Mon Sep 17 00:00:00 2001 From: Galaxy1458 <55453380+Galaxy1458@users.noreply.github.com> Date: Thu, 11 May 2023 19:01:46 +0800 Subject: [PATCH] remove some [-Wunused-parameter] warning (#53683) * test,test=develop * test,test=develop * test,test=develop * test,test=develop * test,test=develop * test,test=develop --- paddle/fluid/operators/collective/global_gather_op.h | 2 +- paddle/fluid/operators/collective/global_scatter_op.h | 2 +- .../fluid/operators/collective/partial_allgather_op.h | 2 +- paddle/fluid/operators/collective/partial_recv_op.h | 2 +- paddle/fluid/operators/collective/partial_send_op.h | 2 +- paddle/fluid/operators/collective/recv_v2_op.h | 2 +- paddle/phi/kernels/impl/eigvalsh_grad_kernel_impl.h | 4 ++-- paddle/phi/kernels/impl/einsum_impl.h | 2 +- paddle/phi/kernels/impl/elementwise_grad_kernel_impl.h | 10 ++++++---- paddle/phi/kernels/impl/lamb_kernel_impl.h | 2 +- paddle/phi/kernels/impl/lu_kernel_impl.h | 2 +- paddle/phi/kernels/impl/unstack_kernel_impl.h | 2 +- paddle/phi/kernels/onednn/conv_handler.h | 6 +++--- paddle/phi/kernels/onednn/pool_kernel.cc | 2 +- paddle/phi/kernels/onednn/reduce_kernel_impl.h | 2 +- paddle/phi/kernels/onednn/slice_kernel.cc | 2 +- .../phi/kernels/selected_rows/impl/lamb_kernel_impl.h | 2 +- paddle/phi/kernels/sparse/cpu/conv_grad_kernel.cc | 8 ++++---- paddle/phi/kernels/sparse/cpu/conv_kernel.cc | 2 +- 19 files changed, 30 insertions(+), 28 deletions(-) diff --git a/paddle/fluid/operators/collective/global_gather_op.h b/paddle/fluid/operators/collective/global_gather_op.h index 0d3b4ed92e9..723c5e48a5a 100644 --- a/paddle/fluid/operators/collective/global_gather_op.h +++ b/paddle/fluid/operators/collective/global_gather_op.h @@ -28,7 +28,7 @@ namespace operators { template class GlobalGatherOpCPUKernel : public framework::OpKernel { public: - void Compute(const framework::ExecutionContext& ctx) const override { + void Compute(const framework::ExecutionContext& ctx UNUSED) const override { PADDLE_THROW(platform::errors::Unavailable( "Do not support global gather op for cpu kernel now.")); } diff --git a/paddle/fluid/operators/collective/global_scatter_op.h b/paddle/fluid/operators/collective/global_scatter_op.h index 3cb2a3c7fc4..fc4b48500c0 100644 --- a/paddle/fluid/operators/collective/global_scatter_op.h +++ b/paddle/fluid/operators/collective/global_scatter_op.h @@ -28,7 +28,7 @@ namespace operators { template class GlobalScatterOpCPUKernel : public framework::OpKernel { public: - void Compute(const framework::ExecutionContext& ctx) const override { + void Compute(const framework::ExecutionContext& ctx UNUSED) const override { PADDLE_THROW(platform::errors::Unavailable( "Do not support global scatter op for cpu kernel now.")); } diff --git a/paddle/fluid/operators/collective/partial_allgather_op.h b/paddle/fluid/operators/collective/partial_allgather_op.h index 6b827a2656f..815558d0227 100644 --- a/paddle/fluid/operators/collective/partial_allgather_op.h +++ b/paddle/fluid/operators/collective/partial_allgather_op.h @@ -29,7 +29,7 @@ namespace operators { template class PartialAllGatherOpCPUKernel : public framework::OpKernel { public: - void Compute(const framework::ExecutionContext& ctx) const override { + void Compute(const framework::ExecutionContext& ctx UNUSED) const override { PADDLE_THROW(platform::errors::Unavailable( "Do not support partial_allgather for cpu kernel now.")); } diff --git a/paddle/fluid/operators/collective/partial_recv_op.h b/paddle/fluid/operators/collective/partial_recv_op.h index fdf3f02b0d6..baf47ef9dff 100644 --- a/paddle/fluid/operators/collective/partial_recv_op.h +++ b/paddle/fluid/operators/collective/partial_recv_op.h @@ -27,7 +27,7 @@ namespace operators { template class PartialRecvOpCPUKernel : public framework::OpKernel { public: - void Compute(const framework::ExecutionContext& ctx) const override { + void Compute(const framework::ExecutionContext& ctx UNUSED) const override { PADDLE_THROW(platform::errors::Unavailable( "Do not support partial_recv for cpu kernel now.")); } diff --git a/paddle/fluid/operators/collective/partial_send_op.h b/paddle/fluid/operators/collective/partial_send_op.h index 773125be7d4..b7b72789b87 100644 --- a/paddle/fluid/operators/collective/partial_send_op.h +++ b/paddle/fluid/operators/collective/partial_send_op.h @@ -28,7 +28,7 @@ namespace operators { template class PartialSendOpCPUKernel : public framework::OpKernel { public: - void Compute(const framework::ExecutionContext& ctx) const override { + void Compute(const framework::ExecutionContext& ctx UNUSED) const override { PADDLE_THROW(platform::errors::Unavailable( "Do not support partial_send for cpu kernel now.")); } diff --git a/paddle/fluid/operators/collective/recv_v2_op.h b/paddle/fluid/operators/collective/recv_v2_op.h index 3430cdb73aa..e76e4a7b551 100644 --- a/paddle/fluid/operators/collective/recv_v2_op.h +++ b/paddle/fluid/operators/collective/recv_v2_op.h @@ -27,7 +27,7 @@ namespace operators { template class RecvOpV2CPUKernel : public framework::OpKernel { public: - void Compute(const framework::ExecutionContext& ctx) const override { + void Compute(const framework::ExecutionContext& ctx UNUSED) const override { PADDLE_THROW(platform::errors::Unavailable( "Do not support recv for cpu kernel now.")); } diff --git a/paddle/phi/kernels/impl/eigvalsh_grad_kernel_impl.h b/paddle/phi/kernels/impl/eigvalsh_grad_kernel_impl.h index 7248985bf29..18a6a0518a3 100644 --- a/paddle/phi/kernels/impl/eigvalsh_grad_kernel_impl.h +++ b/paddle/phi/kernels/impl/eigvalsh_grad_kernel_impl.h @@ -27,8 +27,8 @@ template void EigvalshGradKernel(const Context& dev_ctx, const DenseTensor& out_v, const DenseTensor& out_w_grad, - const std::string& uplo, - bool is_test, + const std::string& uplo UNUSED, + bool is_test UNUSED, DenseTensor* x_grad) { auto tV = phi::TransposeLast2Dim(dev_ctx, phi::Conj(dev_ctx, out_v)); diff --git a/paddle/phi/kernels/impl/einsum_impl.h b/paddle/phi/kernels/impl/einsum_impl.h index 400334ad4e0..92a4f99c6eb 100644 --- a/paddle/phi/kernels/impl/einsum_impl.h +++ b/paddle/phi/kernels/impl/einsum_impl.h @@ -752,7 +752,7 @@ void EinsumKernel(const Context& dev_ctx, const std::string& equation, DenseTensor* out, std::vector cache, - std::vector xshape) { + std::vector xshape UNUSED) { std::vector tmp; // for the sake of compatibility, we may load and run v2.3 EinsumOp. Output // may have nullptr and the cache.size() is not equal to inputs.size(). refer diff --git a/paddle/phi/kernels/impl/elementwise_grad_kernel_impl.h b/paddle/phi/kernels/impl/elementwise_grad_kernel_impl.h index 15f99a58fa5..3ce1e721b96 100644 --- a/paddle/phi/kernels/impl/elementwise_grad_kernel_impl.h +++ b/paddle/phi/kernels/impl/elementwise_grad_kernel_impl.h @@ -119,7 +119,9 @@ void SubtractDoubleGradImpl(const Context& dev_ctx, template struct DivGradDX { - HOSTDEVICE T operator()(T x, T y, T out, T dout) const { return dout / y; } + HOSTDEVICE T operator()(T x UNUSED, T y, T out UNUSED, T dout) const { + return dout / y; + } }; template @@ -136,7 +138,7 @@ struct DivGradDX> { template struct DivGradDY { - HOSTDEVICE T operator()(T x, T y, T out, T dout) const { + HOSTDEVICE T operator()(T x UNUSED, T y, T out, T dout) const { return -dout * out / y; } }; @@ -857,14 +859,14 @@ struct MinGradDy { template struct HeavisideGradDx { - HOSTDEVICE T operator()(T x, T y, T out, T dout) const { + HOSTDEVICE T operator()(T x UNUSED, T y UNUSED, T out UNUSED, T dout) const { return dout * static_cast(0); } }; template struct HeavisideGradDy { - HOSTDEVICE T operator()(T x, T y, T out, T dout) const { + HOSTDEVICE T operator()(T x, T y UNUSED, T out UNUSED, T dout) const { return dout * static_cast(x == static_cast(0)); } }; diff --git a/paddle/phi/kernels/impl/lamb_kernel_impl.h b/paddle/phi/kernels/impl/lamb_kernel_impl.h index e0850b8aef0..b02d2a517a1 100644 --- a/paddle/phi/kernels/impl/lamb_kernel_impl.h +++ b/paddle/phi/kernels/impl/lamb_kernel_impl.h @@ -128,7 +128,7 @@ void ComputeImpl(const Context& dev_ctx, float beta1_f, float beta2_f, float epsilon_f, - bool multi_precision, + bool multi_precision UNUSED, DenseTensor* param_out, DenseTensor* mom1_out, DenseTensor* mom2_out, diff --git a/paddle/phi/kernels/impl/lu_kernel_impl.h b/paddle/phi/kernels/impl/lu_kernel_impl.h index 5663484362a..e9ba46d0c16 100644 --- a/paddle/phi/kernels/impl/lu_kernel_impl.h +++ b/paddle/phi/kernels/impl/lu_kernel_impl.h @@ -474,7 +474,7 @@ void Unpack_Pivot(const Context& dev_ctx, const DenseTensor& Pivot, DenseTensor* P, int h, - int w) { + int w UNUSED) { auto dims = Pivot.dims(); auto Pdimvec = vectorize(dims); auto prank = Pdimvec.size(); diff --git a/paddle/phi/kernels/impl/unstack_kernel_impl.h b/paddle/phi/kernels/impl/unstack_kernel_impl.h index 030f4a62c6e..102126a1e33 100644 --- a/paddle/phi/kernels/impl/unstack_kernel_impl.h +++ b/paddle/phi/kernels/impl/unstack_kernel_impl.h @@ -26,7 +26,7 @@ template void UnStackKernel(const Context &dev_ctx, const DenseTensor &x, int axis, - int num, + int num UNUSED, std::vector outs) { auto *dy = &x; auto dx = outs; diff --git a/paddle/phi/kernels/onednn/conv_handler.h b/paddle/phi/kernels/onednn/conv_handler.h index 2be0ba56497..fd6cf0c5778 100644 --- a/paddle/phi/kernels/onednn/conv_handler.h +++ b/paddle/phi/kernels/onednn/conv_handler.h @@ -240,10 +240,10 @@ class ConvOneDNNHandlerT const std::string& padding_algorithm, const std::vector& dilations_in, int groups, - const std::string& data_format, + const std::string& data_format UNUSED, bool is_test, - phi::DenseTensor* filter_grad, - phi::DenseTensor* in_x_grad, + phi::DenseTensor* filter_grad UNUSED, + phi::DenseTensor* in_x_grad UNUSED, const std::string& unique_name) : funcs::OneDNNHandlerT& paddings, bool ceil_mode, bool exclusive, - const std::string& data_format, + const std::string& data_format UNUSED, const std::string& pooling_type, bool global_pooling, bool adaptive, diff --git a/paddle/phi/kernels/onednn/reduce_kernel_impl.h b/paddle/phi/kernels/onednn/reduce_kernel_impl.h index 69f667c3662..7c512c6e3eb 100644 --- a/paddle/phi/kernels/onednn/reduce_kernel_impl.h +++ b/paddle/phi/kernels/onednn/reduce_kernel_impl.h @@ -118,7 +118,7 @@ void ReduceGradKernel(const Context& dev_ctx, bool reduce_all, DenseTensor* x_grad, dnnl::algorithm binary_type, - dnnl::algorithm reduction_type, + dnnl::algorithm reduction_type UNUSED, float scale_x, float scale_y) { reduce_all = recompute_reduce_all(x, dims, reduce_all); diff --git a/paddle/phi/kernels/onednn/slice_kernel.cc b/paddle/phi/kernels/onednn/slice_kernel.cc index 6c927018264..dfda78de77c 100644 --- a/paddle/phi/kernels/onednn/slice_kernel.cc +++ b/paddle/phi/kernels/onednn/slice_kernel.cc @@ -25,7 +25,7 @@ void SliceKernel(const Context& dev_ctx, const std::vector& axes, const IntArray& starts, const IntArray& ends, - const std::vector& infer_flags, + const std::vector& infer_flags UNUSED, const std::vector& decrease_axis, DenseTensor* out) { const auto& onednn_engine = dev_ctx.GetEngine(); diff --git a/paddle/phi/kernels/selected_rows/impl/lamb_kernel_impl.h b/paddle/phi/kernels/selected_rows/impl/lamb_kernel_impl.h index 4323a23e0e6..f9c620c9256 100644 --- a/paddle/phi/kernels/selected_rows/impl/lamb_kernel_impl.h +++ b/paddle/phi/kernels/selected_rows/impl/lamb_kernel_impl.h @@ -131,7 +131,7 @@ void ComputeRowImpl(const Context& dev_ctx, float beta1_f, float beta2_f, float epsilon_f, - bool multi_precision, + bool multi_precision UNUSED, DenseTensor* param_out, DenseTensor* mom1_out, DenseTensor* mom2_out, diff --git a/paddle/phi/kernels/sparse/cpu/conv_grad_kernel.cc b/paddle/phi/kernels/sparse/cpu/conv_grad_kernel.cc index fe8b8ad6f81..09c307a5c00 100644 --- a/paddle/phi/kernels/sparse/cpu/conv_grad_kernel.cc +++ b/paddle/phi/kernels/sparse/cpu/conv_grad_kernel.cc @@ -38,10 +38,10 @@ void Conv3dCooGradCPUKernel(const CPUContext& dev_ctx, const DenseTensor& rulebook, const DenseTensor& counter, const SparseCooTensor& out_grad, - const std::vector& paddings, - const std::vector& dilations, - const std::vector& strides, - const int groups, + const std::vector& paddings UNUSED, + const std::vector& dilations UNUSED, + const std::vector& strides UNUSED, + const int groups UNUSED, const bool subm, const std::string& key, SparseCooTensor* x_grad, diff --git a/paddle/phi/kernels/sparse/cpu/conv_kernel.cc b/paddle/phi/kernels/sparse/cpu/conv_kernel.cc index 48f04ad1ddf..7fcbb5cfdd1 100644 --- a/paddle/phi/kernels/sparse/cpu/conv_kernel.cc +++ b/paddle/phi/kernels/sparse/cpu/conv_kernel.cc @@ -34,7 +34,7 @@ void Conv3dCooCPUKernel(const CPUContext& dev_ctx, const std::vector& paddings, const std::vector& dilations, const std::vector& strides, - const int groups, + const int groups UNUSED, const bool subm, const std::string& key, SparseCooTensor* out, -- GitLab