From d30d85dafb364a25807422bcd587e45917e09254 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Sun, 6 Mar 2022 13:31:36 +0800 Subject: [PATCH] [Phi] Replace all prefix PT by PD and fix typo (#40046) * replace prefix pt by pd * replace added kernel * revert util change * pd kernel to phi * resolve conflict * resolve conflict --- paddle/fluid/framework/infershape_utils.h | 2 +- .../fluid/framework/infershape_utils_test.cc | 4 +- paddle/fluid/operators/abs_op.cc | 4 +- paddle/fluid/operators/addmm_op.cc | 4 +- paddle/fluid/operators/atan2_op.cc | 4 +- paddle/fluid/operators/bce_loss_op.cc | 4 +- .../operators/bilinear_tensor_product_op.cc | 8 +- .../fluid/operators/broadcast_tensors_op.cc | 4 +- paddle/fluid/operators/cholesky_op.cc | 4 +- paddle/fluid/operators/concat_op.cc | 4 +- paddle/fluid/operators/conj_op.cc | 4 +- .../operators/controlflow/compare_all_op.cc | 4 +- .../fluid/operators/controlflow/compare_op.cc | 4 +- paddle/fluid/operators/cross_op.cc | 4 +- paddle/fluid/operators/diag_v2_op.cc | 4 +- paddle/fluid/operators/diagonal_op.cc | 4 +- paddle/fluid/operators/dist_op.cc | 4 +- paddle/fluid/operators/dot_op.cc | 4 +- paddle/fluid/operators/empty_op.cc | 4 +- paddle/fluid/operators/erfinv_op.cc | 4 +- paddle/fluid/operators/eye_op.cc | 4 +- paddle/fluid/operators/gather_nd_op.cc | 8 +- paddle/fluid/operators/gather_tree_op.cc | 4 +- paddle/fluid/operators/gumbel_softmax_op.cc | 8 +- paddle/fluid/operators/huber_loss_op.cc | 4 +- paddle/fluid/operators/imag_op.cc | 4 +- paddle/fluid/operators/increment_op.cc | 4 +- paddle/fluid/operators/index_sample_op.cc | 4 +- paddle/fluid/operators/lerp_op.cc | 4 +- paddle/fluid/operators/matmul_v2_op.cc | 4 +- paddle/fluid/operators/multinomial_op.cc | 4 +- paddle/fluid/operators/mv_op.cc | 4 +- paddle/fluid/operators/pixel_shuffle_op.cc | 4 +- paddle/fluid/operators/poisson_op.cc | 4 +- paddle/fluid/operators/real_op.cc | 4 +- .../operators/reduce_ops/reduce_mean_op.cc | 4 +- .../operators/reduce_ops/reduce_sum_op.cc | 4 +- paddle/fluid/operators/scale_op.cc | 4 +- paddle/fluid/operators/scatter_nd_add_op.cc | 8 +- paddle/fluid/operators/scatter_op.cc | 8 +- paddle/fluid/operators/selu_op.cc | 4 +- paddle/fluid/operators/sign_op.cc | 4 +- paddle/fluid/operators/size_op.cc | 4 +- paddle/fluid/operators/trace_op.cc | 4 +- paddle/fluid/operators/triangular_solve_op.cc | 4 +- paddle/fluid/operators/trunc_op.cc | 4 +- paddle/fluid/operators/unfold_op.cc | 4 +- paddle/fluid/operators/where_op.cc | 4 +- paddle/phi/common/data_type.h | 14 +- paddle/phi/core/compat/op_utils.h | 8 +- paddle/phi/core/infermeta_utils.h | 40 +-- paddle/phi/core/kernel_registry.h | 310 +++++++++--------- paddle/phi/core/kernel_utils.h | 99 +++--- paddle/phi/core/macros.h | 18 +- 54 files changed, 350 insertions(+), 349 deletions(-) diff --git a/paddle/fluid/framework/infershape_utils.h b/paddle/fluid/framework/infershape_utils.h index 64c8371d583..b692b6ffab0 100644 --- a/paddle/fluid/framework/infershape_utils.h +++ b/paddle/fluid/framework/infershape_utils.h @@ -29,7 +29,7 @@ namespace framework { phi::InferMetaContext BuildInferMetaContext(InferShapeContext* ctx, const std::string& op_type); -#define DELCARE_INFER_SHAPE_FUNCTOR(op_type, functor_name, fn) \ +#define DECLARE_INFER_SHAPE_FUNCTOR(op_type, functor_name, fn) \ struct functor_name : public paddle::framework::InferShapeBase { \ void operator()( \ paddle::framework::InferShapeContext* ctx) const override { \ diff --git a/paddle/fluid/framework/infershape_utils_test.cc b/paddle/fluid/framework/infershape_utils_test.cc index 53dcc19fcba..2eeefb19a1a 100644 --- a/paddle/fluid/framework/infershape_utils_test.cc +++ b/paddle/fluid/framework/infershape_utils_test.cc @@ -110,9 +110,9 @@ void InferShapeUtilsTestKernel( } // namespace framework } // namespace paddle -DELCARE_INFER_SHAPE_FUNCTOR(infer_shape_utils_test, +DECLARE_INFER_SHAPE_FUNCTOR(infer_shape_utils_test, InferShapeUtilsTestInferShapeFunctor, - PT_INFER_META(paddle::framework::TestInferMeta)); + PD_INFER_META(paddle::framework::TestInferMeta)); REGISTER_OPERATOR(infer_shape_utils_test, paddle::framework::InferShapeUtilsTestOp, paddle::framework::InferShapeUtilsTestOpMaker, diff --git a/paddle/fluid/operators/abs_op.cc b/paddle/fluid/operators/abs_op.cc index c28026a4bd4..e1460629fb1 100644 --- a/paddle/fluid/operators/abs_op.cc +++ b/paddle/fluid/operators/abs_op.cc @@ -141,8 +141,8 @@ class AbsDoubleGradOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle -DELCARE_INFER_SHAPE_FUNCTOR(abs, AbsInferShapeFunctor, - PT_INFER_META(phi::UnchangedInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(abs, AbsInferShapeFunctor, + PD_INFER_META(phi::UnchangedInferMeta)); namespace ops = paddle::operators; diff --git a/paddle/fluid/operators/addmm_op.cc b/paddle/fluid/operators/addmm_op.cc index de4d7818020..716a2e40179 100644 --- a/paddle/fluid/operators/addmm_op.cc +++ b/paddle/fluid/operators/addmm_op.cc @@ -147,8 +147,8 @@ class AddMMOpGradMaker : public framework::SingleGradOpMaker { } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(addmm, AddmmInferShapeFunctor, - PT_INFER_META(phi::AddmmInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(addmm, AddmmInferShapeFunctor, + PD_INFER_META(phi::AddmmInferMeta)); REGISTER_OPERATOR(addmm, ops::AddMMOp, ops::AddMMOpMaker, ops::AddMMOpGradMaker, ops::AddMMOpGradMaker, diff --git a/paddle/fluid/operators/atan2_op.cc b/paddle/fluid/operators/atan2_op.cc index 71a895c244c..0783b30a858 100644 --- a/paddle/fluid/operators/atan2_op.cc +++ b/paddle/fluid/operators/atan2_op.cc @@ -105,8 +105,8 @@ class Atan2OpVarTypeInference : public framework::VarTypeInference { } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(atan2, Atan2InferShapeFunctor, - PT_INFER_META(phi::Atan2InferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(atan2, Atan2InferShapeFunctor, + PD_INFER_META(phi::Atan2InferMeta)); REGISTER_OPERATOR(atan2, ops::Atan2Op, ops::Atan2OpMaker, ops::Atan2GradMaker, ops::Atan2GradMaker, diff --git a/paddle/fluid/operators/bce_loss_op.cc b/paddle/fluid/operators/bce_loss_op.cc index 55bb57466c7..bc9076f4d7c 100644 --- a/paddle/fluid/operators/bce_loss_op.cc +++ b/paddle/fluid/operators/bce_loss_op.cc @@ -138,8 +138,8 @@ DECLARE_INPLACE_OP_INFERER(BCELossGradInplaceInferer, } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(bce_loss, BCELossInferShapeFunctor, - PT_INFER_META(phi::BCELossInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(bce_loss, BCELossInferShapeFunctor, + PD_INFER_META(phi::BCELossInferMeta)); REGISTER_OPERATOR(bce_loss, ops::BCELossOp, ops::BCELossOpMaker, ops::BCELossGradOpMaker, diff --git a/paddle/fluid/operators/bilinear_tensor_product_op.cc b/paddle/fluid/operators/bilinear_tensor_product_op.cc index 4774c0a1dbc..9f6a78ab7a5 100644 --- a/paddle/fluid/operators/bilinear_tensor_product_op.cc +++ b/paddle/fluid/operators/bilinear_tensor_product_op.cc @@ -90,12 +90,12 @@ class BilinearTensorProductGradOpMaker namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(bilinear_tensor_product, +DECLARE_INFER_SHAPE_FUNCTOR(bilinear_tensor_product, BilinearTensorProductInferShapeFunctor, - PT_INFER_META(phi::BilinearTensorProductInferMeta)); -DELCARE_INFER_SHAPE_FUNCTOR( + PD_INFER_META(phi::BilinearTensorProductInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR( bilinear_tensor_product_grad, BilinearTensorProductGradInferShapeFunctor, - PT_INFER_META(phi::BilinearTensorProductGradInferMeta)); + PD_INFER_META(phi::BilinearTensorProductGradInferMeta)); REGISTER_OPERATOR( bilinear_tensor_product, ops::BilinearTensorProductOp, diff --git a/paddle/fluid/operators/broadcast_tensors_op.cc b/paddle/fluid/operators/broadcast_tensors_op.cc index c3917fad555..1063a8b7992 100644 --- a/paddle/fluid/operators/broadcast_tensors_op.cc +++ b/paddle/fluid/operators/broadcast_tensors_op.cc @@ -167,9 +167,9 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(BroadcastTensorsGradNoNeedBufVarsInferer, namespace ops = paddle::operators; namespace plat = paddle::platform; -DELCARE_INFER_SHAPE_FUNCTOR(broadcast_tensors, +DECLARE_INFER_SHAPE_FUNCTOR(broadcast_tensors, BroadcastTensorsInferShapeFunctor, - PT_INFER_META(phi::BroadcastTensorsInferMeta)); + PD_INFER_META(phi::BroadcastTensorsInferMeta)); REGISTER_OPERATOR(broadcast_tensors, ops::BroadcastTensorsOp, ops::BroadcastTensorsOpMaker, diff --git a/paddle/fluid/operators/cholesky_op.cc b/paddle/fluid/operators/cholesky_op.cc index 09e915a6baf..ed80ac076c0 100644 --- a/paddle/fluid/operators/cholesky_op.cc +++ b/paddle/fluid/operators/cholesky_op.cc @@ -90,8 +90,8 @@ class CholeskyGradOpMaker : public framework::SingleGradOpMaker { } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(cholesky, CholeskyInferShapeFunctor, - PT_INFER_META(phi::CholeskyInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(cholesky, CholeskyInferShapeFunctor, + PD_INFER_META(phi::CholeskyInferMeta)); REGISTER_OPERATOR(cholesky, ops::CholeskyOp, ops::CholeskyOpMaker, ops::CholeskyGradOpMaker, ops::CholeskyGradOpMaker, diff --git a/paddle/fluid/operators/concat_op.cc b/paddle/fluid/operators/concat_op.cc index 1da7798ea26..059fafa3e7f 100644 --- a/paddle/fluid/operators/concat_op.cc +++ b/paddle/fluid/operators/concat_op.cc @@ -205,8 +205,8 @@ class ConcatDoubleGradOpMaker : public framework::SingleGradOpMaker { namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(concat, ConcatInferShapeFunctor, - PT_INFER_META(phi::ConcatInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(concat, ConcatInferShapeFunctor, + PD_INFER_META(phi::ConcatInferMeta)); REGISTER_OPERATOR(concat, ops::ConcatOp, ops::ConcatOpMaker, ops::ConcatGradOpMaker, diff --git a/paddle/fluid/operators/conj_op.cc b/paddle/fluid/operators/conj_op.cc index 95135ba3b1a..cbec1182f20 100644 --- a/paddle/fluid/operators/conj_op.cc +++ b/paddle/fluid/operators/conj_op.cc @@ -66,8 +66,8 @@ class ConjGradMaker : public framework::SingleGradOpMaker { namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(conj, ConjInferShapeFunctor, - PT_INFER_META(phi::UnchangedInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(conj, ConjInferShapeFunctor, + PD_INFER_META(phi::UnchangedInferMeta)); REGISTER_OPERATOR(conj, ops::ConjOp, ops::ConjOpMaker, ops::ConjGradMaker, ops::ConjGradMaker, diff --git a/paddle/fluid/operators/controlflow/compare_all_op.cc b/paddle/fluid/operators/controlflow/compare_all_op.cc index 9f229e6f15c..dd407f4f6f3 100644 --- a/paddle/fluid/operators/controlflow/compare_all_op.cc +++ b/paddle/fluid/operators/controlflow/compare_all_op.cc @@ -58,8 +58,8 @@ class CompareReduceOp : public framework::OperatorWithKernel { }; \ char _##op_type##Comment::type[]{#op_type}; \ char _##op_type##Comment::equation[]{_equation}; \ - DELCARE_INFER_SHAPE_FUNCTOR(op_type, op_type##_InferShapeFunctor, \ - PT_INFER_META(phi::CompareAllInferMeta)); \ + DECLARE_INFER_SHAPE_FUNCTOR(op_type, op_type##_InferShapeFunctor, \ + PD_INFER_META(phi::CompareAllInferMeta)); \ REGISTER_OPERATOR( \ op_type, ::paddle::operators::CompareReduceOp<_##op_type##Comment>, \ ::paddle::operators::CompareReduceOpProtoMaker<_##op_type##Comment>, \ diff --git a/paddle/fluid/operators/controlflow/compare_op.cc b/paddle/fluid/operators/controlflow/compare_op.cc index 5d9cdc61769..72d81d8c3fd 100644 --- a/paddle/fluid/operators/controlflow/compare_op.cc +++ b/paddle/fluid/operators/controlflow/compare_op.cc @@ -96,8 +96,8 @@ class CompareOp : public framework::OperatorWithKernel { }; \ char _##op_type##Comment::type[]{#op_type}; \ char _##op_type##Comment::equation[]{_equation}; \ - DELCARE_INFER_SHAPE_FUNCTOR(op_type, op_type##_InferShapeFunctor, \ - PT_INFER_META(phi::CompareInferMeta)); \ + DECLARE_INFER_SHAPE_FUNCTOR(op_type, op_type##_InferShapeFunctor, \ + PD_INFER_META(phi::CompareInferMeta)); \ REGISTER_OPERATOR( \ op_type, ::paddle::operators::CompareOp<_##op_type##Comment>, \ ::paddle::operators::CompareOpProtoMaker<_##op_type##Comment>, \ diff --git a/paddle/fluid/operators/cross_op.cc b/paddle/fluid/operators/cross_op.cc index fe00ee06603..674b75625d1 100644 --- a/paddle/fluid/operators/cross_op.cc +++ b/paddle/fluid/operators/cross_op.cc @@ -109,8 +109,8 @@ class CrossGradMaker : public framework::SingleGradOpMaker { } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(cross, CrossInferShapeFunctor, - PT_INFER_META(phi::CrossInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(cross, CrossInferShapeFunctor, + PD_INFER_META(phi::CrossInferMeta)); REGISTER_OPERATOR(cross, ops::CrossOp, ops::CrossOpMaker, ops::CrossGradMaker, ops::CrossGradMaker, diff --git a/paddle/fluid/operators/diag_v2_op.cc b/paddle/fluid/operators/diag_v2_op.cc index 0160277dc79..93fbff67e22 100644 --- a/paddle/fluid/operators/diag_v2_op.cc +++ b/paddle/fluid/operators/diag_v2_op.cc @@ -62,8 +62,8 @@ class DiagV2OpMaker : public framework::OpProtoAndCheckerMaker { } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(diag_v2, DiagInferShapeFunctor, - PT_INFER_META(phi::DiagInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(diag_v2, DiagInferShapeFunctor, + PD_INFER_META(phi::DiagInferMeta)); REGISTER_OPERATOR( diag_v2, ops::DiagV2Op, ops::DiagV2OpMaker, diff --git a/paddle/fluid/operators/diagonal_op.cc b/paddle/fluid/operators/diagonal_op.cc index 20813f8bb44..bf3cc941539 100644 --- a/paddle/fluid/operators/diagonal_op.cc +++ b/paddle/fluid/operators/diagonal_op.cc @@ -105,8 +105,8 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(DiagonalGradNoNeedBufferVarsInferer, namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(diagonal, DiagonalInferShapeFunctor, - PT_INFER_META(phi::DiagonalInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(diagonal, DiagonalInferShapeFunctor, + PD_INFER_META(phi::DiagonalInferMeta)); REGISTER_OPERATOR(diagonal, ops::DiagonalOp, ops::DiagonalOpMaker, ops::DiagonalGradOpMaker, diff --git a/paddle/fluid/operators/dist_op.cc b/paddle/fluid/operators/dist_op.cc index 10750574c45..55b24849412 100644 --- a/paddle/fluid/operators/dist_op.cc +++ b/paddle/fluid/operators/dist_op.cc @@ -124,8 +124,8 @@ class DistGradOpMaker : public framework::SingleGradOpMaker { } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(dist, DistInferShapeFunctor, - PT_INFER_META(phi::DistInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(dist, DistInferShapeFunctor, + PD_INFER_META(phi::DistInferMeta)); REGISTER_OPERATOR(dist, ops::DistOp, ops::DistOpMaker, ops::DistGradOpMaker, diff --git a/paddle/fluid/operators/dot_op.cc b/paddle/fluid/operators/dot_op.cc index a86a3bb3592..8efdd15781a 100644 --- a/paddle/fluid/operators/dot_op.cc +++ b/paddle/fluid/operators/dot_op.cc @@ -101,8 +101,8 @@ class DotOpGradMaker : public framework::SingleGradOpMaker { namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(dot, DotInferShapeFunctor, - PT_INFER_META(phi::DotInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(dot, DotInferShapeFunctor, + PD_INFER_META(phi::DotInferMeta)); REGISTER_OPERATOR(dot, ops::DotOp, ops::DotOpMaker, ops::DotOpGradMaker, diff --git a/paddle/fluid/operators/empty_op.cc b/paddle/fluid/operators/empty_op.cc index 96fa3282d06..9e0e4e7fe1c 100644 --- a/paddle/fluid/operators/empty_op.cc +++ b/paddle/fluid/operators/empty_op.cc @@ -88,8 +88,8 @@ class EmptyOpVarTypeInference : public framework::VarTypeInference { namespace ops = paddle::operators; namespace plat = paddle::platform; -DELCARE_INFER_SHAPE_FUNCTOR(empty, EmptyInferShapeFunctor, - PT_INFER_META(phi::CreateInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(empty, EmptyInferShapeFunctor, + PD_INFER_META(phi::CreateInferMeta)); REGISTER_OP_WITHOUT_GRADIENT(empty, ops::EmptyOp, ops::EmptyOpMaker, ops::EmptyOpVarTypeInference, EmptyInferShapeFunctor); diff --git a/paddle/fluid/operators/erfinv_op.cc b/paddle/fluid/operators/erfinv_op.cc index 3d409b4c4f6..374b0079262 100644 --- a/paddle/fluid/operators/erfinv_op.cc +++ b/paddle/fluid/operators/erfinv_op.cc @@ -73,8 +73,8 @@ DECLARE_INPLACE_OP_INFERER(ErfinvInplaceInferer, {"X", "Out"}); } // namespace operators } // namespace paddle -DELCARE_INFER_SHAPE_FUNCTOR(erfinv, ErfinvInferShapeFunctor, - PT_INFER_META(phi::UnchangedInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(erfinv, ErfinvInferShapeFunctor, + PD_INFER_META(phi::UnchangedInferMeta)); REGISTER_OPERATOR( erfinv, paddle::operators::ErfinvOp, paddle::operators::ErfinvOpMaker, diff --git a/paddle/fluid/operators/eye_op.cc b/paddle/fluid/operators/eye_op.cc index f8c6b4eb8c5..537c218d357 100644 --- a/paddle/fluid/operators/eye_op.cc +++ b/paddle/fluid/operators/eye_op.cc @@ -67,8 +67,8 @@ Return an identity tensor whose shape is [num_rows, num_columns]. } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(eye, EyeInferShapeFunctor, - PT_INFER_META(phi::EyeInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(eye, EyeInferShapeFunctor, + PD_INFER_META(phi::EyeInferMeta)); REGISTER_OPERATOR( eye, ops::EyeOp, ops::EyeOpMaker, ops::EyeOpVarTypeInference, diff --git a/paddle/fluid/operators/gather_nd_op.cc b/paddle/fluid/operators/gather_nd_op.cc index fcd3384ac24..e5ca15a39ef 100644 --- a/paddle/fluid/operators/gather_nd_op.cc +++ b/paddle/fluid/operators/gather_nd_op.cc @@ -130,11 +130,11 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(GatherNdGradNoNeedBufferVarInferer, "X"); namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(gather_nd, GatherNdInferShapeFunctor, - PT_INFER_META(phi::GatherNdInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(gather_nd, GatherNdInferShapeFunctor, + PD_INFER_META(phi::GatherNdInferMeta)); -DELCARE_INFER_SHAPE_FUNCTOR(gather_nd_grad, GatherNdGradInferShapeFunctor, - PT_INFER_META(phi::GatherNdGradInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(gather_nd_grad, GatherNdGradInferShapeFunctor, + PD_INFER_META(phi::GatherNdGradInferMeta)); REGISTER_OPERATOR(gather_nd, ops::GatherNdOp, ops::GatherNdOpMaker, ops::GatherNdGradOpMaker, diff --git a/paddle/fluid/operators/gather_tree_op.cc b/paddle/fluid/operators/gather_tree_op.cc index 7f6c82032fe..c84e94f5c71 100644 --- a/paddle/fluid/operators/gather_tree_op.cc +++ b/paddle/fluid/operators/gather_tree_op.cc @@ -61,8 +61,8 @@ selected ids. } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(gather_tree, GatherTreeInferShapeFunctor, - PT_INFER_META(phi::GatherTreeMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(gather_tree, GatherTreeInferShapeFunctor, + PD_INFER_META(phi::GatherTreeMeta)); REGISTER_OPERATOR(gather_tree, ops::GatherTreeOp, ops::GatherTreeOpMaker, GatherTreeInferShapeFunctor); diff --git a/paddle/fluid/operators/gumbel_softmax_op.cc b/paddle/fluid/operators/gumbel_softmax_op.cc index f8f8f3fd789..524f2d6c9d7 100644 --- a/paddle/fluid/operators/gumbel_softmax_op.cc +++ b/paddle/fluid/operators/gumbel_softmax_op.cc @@ -90,11 +90,11 @@ class GumbelSoftmaxGradOpMaker : public framework::SingleGradOpMaker { namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(gumbel_softmax, GumbelSoftmaxInferShapeFunctor, - PT_INFER_META(phi::GumbelSoftmaxInferMeta)); -DELCARE_INFER_SHAPE_FUNCTOR(gumbel_softmax_grad, +DECLARE_INFER_SHAPE_FUNCTOR(gumbel_softmax, GumbelSoftmaxInferShapeFunctor, + PD_INFER_META(phi::GumbelSoftmaxInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(gumbel_softmax_grad, GumbelSoftmaxGradInferShapeFunctor, - PT_INFER_META(phi::GumbelSoftmaxGradInferMeta)); + PD_INFER_META(phi::GumbelSoftmaxGradInferMeta)); REGISTER_OPERATOR(gumbel_softmax, ops::GumbelSoftmaxOp, ops::GumbelSoftmaxOpMaker, diff --git a/paddle/fluid/operators/huber_loss_op.cc b/paddle/fluid/operators/huber_loss_op.cc index 3915ce5809c..3c9bbc753f2 100644 --- a/paddle/fluid/operators/huber_loss_op.cc +++ b/paddle/fluid/operators/huber_loss_op.cc @@ -112,8 +112,8 @@ class HuberLossGradOpMaker : public framework::SingleGradOpMaker { } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(huber_loss, HuberLossInferShapeFunctor, - PT_INFER_META(phi::HuberLossInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(huber_loss, HuberLossInferShapeFunctor, + PD_INFER_META(phi::HuberLossInferMeta)); REGISTER_OPERATOR(huber_loss, ops::HuberLossOp, ops::HuberLossOpMaker, ops::HuberLossGradOpMaker, diff --git a/paddle/fluid/operators/imag_op.cc b/paddle/fluid/operators/imag_op.cc index 567a69f383d..16968876ac9 100644 --- a/paddle/fluid/operators/imag_op.cc +++ b/paddle/fluid/operators/imag_op.cc @@ -82,8 +82,8 @@ DECLARE_INPLACE_OP_INFERER(ImagGradOpInplaceInferer, } // namespace operators } // namespace paddle -DELCARE_INFER_SHAPE_FUNCTOR(imag, ImagInferShapeFunctor, - PT_INFER_META(phi::RealAndImagInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(imag, ImagInferShapeFunctor, + PD_INFER_META(phi::RealAndImagInferMeta)); namespace ops = paddle::operators; diff --git a/paddle/fluid/operators/increment_op.cc b/paddle/fluid/operators/increment_op.cc index 105d818e197..e2efaa1759b 100644 --- a/paddle/fluid/operators/increment_op.cc +++ b/paddle/fluid/operators/increment_op.cc @@ -87,8 +87,8 @@ class IncrementGradOpMaker : public framework::SingleGradOpMaker { } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(increment, IncrementInferShapeFunctor, - PT_INFER_META(phi::IncrementInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(increment, IncrementInferShapeFunctor, + PD_INFER_META(phi::IncrementInferMeta)); REGISTER_OPERATOR(increment, ops::IncrementOp, ops::IncrementOpMaker, ops::IncrementGradOpMaker, ops::IncrementGradOpMaker, diff --git a/paddle/fluid/operators/index_sample_op.cc b/paddle/fluid/operators/index_sample_op.cc index 68d002fceea..d17c6368c75 100644 --- a/paddle/fluid/operators/index_sample_op.cc +++ b/paddle/fluid/operators/index_sample_op.cc @@ -100,8 +100,8 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(IndexSampleGradNoNeedBufferVarInferer, "X"); } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(index_sample, IndexSampleInferShapeFunctor, - PT_INFER_META(phi::IndexSampleInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(index_sample, IndexSampleInferShapeFunctor, + PD_INFER_META(phi::IndexSampleInferMeta)); REGISTER_OPERATOR(index_sample, ops::IndexSampleOp, ops::IndexSampleOpMaker, ops::IndexSampleGradMaker, ops::IndexSampleGradMaker, diff --git a/paddle/fluid/operators/lerp_op.cc b/paddle/fluid/operators/lerp_op.cc index fef6fc5319e..5e053445379 100644 --- a/paddle/fluid/operators/lerp_op.cc +++ b/paddle/fluid/operators/lerp_op.cc @@ -85,8 +85,8 @@ DECLARE_INPLACE_OP_INFERER(LerpInplaceInferer, {"X", "Out"}); } // namespace operators } // namespace paddle -DELCARE_INFER_SHAPE_FUNCTOR(lerp, LerpInferShapeFunctor, - PT_INFER_META(phi::LerpInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(lerp, LerpInferShapeFunctor, + PD_INFER_META(phi::LerpInferMeta)); REGISTER_OPERATOR( lerp, paddle::operators::LerpOp, paddle::operators::LerpOpMaker, paddle::operators::LerpOpGradMaker, diff --git a/paddle/fluid/operators/matmul_v2_op.cc b/paddle/fluid/operators/matmul_v2_op.cc index 788dbb22041..01fa01e3c6e 100644 --- a/paddle/fluid/operators/matmul_v2_op.cc +++ b/paddle/fluid/operators/matmul_v2_op.cc @@ -524,8 +524,8 @@ REGISTER_OPERATOR(matmul_v2, ops::MatMulV2Op, ops::MatMulV2OpMaker, ops::MatMulV2GradOpMaker, ops::MatMulV2GradOpMaker); -DELCARE_INFER_SHAPE_FUNCTOR(matmul_v2_grad, MatMulV2GradInferShapeFunctor, - PT_INFER_META(phi::GeneralBinaryGradInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(matmul_v2_grad, MatMulV2GradInferShapeFunctor, + PD_INFER_META(phi::GeneralBinaryGradInferMeta)); REGISTER_OPERATOR(matmul_v2_grad, ops::MatMulV2OpGrad, ops::MatMulV2OpDoubleGradMaker, ops::MatMulV2OpDoubleGradMaker, diff --git a/paddle/fluid/operators/multinomial_op.cc b/paddle/fluid/operators/multinomial_op.cc index 1143f9cb37a..0113f638b9a 100644 --- a/paddle/fluid/operators/multinomial_op.cc +++ b/paddle/fluid/operators/multinomial_op.cc @@ -53,8 +53,8 @@ class MultinomialOp : public framework::OperatorWithKernel { namespace ops = paddle::operators; namespace plat = paddle::platform; -DELCARE_INFER_SHAPE_FUNCTOR(multinomial, MultinomialInferShapeFunctor, - PT_INFER_META(phi::MultinomialInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(multinomial, MultinomialInferShapeFunctor, + PD_INFER_META(phi::MultinomialInferMeta)); REGISTER_OPERATOR( multinomial, ops::MultinomialOp, ops::MultinomialOpMaker, paddle::framework::EmptyGradOpMaker, diff --git a/paddle/fluid/operators/mv_op.cc b/paddle/fluid/operators/mv_op.cc index d34a1ebf82c..bf7222fc45c 100644 --- a/paddle/fluid/operators/mv_op.cc +++ b/paddle/fluid/operators/mv_op.cc @@ -94,8 +94,8 @@ class MVOpGrad : public framework::OperatorWithKernel { namespace ops = paddle::operators; namespace plat = paddle::platform; -DELCARE_INFER_SHAPE_FUNCTOR(mv, MvInferShapeFunctor, - PT_INFER_META(phi::MvInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(mv, MvInferShapeFunctor, + PD_INFER_META(phi::MvInferMeta)); REGISTER_OPERATOR(mv, ops::MVOp, ops::MVOpMaker, ops::MVOpGradMaker, diff --git a/paddle/fluid/operators/pixel_shuffle_op.cc b/paddle/fluid/operators/pixel_shuffle_op.cc index 2a127d9ad1d..21ca26f49f6 100644 --- a/paddle/fluid/operators/pixel_shuffle_op.cc +++ b/paddle/fluid/operators/pixel_shuffle_op.cc @@ -124,8 +124,8 @@ class PixelShuffleGradOp : public framework::OperatorWithKernel { } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(pixel_shuffle, PixelShuffleInferShapeFunctor, - PT_INFER_META(phi::PixelShuffleInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(pixel_shuffle, PixelShuffleInferShapeFunctor, + PD_INFER_META(phi::PixelShuffleInferMeta)); REGISTER_OPERATOR(pixel_shuffle, ops::PixelShuffleOp, ops::PixelShuffleOpMaker, ops::PixelShuffleGradMaker, diff --git a/paddle/fluid/operators/poisson_op.cc b/paddle/fluid/operators/poisson_op.cc index 0cecbf0b9cb..d5896c41059 100644 --- a/paddle/fluid/operators/poisson_op.cc +++ b/paddle/fluid/operators/poisson_op.cc @@ -87,8 +87,8 @@ class PoissonGradOpMaker : public framework::SingleGradOpMaker { namespace ops = paddle::operators; namespace plat = paddle::platform; -DELCARE_INFER_SHAPE_FUNCTOR(poisson, PoissonInferShapeFunctor, - PT_INFER_META(phi::UnchangedInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(poisson, PoissonInferShapeFunctor, + PD_INFER_META(phi::UnchangedInferMeta)); REGISTER_OPERATOR(poisson, ops::PoissonOp, ops::PoissonOpMaker, ops::PoissonOpInferVarType, diff --git a/paddle/fluid/operators/real_op.cc b/paddle/fluid/operators/real_op.cc index 28a8484f539..18e444702fb 100644 --- a/paddle/fluid/operators/real_op.cc +++ b/paddle/fluid/operators/real_op.cc @@ -82,8 +82,8 @@ DECLARE_INPLACE_OP_INFERER(RealGradOpInplaceInferer, } // namespace operators } // namespace paddle -DELCARE_INFER_SHAPE_FUNCTOR(real, RealInferShapeFunctor, - PT_INFER_META(phi::RealAndImagInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(real, RealInferShapeFunctor, + PD_INFER_META(phi::RealAndImagInferMeta)); namespace ops = paddle::operators; diff --git a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc index 6157a3a925d..894106883cb 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc @@ -96,8 +96,8 @@ class __reduce_meanMaker__ : public ops::ReduceOpMaker { virtual std::string GetOpType() const { return "Reduce reduce_mean"; } }; -DELCARE_INFER_SHAPE_FUNCTOR(reduce_mean, ReduceMeanInferShapeFunctor, - PT_INFER_META(phi::MeanRawInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(reduce_mean, ReduceMeanInferShapeFunctor, + PD_INFER_META(phi::MeanRawInferMeta)); REGISTER_OPERATOR(reduce_mean, ops::ReduceOp, __reduce_meanMaker__, ops::ReduceMeanOpGradMaker, diff --git a/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc b/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc index 8ef0712dc7a..6559ed479c8 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc @@ -102,8 +102,8 @@ class ReduceSumOpMaker : public ops::ReduceOpMaker { virtual std::string GetOpType() const { return "Reduce reduce_sum"; } }; -DELCARE_INFER_SHAPE_FUNCTOR(reduce_sum, ReduceSumInferShapeFunctor, - PT_INFER_META(phi::ReduceInferMetaBase)); +DECLARE_INFER_SHAPE_FUNCTOR(reduce_sum, ReduceSumInferShapeFunctor, + PD_INFER_META(phi::ReduceInferMetaBase)); REGISTER_OPERATOR(reduce_sum, ops::ReduceOp, ReduceSumOpMaker, ops::ReduceSumVarTypeInference, diff --git a/paddle/fluid/operators/scale_op.cc b/paddle/fluid/operators/scale_op.cc index e4410b21b54..cbf2b915207 100644 --- a/paddle/fluid/operators/scale_op.cc +++ b/paddle/fluid/operators/scale_op.cc @@ -121,8 +121,8 @@ DECLARE_INPLACE_OP_INFERER(ScaleOpInplaceInferer, {"X", "Out"}); namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(scale, ScaleInferShapeFunctor, - PT_INFER_META(phi::UnchangedInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(scale, ScaleInferShapeFunctor, + PD_INFER_META(phi::UnchangedInferMeta)); REGISTER_OPERATOR(scale, ops::ScaleOp, ops::ScaleOpMaker, ops::ScaleGradMaker, ops::ScaleGradMaker, diff --git a/paddle/fluid/operators/scatter_nd_add_op.cc b/paddle/fluid/operators/scatter_nd_add_op.cc index b7be4cfb2a3..0ae0e1500c1 100644 --- a/paddle/fluid/operators/scatter_nd_add_op.cc +++ b/paddle/fluid/operators/scatter_nd_add_op.cc @@ -119,12 +119,12 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(ScatterNdAddGradNoNeedBufferVarsInferer, namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(scatter_nd_add, ScatterNdAddInferShapeFunctor, - PT_INFER_META(phi::ScatterNdAddInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(scatter_nd_add, ScatterNdAddInferShapeFunctor, + PD_INFER_META(phi::ScatterNdAddInferMeta)); -DELCARE_INFER_SHAPE_FUNCTOR(scatter_nd_add_grad, +DECLARE_INFER_SHAPE_FUNCTOR(scatter_nd_add_grad, ScatterNdAddGradInferShapeFunctor, - PT_INFER_META(phi::ScatterNdAddGradInferMeta)); + PD_INFER_META(phi::ScatterNdAddGradInferMeta)); REGISTER_OPERATOR(scatter_nd_add, ops::ScatterNdAddOp, ops::ScatterNdAddOpMaker, ops::ScatterNdAddGradMaker, diff --git a/paddle/fluid/operators/scatter_op.cc b/paddle/fluid/operators/scatter_op.cc index fec003305fd..5f6b04cf59e 100644 --- a/paddle/fluid/operators/scatter_op.cc +++ b/paddle/fluid/operators/scatter_op.cc @@ -103,11 +103,11 @@ DECLARE_INPLACE_OP_INFERER(ScatterInplaceInferer, {"X", "Out"}); } // namespace operators } // namespace paddle -DELCARE_INFER_SHAPE_FUNCTOR(scatter, ScatterInferShapeFunctor, - PT_INFER_META(phi::ScatterInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(scatter, ScatterInferShapeFunctor, + PD_INFER_META(phi::ScatterInferMeta)); -DELCARE_INFER_SHAPE_FUNCTOR(scatter_grad, ScatterGradInferShapeFunctor, - PT_INFER_META(phi::ScatterGradInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(scatter_grad, ScatterGradInferShapeFunctor, + PD_INFER_META(phi::ScatterGradInferMeta)); namespace ops = paddle::operators; REGISTER_OPERATOR(scatter, ops::ScatterOp, ops::ScatterOpMaker, diff --git a/paddle/fluid/operators/selu_op.cc b/paddle/fluid/operators/selu_op.cc index 0372a79b967..59c6e165357 100644 --- a/paddle/fluid/operators/selu_op.cc +++ b/paddle/fluid/operators/selu_op.cc @@ -120,8 +120,8 @@ class SeluGradOp : public framework::OperatorWithKernel { namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(selu, SeluInferShapeFunctor, - PT_INFER_META(phi::UnchangedInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(selu, SeluInferShapeFunctor, + PD_INFER_META(phi::UnchangedInferMeta)); REGISTER_OPERATOR(selu, ops::SeluOp, ops::SeluOpMaker, ops::SeluOpInferVarType, ops::SeluGradMaker, diff --git a/paddle/fluid/operators/sign_op.cc b/paddle/fluid/operators/sign_op.cc index e2381c76f7e..ceb42dcf3e5 100644 --- a/paddle/fluid/operators/sign_op.cc +++ b/paddle/fluid/operators/sign_op.cc @@ -60,8 +60,8 @@ class SignGradMaker : public framework::SingleGradOpMaker { namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(sign, SignInferShapeFunctor, - PT_INFER_META(phi::UnchangedInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(sign, SignInferShapeFunctor, + PD_INFER_META(phi::UnchangedInferMeta)); REGISTER_OPERATOR(sign, ops::SignOp, ops::SignOpMaker, ops::SignGradMaker, ops::SignGradMaker, diff --git a/paddle/fluid/operators/size_op.cc b/paddle/fluid/operators/size_op.cc index e584c1a4cce..84b0f403be0 100644 --- a/paddle/fluid/operators/size_op.cc +++ b/paddle/fluid/operators/size_op.cc @@ -44,8 +44,8 @@ Return the number of elements in the input. } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(size, SizeInferShapeFunctor, - PT_INFER_META(phi::SizeInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(size, SizeInferShapeFunctor, + PD_INFER_META(phi::SizeInferMeta)); REGISTER_OPERATOR( size, ops::SizeOp, ops::SizeOpMaker, paddle::framework::EmptyGradOpMaker, diff --git a/paddle/fluid/operators/trace_op.cc b/paddle/fluid/operators/trace_op.cc index 63b914a31a8..0590b66f6f8 100644 --- a/paddle/fluid/operators/trace_op.cc +++ b/paddle/fluid/operators/trace_op.cc @@ -107,8 +107,8 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(TraceGradNoNeedBufferVarsInferer, "Input"); } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(trace, TraceInferShapeFunctor, - PT_INFER_META(phi::TraceInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(trace, TraceInferShapeFunctor, + PD_INFER_META(phi::TraceInferMeta)); REGISTER_OPERATOR(trace, ops::TraceOp, ops::TraceOpMaker, ops::TraceGradOpMaker, ops::TraceGradOpMaker, diff --git a/paddle/fluid/operators/triangular_solve_op.cc b/paddle/fluid/operators/triangular_solve_op.cc index 179f818104c..df84659a00f 100644 --- a/paddle/fluid/operators/triangular_solve_op.cc +++ b/paddle/fluid/operators/triangular_solve_op.cc @@ -120,8 +120,8 @@ class TriangularSolveOpGradMaker : public framework::SingleGradOpMaker { namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(triangular_solve, TriangularSolveInferShapeFunctor, - PT_INFER_META(phi::TriangularSolveInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(triangular_solve, TriangularSolveInferShapeFunctor, + PD_INFER_META(phi::TriangularSolveInferMeta)); REGISTER_OPERATOR(triangular_solve, ops::TriangularSolveOp, ops::TriangularSolveOpMaker, diff --git a/paddle/fluid/operators/trunc_op.cc b/paddle/fluid/operators/trunc_op.cc index 54f4deac80a..b77775f5a8c 100644 --- a/paddle/fluid/operators/trunc_op.cc +++ b/paddle/fluid/operators/trunc_op.cc @@ -69,8 +69,8 @@ class TruncGradOpMaker : public framework::SingleGradOpMaker { } // namespace operators } // namespace paddle -DELCARE_INFER_SHAPE_FUNCTOR(trunc, TruncInferShapeFunctor, - PT_INFER_META(phi::UnchangedInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(trunc, TruncInferShapeFunctor, + PD_INFER_META(phi::UnchangedInferMeta)); namespace ops = paddle::operators; REGISTER_OPERATOR(trunc, ops::TruncOp, ops::TruncOpMaker, diff --git a/paddle/fluid/operators/unfold_op.cc b/paddle/fluid/operators/unfold_op.cc index c45b839d5b4..02fed3de6ce 100644 --- a/paddle/fluid/operators/unfold_op.cc +++ b/paddle/fluid/operators/unfold_op.cc @@ -119,8 +119,8 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(UnfoldGradOpNoNeedBufferVarsInferer, "X"); } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(unfold, UnfoldInferShapeFunctor, - PT_INFER_META(phi::UnfoldInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(unfold, UnfoldInferShapeFunctor, + PD_INFER_META(phi::UnfoldInferMeta)); REGISTER_OPERATOR(unfold, ops::UnfoldOp, ops::UnfoldOpMaker, ops::UnfoldGradMaker, ops::UnfoldGradMaker, diff --git a/paddle/fluid/operators/where_op.cc b/paddle/fluid/operators/where_op.cc index 0f10efefa13..acbfee30670 100644 --- a/paddle/fluid/operators/where_op.cc +++ b/paddle/fluid/operators/where_op.cc @@ -117,8 +117,8 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(WhereGradNoNeedBufferVarsInferer, "X", "Y"); } // namespace paddle namespace ops = paddle::operators; -DELCARE_INFER_SHAPE_FUNCTOR(where, WhereInferShapeFunctor, - PT_INFER_META(phi::WhereInferMeta)); +DECLARE_INFER_SHAPE_FUNCTOR(where, WhereInferShapeFunctor, + PD_INFER_META(phi::WhereInferMeta)); REGISTER_OPERATOR(where, ops::WhereOp, ops::WhereOpMaker, ops::WhereOpGradMaker, ops::WhereOpGradMaker, diff --git a/paddle/phi/common/data_type.h b/paddle/phi/common/data_type.h index d9dc103e48e..38239f0fa9d 100644 --- a/paddle/phi/common/data_type.h +++ b/paddle/phi/common/data_type.h @@ -82,7 +82,7 @@ inline size_t SizeOf(DataType data_type) { return 0; } -#define PT_FOR_EACH_DATA_TYPE(_) \ +#define PD_FOR_EACH_DATA_TYPE(_) \ _(bool, DataType::BOOL) \ _(int8_t, DataType::INT8) \ _(uint8_t, DataType::UINT8) \ @@ -105,25 +105,25 @@ struct DataTypeToCppType; template struct CppTypeToDataType; -#define PT_SPECIALIZE_DataTypeToCppType(cpp_type, data_type) \ +#define PD_SPECIALIZE_DataTypeToCppType(cpp_type, data_type) \ template <> \ struct DataTypeToCppType { \ using type = cpp_type; \ }; -PT_FOR_EACH_DATA_TYPE(PT_SPECIALIZE_DataTypeToCppType) +PD_FOR_EACH_DATA_TYPE(PD_SPECIALIZE_DataTypeToCppType) -#undef PT_SPECIALIZE_DataTypeToCppType +#undef PD_SPECIALIZE_DataTypeToCppType -#define PT_SPECIALIZE_CppTypeToDataType(cpp_type, data_type) \ +#define PD_SPECIALIZE_CppTypeToDataType(cpp_type, data_type) \ template <> \ struct CppTypeToDataType { \ constexpr static DataType Type() { return data_type; } \ }; -PT_FOR_EACH_DATA_TYPE(PT_SPECIALIZE_CppTypeToDataType) +PD_FOR_EACH_DATA_TYPE(PD_SPECIALIZE_CppTypeToDataType) -#undef PT_SPECIALIZE_CppTypeToDataType +#undef PD_SPECIALIZE_CppTypeToDataType inline std::ostream& operator<<(std::ostream& os, DataType dtype) { switch (dtype) { diff --git a/paddle/phi/core/compat/op_utils.h b/paddle/phi/core/compat/op_utils.h index bbf634b4b09..8f64a7145ed 100644 --- a/paddle/phi/core/compat/op_utils.h +++ b/paddle/phi/core/compat/op_utils.h @@ -166,7 +166,7 @@ struct ArgumentMappingFnRegistrar { }; #define PD_REGISTER_BASE_KERNEL_NAME(op_type, base_kernel_name) \ - PT_STATIC_ASSERT_GLOBAL_NAMESPACE( \ + PD_STATIC_ASSERT_GLOBAL_NAMESPACE( \ PD_REGISTER_base_kernel_name_ns_check_##op_type, \ "PD_REGISTER_BASE_KERNEL_NAME must be called in global namespace."); \ static const ::phi::BaseKernelNameRegistrar \ @@ -174,7 +174,7 @@ struct ArgumentMappingFnRegistrar { int TouchBaseKernelNameSymbol_##op_type() { return 0; } #define PD_DECLARE_BASE_KERNEL_NAME(op_type) \ - PT_STATIC_ASSERT_GLOBAL_NAMESPACE( \ + PD_STATIC_ASSERT_GLOBAL_NAMESPACE( \ PD_DECLARE_ai_name_ns_check_##op_type, \ "PD_DECLARE_BASE_KERNEL_NAME must be called in global namespace."); \ extern int TouchBaseKernelNameSymbol_##op_type(); \ @@ -182,7 +182,7 @@ struct ArgumentMappingFnRegistrar { TouchBaseKernelNameSymbol_##op_type() #define PD_REGISTER_ARG_MAPPING_FN(op_type, arg_mapping_fn) \ - PT_STATIC_ASSERT_GLOBAL_NAMESPACE( \ + PD_STATIC_ASSERT_GLOBAL_NAMESPACE( \ PD_REGISTER_arg_map_fn_ns_check_##op_type, \ "PD_REGISTER_ARG_MAPPING_FN must be called in global namespace."); \ static const ::phi::ArgumentMappingFnRegistrar \ @@ -190,7 +190,7 @@ struct ArgumentMappingFnRegistrar { int TouchArgumentMappingFnSymbol_##op_type() { return 0; } #define PD_DECLARE_ARG_MAPPING_FN(op_type) \ - PT_STATIC_ASSERT_GLOBAL_NAMESPACE( \ + PD_STATIC_ASSERT_GLOBAL_NAMESPACE( \ PD_DECLARE_arg_map_fn_ns_check_##op_type, \ "PD_DECLARE_ARG_MAPPING_FN must be called in global namespace."); \ extern int TouchArgumentMappingFnSymbol_##op_type(); \ diff --git a/paddle/phi/core/infermeta_utils.h b/paddle/phi/core/infermeta_utils.h index a5775db7438..9c351ce9063 100644 --- a/paddle/phi/core/infermeta_utils.h +++ b/paddle/phi/core/infermeta_utils.h @@ -86,10 +86,10 @@ class InferMetaContext { paddle::SmallVector> output_range_; }; -#define PT_INFER_META(...) \ +#define PD_INFER_META(...) \ ::phi::InferMetaFnImpl::Call -#define PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(attr_type) \ +#define PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(attr_type) \ template \ struct InferMetaFnCallHelper { \ template \ @@ -175,24 +175,24 @@ struct InferMetaFnImpl { }; // TODO(chenweihang): support other attr type later - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(bool); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(int); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(int64_t); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(float); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const std::string&); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const std::vector&); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const std::vector&); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE( + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(bool); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(int); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(int64_t); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(float); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const std::string&); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const std::vector&); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const std::vector&); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE( const std::vector&); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const std::vector&); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const std::vector&); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE( + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const std::vector&); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const std::vector&); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE( const std::vector&); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(DataType); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(Backend); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(DataLayout); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const Scalar&); - PT_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const ScalarArray&); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(DataType); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(Backend); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(DataLayout); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const Scalar&); + PD_SPECIALIZE_InferMetaFnCallHelper_FOR_ATTRIBUTE(const ScalarArray&); // TODO(chenweihang): support vector input later @@ -304,11 +304,11 @@ struct InferMetaFnRegistrar { }; #define PD_REGISTER_INFER_META_FN(kernel_name_prefix, variadic_infer_meta_fn) \ - PT_STATIC_ASSERT_GLOBAL_NAMESPACE( \ + PD_STATIC_ASSERT_GLOBAL_NAMESPACE( \ PD_REGISTER_infer_meta_fn_ns_check_##kernel_name_prefix, \ "PD_REGISTER_INFER_META_FN must be called in global namespace."); \ static const ::phi::InferMetaFnRegistrar \ __registrar_arg_map_fn_for_##kernel_name_prefix( \ - #kernel_name_prefix, PT_INFER_META(variadic_infer_meta_fn)) + #kernel_name_prefix, PD_INFER_META(variadic_infer_meta_fn)) } // namespace phi diff --git a/paddle/phi/core/kernel_registry.h b/paddle/phi/core/kernel_registry.h index 35e170a3fce..6a0c7bbc9b7 100644 --- a/paddle/phi/core/kernel_registry.h +++ b/paddle/phi/core/kernel_registry.h @@ -228,13 +228,13 @@ struct KernelRegistrar { * http://connect.microsoft.com/VisualStudio/feedback/details/380090/variadic-macro-replacement * http://cplusplus.co.il/2010/07/17/variadic-macro-to-count-number-of-arguments/#comment-644 */ -#define PT_NARGS(...) _PT_NARGS((__VA_ARGS__, _PT_RESQ_N())) -#define _PT_NARGS(...) _PT_ARG_N(__VA_ARGS__) -#define _PT_ARG_N_EXPAND( \ +#define PD_NARGS(...) _PD_NARGS((__VA_ARGS__, _PD_RESQ_N())) +#define _PD_NARGS(...) _PD_ARG_N(__VA_ARGS__) +#define _PD_ARG_N_EXPAND( \ _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, N, ...) \ N -#define _PT_ARG_N(args) _PT_ARG_N_EXPAND args -#define _PT_RESQ_N() 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 +#define _PD_ARG_N(args) _PD_ARG_N_EXPAND args +#define _PD_RESQ_N() 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 /** PD_REGISTER_KERNEL * @@ -256,10 +256,10 @@ struct KernelRegistrar { #define _PD_REGISTER_KERNEL( \ reg_type, kernel_name, backend, context, layout, meta_kernel_fn, ...) \ - PT_STATIC_ASSERT_GLOBAL_NAMESPACE( \ + PD_STATIC_ASSERT_GLOBAL_NAMESPACE( \ PD_REGISTER_tp_kernel_ns_check_##kernel_name##_##backend##_##layout, \ "PD_REGISTER_KERNEL must be called in global namespace."); \ - PT_EXPAND(_PD_REGISTER_2TA_KERNEL(reg_type, \ + PD_EXPAND(_PD_REGISTER_2TA_KERNEL(reg_type, \ kernel_name, \ backend, \ context, \ @@ -270,19 +270,19 @@ struct KernelRegistrar { #ifndef _WIN32 #define _PD_REGISTER_2TA_KERNEL( \ reg_type, kernel_name, backend, context, layout, meta_kernel_fn, ...) \ - PT_KERNEL_INSTANTIATION(meta_kernel_fn, backend, context, __VA_ARGS__); \ - static void __PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ + PD_KERNEL_INSTANTIATION(meta_kernel_fn, backend, context, __VA_ARGS__); \ + static void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel); \ - PT_KERNEL_REGISTRAR_INIT( \ + PD_KERNEL_REGISTRAR_INIT( \ reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - &__PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout, \ + &__PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout, \ meta_kernel_fn, \ __VA_ARGS__); \ - void __PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ + void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel) #else /** @@ -299,119 +299,119 @@ struct KernelRegistrar { */ #define _PD_REGISTER_2TA_KERNEL( \ reg_type, kernel_name, backend, context, layout, meta_kernel_fn, ...) \ - static void __PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ + static void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel); \ - PT_EXPAND(PT_KERNEL_REGISTRAR_INIT( \ + PD_EXPAND(PD_KERNEL_REGISTRAR_INIT( \ reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - &__PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout, \ + &__PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout, \ meta_kernel_fn, \ __VA_ARGS__)); \ - void __PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ + void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel) #endif -#define PT_KERNEL_INSTANTIATION(meta_kernel_fn, backend, context, ...) \ - _PT_KERNEL_INSTANTIATION( \ - PT_NARGS(__VA_ARGS__), meta_kernel_fn, backend, context, __VA_ARGS__) +#define PD_KERNEL_INSTANTIATION(meta_kernel_fn, backend, context, ...) \ + _PD_KERNEL_INSTANTIATION( \ + PD_NARGS(__VA_ARGS__), meta_kernel_fn, backend, context, __VA_ARGS__) -#define _PT_KERNEL_INSTANTIATION(N, meta_kernel_fn, backend, context, ...) \ - PT_CONCATENATE(_PT_KERNEL_INSTANTIATION_, N) \ +#define _PD_KERNEL_INSTANTIATION(N, meta_kernel_fn, backend, context, ...) \ + PD_CONCATENATE(_PD_KERNEL_INSTANTIATION_, N) \ (meta_kernel_fn, backend, context, __VA_ARGS__) -#define _PT_KERNEL_INSTANTIATION_1( \ +#define _PD_KERNEL_INSTANTIATION_1( \ meta_kernel_fn, backend, context, cpp_dtype) \ template decltype( \ meta_kernel_fn) meta_kernel_fn -#define _PT_KERNEL_INSTANTIATION_2( \ +#define _PD_KERNEL_INSTANTIATION_2( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_1( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_1( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_3( \ +#define _PD_KERNEL_INSTANTIATION_3( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_2( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_2( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_4( \ +#define _PD_KERNEL_INSTANTIATION_4( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_3( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_3( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_5( \ +#define _PD_KERNEL_INSTANTIATION_5( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_4( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_4( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_6( \ +#define _PD_KERNEL_INSTANTIATION_6( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_5( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_5( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_7( \ +#define _PD_KERNEL_INSTANTIATION_7( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_6( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_6( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_8( \ +#define _PD_KERNEL_INSTANTIATION_8( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_7( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_7( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_9( \ +#define _PD_KERNEL_INSTANTIATION_9( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_8( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_8( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_10( \ +#define _PD_KERNEL_INSTANTIATION_10( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_9( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_9( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_11( \ +#define _PD_KERNEL_INSTANTIATION_11( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_10( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_10( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_12( \ +#define _PD_KERNEL_INSTANTIATION_12( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_11( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_11( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_13( \ +#define _PD_KERNEL_INSTANTIATION_13( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_12( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_12( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_14( \ +#define _PD_KERNEL_INSTANTIATION_14( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_13( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_13( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define _PT_KERNEL_INSTANTIATION_15( \ +#define _PD_KERNEL_INSTANTIATION_15( \ meta_kernel_fn, backend, context, cpp_dtype, ...) \ template decltype( \ meta_kernel_fn) meta_kernel_fn; \ - PT_EXPAND(_PT_KERNEL_INSTANTIATION_14( \ + PD_EXPAND(_PD_KERNEL_INSTANTIATION_14( \ meta_kernel_fn, backend, context, __VA_ARGS__)) -#define PT_KERNEL_REGISTRAR_INIT(reg_type, \ +#define PD_KERNEL_REGISTRAR_INIT(reg_type, \ kernel_name, \ backend, \ context, \ @@ -419,7 +419,7 @@ struct KernelRegistrar { args_def_fn, \ meta_kernel_fn, \ ...) \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT(PT_NARGS(__VA_ARGS__), \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT(PD_NARGS(__VA_ARGS__), \ reg_type, \ kernel_name, \ backend, \ @@ -433,7 +433,7 @@ struct KernelRegistrar { /* The =pre-commit always treats this macro into the wrong format, and multi-line macros cannot be skipped with NOLINT.*/ -#define _PT_KERNEL_REGISTRAR_INIT(N, \ +#define _PD_KERNEL_REGISTRAR_INIT(N, \ reg_type, \ kernel_name, \ backend, \ @@ -442,20 +442,20 @@ struct KernelRegistrar { args_def_fn, \ meta_kernel_fn, \ ...) \ - PT_EXPAND(PT_CONCATENATE(_PT_KERNEL_REGISTRAR_INIT_, N) ( \ + PD_EXPAND(PD_CONCATENATE(_PD_KERNEL_REGISTRAR_INIT_, N) ( \ reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) // clang-format on -#define _PT_KERNEL_REGISTRAR_INIT_1(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_1(reg_type, \ kernel_name, \ backend, \ context, \ @@ -464,7 +464,7 @@ struct KernelRegistrar { args_def_fn, \ meta_kernel_fn, \ cpp_dtype) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -474,10 +474,10 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ int TouchKernelSymbolFor_##kernel_name##_##backend##_##layout() { return 0; } -#define _PT_KERNEL_REGISTRAR_INIT_2(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_2(reg_type, \ kernel_name, \ backend, \ context, \ @@ -487,7 +487,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -497,18 +497,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_1(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_1(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_3(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_3(reg_type, \ kernel_name, \ backend, \ context, \ @@ -518,7 +518,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -528,18 +528,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_2(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_2(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_4(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_4(reg_type, \ kernel_name, \ backend, \ context, \ @@ -549,7 +549,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -559,18 +559,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_3(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_3(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_5(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_5(reg_type, \ kernel_name, \ backend, \ context, \ @@ -580,7 +580,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -590,18 +590,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_4(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_4(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_6(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_6(reg_type, \ kernel_name, \ backend, \ context, \ @@ -611,7 +611,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -621,18 +621,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_5(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_5(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_7(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_7(reg_type, \ kernel_name, \ backend, \ context, \ @@ -642,7 +642,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -652,18 +652,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_6(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_6(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_8(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_8(reg_type, \ kernel_name, \ backend, \ context, \ @@ -673,7 +673,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -683,18 +683,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_7(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_7(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_9(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_9(reg_type, \ kernel_name, \ backend, \ context, \ @@ -704,7 +704,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -714,18 +714,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_8(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_8(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_10(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_10(reg_type, \ kernel_name, \ backend, \ context, \ @@ -735,7 +735,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -745,18 +745,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_9(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_9(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_11(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_11(reg_type, \ kernel_name, \ backend, \ context, \ @@ -766,7 +766,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -776,18 +776,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_10(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_10(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_12(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_12(reg_type, \ kernel_name, \ backend, \ context, \ @@ -797,7 +797,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -807,18 +807,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_11(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_11(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_13(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_13(reg_type, \ kernel_name, \ backend, \ context, \ @@ -828,7 +828,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -838,18 +838,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_12(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_12(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_14(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_14(reg_type, \ kernel_name, \ backend, \ context, \ @@ -859,7 +859,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -869,18 +869,18 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_13(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_13(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) -#define _PT_KERNEL_REGISTRAR_INIT_15(reg_type, \ +#define _PD_KERNEL_REGISTRAR_INIT_15(reg_type, \ kernel_name, \ backend, \ context, \ @@ -890,7 +890,7 @@ struct KernelRegistrar { meta_kernel_fn, \ cpp_dtype, \ ...) \ - static const ::phi::KernelRegistrar PT_CONCATENATE( \ + static const ::phi::KernelRegistrar PD_CONCATENATE( \ __reg_pt_kernel_##kernel_name##_##backend##_##layout##_, registrar_id)( \ reg_type, \ #kernel_name, \ @@ -900,14 +900,14 @@ struct KernelRegistrar { ::phi::KernelArgsParseFunctor)>::Parse, \ args_def_fn, \ - PT_KERNEL(meta_kernel_fn), \ - PT_VARIADIC_KERNEL(meta_kernel_fn)); \ - PT_EXPAND(_PT_KERNEL_REGISTRAR_INIT_14(reg_type, \ + PHI_KERNEL(meta_kernel_fn), \ + PHI_VARIADIC_KERNEL(meta_kernel_fn)); \ + PD_EXPAND(_PD_KERNEL_REGISTRAR_INIT_14(reg_type, \ kernel_name, \ backend, \ context, \ layout, \ - PT_ID, \ + PD_ID, \ args_def_fn, \ meta_kernel_fn, \ __VA_ARGS__)) @@ -924,7 +924,7 @@ struct KernelRegistrar { #define _PD_REGISTER_GENERAL_KERNEL( \ reg_type, kernel_name, backend, layout, kernel_fn, dtype) \ - PT_STATIC_ASSERT_GLOBAL_NAMESPACE( \ + PD_STATIC_ASSERT_GLOBAL_NAMESPACE( \ PD_REGISTER_no_t_kernel_ns_check_##kernel_name##_##backend##_##layout, \ "PD_REGISTER_NO_TEMPLATE_KERNEL must be called in global namespace."); \ __PD_REGISTER_GENERAL_KERNEL( \ @@ -934,7 +934,7 @@ struct KernelRegistrar { #define __PD_REGISTER_GENERAL_KERNEL( \ reg_type, kernel_name, backend, layout, kernel_fn, dtype) \ template decltype(kernel_fn) kernel_fn; \ - static void __PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ + static void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel); \ static const ::phi::KernelRegistrar \ __reg_pt_kernel_##kernel_name##_##backend##_##layout( \ @@ -943,18 +943,18 @@ struct KernelRegistrar { #backend, \ DATALAYOUT(layout), \ ::phi::KernelArgsParseFunctor::Parse, \ - &__PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout, \ - PT_KERNEL(kernel_fn), \ - PT_VARIADIC_KERNEL(kernel_fn)); \ + &__PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout, \ + PHI_KERNEL(kernel_fn), \ + PHI_VARIADIC_KERNEL(kernel_fn)); \ int TouchKernelSymbolFor_##kernel_name##_##backend##_##layout() { \ return 0; \ } \ - void __PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ + void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel) #else #define __PD_REGISTER_GENERAL_KERNEL( \ reg_type, kernel_name, backend, layout, kernel_fn, dtype) \ - static void __PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ + static void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel); \ static const ::phi::KernelRegistrar \ __reg_pt_kernel_##kernel_name##_##backend##_##layout( \ @@ -963,13 +963,13 @@ struct KernelRegistrar { #backend, \ DATALAYOUT(layout), \ ::phi::KernelArgsParseFunctor::Parse, \ - &__PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout, \ - PT_KERNEL(kernel_fn), \ - PT_VARIADIC_KERNEL(kernel_fn)); \ + &__PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout, \ + PHI_KERNEL(kernel_fn), \ + PHI_VARIADIC_KERNEL(kernel_fn)); \ int TouchKernelSymbolFor_##kernel_name##_##backend##_##layout() { \ return 0; \ } \ - void __PT_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ + void __PD_KERNEL_args_def_FN_##kernel_name##_##backend##_##layout( \ const ::phi::KernelKey& kernel_key, ::phi::Kernel* kernel) #endif @@ -979,7 +979,7 @@ struct KernelRegistrar { * to avoid being removed by linker */ #define PD_DECLARE_KERNEL(kernel_name, backend, layout) \ - PT_STATIC_ASSERT_GLOBAL_NAMESPACE( \ + PD_STATIC_ASSERT_GLOBAL_NAMESPACE( \ PD_DECLARE_tp_kernel_ns_check_##kernel_name##_##backend##_##layout, \ "PD_DECLARE_KERNEL must be called in global namespace."); \ extern int TouchKernelSymbolFor_##kernel_name##_##backend##_##layout(); \ diff --git a/paddle/phi/core/kernel_utils.h b/paddle/phi/core/kernel_utils.h index f7fa27b0744..baa549d7a66 100644 --- a/paddle/phi/core/kernel_utils.h +++ b/paddle/phi/core/kernel_utils.h @@ -30,14 +30,15 @@ namespace phi { -#define PT_KERNEL(...) \ +// PD_KERNEL has been used by custom op api +#define PHI_KERNEL(...) \ ::phi::KernelImpl::Compute -#define PT_VARIADIC_KERNEL(...) \ +#define PHI_VARIADIC_KERNEL(...) \ reinterpret_cast(&::phi::KernelImpl::VariadicCompute) -#define PT_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(dev_ctx) \ +#define PD_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(dev_ctx) \ template \ struct KernelCallHelper { \ template \ struct KernelCallHelper { \ template \ struct KernelCallHelper, Tail...> { \ template \ struct KernelCallHelper&, Tail...> { \ template \ struct KernelCallHelper { \ template \ struct KernelCallHelper { \ template \ struct KernelCallHelper, Tail...> { \ template { /* DeviceContext Helpers */ - PT_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(CPUContext); + PD_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(CPUContext); #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) - PT_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(GPUContext); + PD_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(GPUContext); #endif #ifdef PADDLE_WITH_XPU - PT_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(XPUContext); + PD_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(XPUContext); #endif #ifdef PADDLE_WITH_CUSTOM_DEVICE - PT_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(CustomContext); + PD_SPECIALIZE_KernelCallHelper_FOR_DEVICE_CONTEXT(CustomContext); #endif /* Input Helpers */ - PT_SPECIALIZE_KernelCallHelper_FOR_INPUT(DenseTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_OPTIONAL_INPUT(DenseTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_OPTIONAL_INPUT(SelectedRows); - PT_SPECIALIZE_KernelCallHelper_FOR_MULTI_INPUT(DenseTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_INPUT(SelectedRows); + PD_SPECIALIZE_KernelCallHelper_FOR_INPUT(DenseTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_OPTIONAL_INPUT(DenseTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_OPTIONAL_INPUT(SelectedRows); + PD_SPECIALIZE_KernelCallHelper_FOR_MULTI_INPUT(DenseTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_INPUT(SelectedRows); - PT_SPECIALIZE_KernelCallHelper_FOR_INPUT(SparseCooTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_OPTIONAL_INPUT(SparseCooTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_MULTI_INPUT(SparseCooTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_INPUT(SparseCooTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_OPTIONAL_INPUT(SparseCooTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_MULTI_INPUT(SparseCooTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_INPUT(SparseCsrTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_OPTIONAL_INPUT(SparseCsrTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_MULTI_INPUT(SparseCsrTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_INPUT(SparseCsrTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_OPTIONAL_INPUT(SparseCsrTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_MULTI_INPUT(SparseCsrTensor); /* Attribute Helpers */ - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(bool); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(float); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(double); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(int); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(int64_t); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(phi::dtype::float16); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const Scalar&); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(DataType); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(DataLayout); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(Place); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const ScalarArray&); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::string&); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); - PT_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(bool); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(float); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(double); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(int); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(int64_t); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(phi::dtype::float16); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const Scalar&); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(DataType); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(DataLayout); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(Place); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const ScalarArray&); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::string&); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); + PD_SPECIALIZE_KernelCallHelper_FOR_ATTRIBUTE(const std::vector&); /* Output Helpers */ - PT_SPECIALIZE_KernelCallHelper_FOR_OUTPUT(DenseTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_MULTI_OUTPUT(DenseTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_OUTPUT(SelectedRows); + PD_SPECIALIZE_KernelCallHelper_FOR_OUTPUT(DenseTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_MULTI_OUTPUT(DenseTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_OUTPUT(SelectedRows); - PT_SPECIALIZE_KernelCallHelper_FOR_OUTPUT(SparseCooTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_MULTI_OUTPUT(SparseCooTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_OUTPUT(SparseCooTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_MULTI_OUTPUT(SparseCooTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_OUTPUT(SparseCsrTensor); - PT_SPECIALIZE_KernelCallHelper_FOR_MULTI_OUTPUT(SparseCsrTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_OUTPUT(SparseCsrTensor); + PD_SPECIALIZE_KernelCallHelper_FOR_MULTI_OUTPUT(SparseCsrTensor); /* End case */ template diff --git a/paddle/phi/core/macros.h b/paddle/phi/core/macros.h index 97c5466e1de..8049d027a77 100644 --- a/paddle/phi/core/macros.h +++ b/paddle/phi/core/macros.h @@ -26,19 +26,19 @@ namespace phi { classname& operator=(classname&&) = delete #endif -#define PT_STATIC_ASSERT_GLOBAL_NAMESPACE(uniq_name, msg) \ - _PT_STATIC_ASSERT_GLOBAL_NAMESPACE(uniq_name, msg) +#define PD_STATIC_ASSERT_GLOBAL_NAMESPACE(uniq_name, msg) \ + _PD_STATIC_ASSERT_GLOBAL_NAMESPACE(uniq_name, msg) -#define _PT_STATIC_ASSERT_GLOBAL_NAMESPACE(uniq_name, msg) \ +#define _PD_STATIC_ASSERT_GLOBAL_NAMESPACE(uniq_name, msg) \ struct __test_global_namespace_##uniq_name##__ {}; \ static_assert(std::is_same<::__test_global_namespace_##uniq_name##__, \ __test_global_namespace_##uniq_name##__>::value, \ msg) #ifdef __COUNTER__ -#define PT_ID __COUNTER__ +#define PD_ID __COUNTER__ #else -#define PT_ID __LINE__ +#define PD_ID __LINE__ #endif #if defined(_WIN32) @@ -48,9 +48,9 @@ namespace phi { #define UNUSED __attribute__((unused)) #endif -#define PT_CONCATENATE(arg1, arg2) PT_CONCATENATE1(arg1, arg2) -#define PT_CONCATENATE1(arg1, arg2) PT_CONCATENATE2(arg1, arg2) -#define PT_CONCATENATE2(arg1, arg2) arg1##arg2 -#define PT_EXPAND(x) x +#define PD_CONCATENATE(arg1, arg2) PD_CONCATENATE1(arg1, arg2) +#define PD_CONCATENATE1(arg1, arg2) PD_CONCATENATE2(arg1, arg2) +#define PD_CONCATENATE2(arg1, arg2) arg1##arg2 +#define PD_EXPAND(x) x } // namespace phi -- GitLab