From e67154655b3f96df45e7c7576fb810b9de3d24e0 Mon Sep 17 00:00:00 2001 From: Avin0323 Date: Wed, 7 Apr 2021 03:44:56 +0000 Subject: [PATCH] move REGISTER_OP_CUDA_KERNEL into cpp with eigen, test=develop --- paddle/fluid/operators/expand_as_op.cc | 14 ++++++++++ paddle/fluid/operators/expand_as_op.cu | 25 ------------------ paddle/fluid/operators/expand_as_v2_op.cc | 15 +++++++++++ paddle/fluid/operators/expand_as_v2_op.cu | 26 ------------------ paddle/fluid/operators/expand_op.cc | 18 +++++++++++++ paddle/fluid/operators/expand_op.cu | 32 ----------------------- paddle/fluid/operators/expand_v2_op.cc | 18 +++++++++++++ paddle/fluid/operators/expand_v2_op.cu | 32 ----------------------- paddle/fluid/operators/meshgrid_op.cc | 14 ++++++++++ paddle/fluid/operators/meshgrid_op.cu | 29 -------------------- paddle/fluid/operators/tile_op.cc | 17 ++++++++++++ paddle/fluid/operators/tile_op.cu | 31 ---------------------- 12 files changed, 96 insertions(+), 175 deletions(-) delete mode 100755 paddle/fluid/operators/expand_as_op.cu delete mode 100644 paddle/fluid/operators/expand_as_v2_op.cu delete mode 100644 paddle/fluid/operators/expand_op.cu delete mode 100644 paddle/fluid/operators/expand_v2_op.cu delete mode 100644 paddle/fluid/operators/meshgrid_op.cu delete mode 100644 paddle/fluid/operators/tile_op.cu diff --git a/paddle/fluid/operators/expand_as_op.cc b/paddle/fluid/operators/expand_as_op.cc index 25b83ed93f729..8850dc45d24c8 100644 --- a/paddle/fluid/operators/expand_as_op.cc +++ b/paddle/fluid/operators/expand_as_op.cc @@ -147,3 +147,17 @@ REGISTER_OP_CPU_KERNEL( ops::ExpandAsGradKernel, ops::ExpandAsGradKernel, ops::ExpandAsGradKernel); +#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_ROCM) +REGISTER_OP_CUDA_KERNEL( + expand_as, ops::ExpandAsKernel, + ops::ExpandAsKernel, + ops::ExpandAsKernel, + ops::ExpandAsKernel, + ops::ExpandAsKernel); +REGISTER_OP_CUDA_KERNEL( + expand_as_grad, + ops::ExpandAsGradKernel, + ops::ExpandAsGradKernel, + ops::ExpandAsGradKernel, + ops::ExpandAsGradKernel); +#endif diff --git a/paddle/fluid/operators/expand_as_op.cu b/paddle/fluid/operators/expand_as_op.cu deleted file mode 100755 index dbb1fcf3ab326..0000000000000 --- a/paddle/fluid/operators/expand_as_op.cu +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ -#include "paddle/fluid/operators/expand_as_op.h" - -namespace ops = paddle::operators; -REGISTER_OP_CUDA_KERNEL( - expand_as, ops::ExpandAsKernel, - ops::ExpandAsKernel, - ops::ExpandAsKernel, - ops::ExpandAsKernel, - ops::ExpandAsKernel); -REGISTER_OP_CUDA_KERNEL( - expand_as_grad, - ops::ExpandAsGradKernel, - ops::ExpandAsGradKernel, - ops::ExpandAsGradKernel, - ops::ExpandAsGradKernel); diff --git a/paddle/fluid/operators/expand_as_v2_op.cc b/paddle/fluid/operators/expand_as_v2_op.cc index 70099afbd5994..f0a6e6ec33242 100644 --- a/paddle/fluid/operators/expand_as_v2_op.cc +++ b/paddle/fluid/operators/expand_as_v2_op.cc @@ -129,3 +129,18 @@ REGISTER_OP_CPU_KERNEL( ops::ExpandAsV2GradKernel, ops::ExpandAsV2GradKernel, ops::ExpandAsV2GradKernel); +#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_ROCM) +REGISTER_OP_CUDA_KERNEL( + expand_as_v2, + ops::ExpandAsV2Kernel, + ops::ExpandAsV2Kernel, + ops::ExpandAsV2Kernel, + ops::ExpandAsV2Kernel, + ops::ExpandAsV2Kernel); +REGISTER_OP_CUDA_KERNEL( + expand_as_v2_grad, + ops::ExpandAsV2GradKernel, + ops::ExpandAsV2GradKernel, + ops::ExpandAsV2GradKernel, + ops::ExpandAsV2GradKernel); +#endif diff --git a/paddle/fluid/operators/expand_as_v2_op.cu b/paddle/fluid/operators/expand_as_v2_op.cu deleted file mode 100644 index e315144472dd9..0000000000000 --- a/paddle/fluid/operators/expand_as_v2_op.cu +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ -#include "paddle/fluid/operators/expand_as_v2_op.h" - -namespace ops = paddle::operators; -REGISTER_OP_CUDA_KERNEL( - expand_as_v2, - ops::ExpandAsV2Kernel, - ops::ExpandAsV2Kernel, - ops::ExpandAsV2Kernel, - ops::ExpandAsV2Kernel, - ops::ExpandAsV2Kernel); -REGISTER_OP_CUDA_KERNEL( - expand_as_v2_grad, - ops::ExpandAsV2GradKernel, - ops::ExpandAsV2GradKernel, - ops::ExpandAsV2GradKernel, - ops::ExpandAsV2GradKernel); diff --git a/paddle/fluid/operators/expand_op.cc b/paddle/fluid/operators/expand_op.cc index 83e205367a7af..6797639b94721 100644 --- a/paddle/fluid/operators/expand_op.cc +++ b/paddle/fluid/operators/expand_op.cc @@ -273,3 +273,21 @@ REGISTER_OP_CPU_KERNEL( ops::ExpandGradKernel, ops::ExpandGradKernel, ops::ExpandGradKernel); +#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_ROCM) +REGISTER_OP_CUDA_KERNEL( + expand, ops::ExpandKernel, + ops::ExpandKernel, + ops::ExpandKernel, + ops::ExpandKernel, + ops::ExpandKernel, + ops::ExpandKernel); +REGISTER_OP_CUDA_KERNEL( + expand_grad, + ops::ExpandGradKernel, + ops::ExpandGradKernel, + ops::ExpandGradKernel, + ops::ExpandGradKernel, + ops::ExpandGradKernel); +#endif diff --git a/paddle/fluid/operators/expand_op.cu b/paddle/fluid/operators/expand_op.cu deleted file mode 100644 index f2f8e2f7414f3..0000000000000 --- a/paddle/fluid/operators/expand_op.cu +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ -#include "paddle/fluid/operators/expand_op.h" - -namespace ops = paddle::operators; -namespace plat = paddle::platform; - -REGISTER_OP_CUDA_KERNEL( - expand, ops::ExpandKernel, - ops::ExpandKernel, - ops::ExpandKernel, - ops::ExpandKernel, - ops::ExpandKernel, - ops::ExpandKernel); -REGISTER_OP_CUDA_KERNEL( - expand_grad, - ops::ExpandGradKernel, - ops::ExpandGradKernel, - ops::ExpandGradKernel, - ops::ExpandGradKernel, - ops::ExpandGradKernel); diff --git a/paddle/fluid/operators/expand_v2_op.cc b/paddle/fluid/operators/expand_v2_op.cc index 05ab0f6c8dc8f..e65011bf7de63 100644 --- a/paddle/fluid/operators/expand_v2_op.cc +++ b/paddle/fluid/operators/expand_v2_op.cc @@ -278,3 +278,21 @@ REGISTER_OP_CPU_KERNEL( ops::ExpandV2GradKernel, ops::ExpandV2GradKernel, ops::ExpandV2GradKernel); +#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_ROCM) +REGISTER_OP_CUDA_KERNEL( + expand_v2, ops::ExpandV2Kernel, + ops::ExpandV2Kernel, + ops::ExpandV2Kernel, + ops::ExpandV2Kernel, + ops::ExpandV2Kernel, + ops::ExpandV2Kernel); +REGISTER_OP_CUDA_KERNEL( + expand_v2_grad, + ops::ExpandV2GradKernel, + ops::ExpandV2GradKernel, + ops::ExpandV2GradKernel, + ops::ExpandV2GradKernel, + ops::ExpandV2GradKernel); +#endif diff --git a/paddle/fluid/operators/expand_v2_op.cu b/paddle/fluid/operators/expand_v2_op.cu deleted file mode 100644 index e096dbc27f0c2..0000000000000 --- a/paddle/fluid/operators/expand_v2_op.cu +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ -#include "paddle/fluid/operators/expand_v2_op.h" - -namespace ops = paddle::operators; -namespace plat = paddle::platform; - -REGISTER_OP_CUDA_KERNEL( - expand_v2, ops::ExpandV2Kernel, - ops::ExpandV2Kernel, - ops::ExpandV2Kernel, - ops::ExpandV2Kernel, - ops::ExpandV2Kernel, - ops::ExpandV2Kernel); -REGISTER_OP_CUDA_KERNEL( - expand_v2_grad, - ops::ExpandV2GradKernel, - ops::ExpandV2GradKernel, - ops::ExpandV2GradKernel, - ops::ExpandV2GradKernel, - ops::ExpandV2GradKernel); diff --git a/paddle/fluid/operators/meshgrid_op.cc b/paddle/fluid/operators/meshgrid_op.cc index 33f71b4adc066..2ad3c9f923a31 100644 --- a/paddle/fluid/operators/meshgrid_op.cc +++ b/paddle/fluid/operators/meshgrid_op.cc @@ -157,3 +157,17 @@ REGISTER_OP_CPU_KERNEL( ops::MeshgridGradKernel, ops::MeshgridGradKernel, ops::MeshgridGradKernel); +#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_ROCM) +REGISTER_OP_CUDA_KERNEL( + meshgrid, ops::MeshgridKernel, + ops::MeshgridKernel, + ops::MeshgridKernel, + ops::MeshgridKernel, + ops::MeshgridKernel); +REGISTER_OP_CUDA_KERNEL( + meshgrid_grad, + ops::MeshgridGradKernel, + ops::MeshgridGradKernel, + ops::MeshgridGradKernel, + ops::MeshgridGradKernel); +#endif diff --git a/paddle/fluid/operators/meshgrid_op.cu b/paddle/fluid/operators/meshgrid_op.cu deleted file mode 100644 index dc813a07f8c8c..0000000000000 --- a/paddle/fluid/operators/meshgrid_op.cu +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "paddle/fluid/operators/meshgrid_op.h" - -namespace ops = paddle::operators; -REGISTER_OP_CUDA_KERNEL( - meshgrid, ops::MeshgridKernel, - ops::MeshgridKernel, - ops::MeshgridKernel, - ops::MeshgridKernel, - ops::MeshgridKernel); -REGISTER_OP_CUDA_KERNEL( - meshgrid_grad, - ops::MeshgridGradKernel, - ops::MeshgridGradKernel, - ops::MeshgridGradKernel, - ops::MeshgridGradKernel); diff --git a/paddle/fluid/operators/tile_op.cc b/paddle/fluid/operators/tile_op.cc index 6527362bb9690..a8b1c7235448b 100644 --- a/paddle/fluid/operators/tile_op.cc +++ b/paddle/fluid/operators/tile_op.cc @@ -286,3 +286,20 @@ REGISTER_OP_CPU_KERNEL( ops::TileGradKernel, ops::TileGradKernel, ops::TileGradKernel); +#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_ROCM) +REGISTER_OP_CUDA_KERNEL( + tile, ops::TileKernel, + ops::TileKernel, + ops::TileKernel, + ops::TileKernel, + ops::TileKernel, + ops::TileKernel); +REGISTER_OP_CUDA_KERNEL( + tile_grad, ops::TileGradKernel, + ops::TileGradKernel, + ops::TileGradKernel, + ops::TileGradKernel, + ops::TileGradKernel); +#endif diff --git a/paddle/fluid/operators/tile_op.cu b/paddle/fluid/operators/tile_op.cu deleted file mode 100644 index 5ca82cd6a1f43..0000000000000 --- a/paddle/fluid/operators/tile_op.cu +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ -#include "paddle/fluid/operators/tile_op.h" - -namespace ops = paddle::operators; -namespace plat = paddle::platform; - -REGISTER_OP_CUDA_KERNEL( - tile, ops::TileKernel, - ops::TileKernel, - ops::TileKernel, - ops::TileKernel, - ops::TileKernel, - ops::TileKernel); -REGISTER_OP_CUDA_KERNEL( - tile_grad, ops::TileGradKernel, - ops::TileGradKernel, - ops::TileGradKernel, - ops::TileGradKernel, - ops::TileGradKernel);