From 5f5f626b22324329c3d2d6b3415cc1a4b3d53b11 Mon Sep 17 00:00:00 2001 From: Chen Weihang Date: Wed, 12 Jan 2022 17:00:35 +0800 Subject: [PATCH] [PTen] Remove hybird dir (#38863) * remove hybird dir * resolve conflit --- paddle/fluid/operators/math/math_function.cc | 2 +- paddle/fluid/operators/math/math_function.cu | 2 +- paddle/pten/kernels/CMakeLists.txt | 4 +- paddle/pten/kernels/cpu/elementwise.h | 2 +- paddle/pten/kernels/cpu/reduce.h | 4 +- .../kernels/{hybird => funcs}/CMakeLists.txt | 1 - .../cuda => funcs/eigen}/CMakeLists.txt | 0 .../kernels/{hybird => funcs}/eigen/common.h | 0 .../kernels/{hybird => funcs}/transpose.cc | 2 +- .../kernels/{hybird => funcs}/transpose.cu | 2 +- .../kernels/{hybird => funcs}/transpose.h | 2 +- paddle/pten/kernels/gpu/dot_kernel.cu | 2 +- .../pten/kernels/hybird/eigen/CMakeLists.txt | 0 paddle/pten/kernels/hybird/eigen/sign.h | 41 ------------------- .../kernels/hybird/general/CMakeLists.txt | 0 .../pten/kernels/impl/dot_grad_kernel_impl.h | 2 +- paddle/pten/kernels/impl/full_kernel_impl.h | 2 +- paddle/pten/kernels/impl/scale_kernel_impl.h | 2 +- paddle/pten/kernels/impl/sign_kernel_impl.h | 2 +- 19 files changed, 15 insertions(+), 57 deletions(-) rename paddle/pten/kernels/{hybird => funcs}/CMakeLists.txt (92%) rename paddle/pten/kernels/{hybird/cuda => funcs/eigen}/CMakeLists.txt (100%) rename paddle/pten/kernels/{hybird => funcs}/eigen/common.h (100%) rename paddle/pten/kernels/{hybird => funcs}/transpose.cc (98%) rename paddle/pten/kernels/{hybird => funcs}/transpose.cu (98%) rename paddle/pten/kernels/{hybird => funcs}/transpose.h (97%) delete mode 100644 paddle/pten/kernels/hybird/eigen/CMakeLists.txt delete mode 100644 paddle/pten/kernels/hybird/eigen/sign.h delete mode 100644 paddle/pten/kernels/hybird/general/CMakeLists.txt diff --git a/paddle/fluid/operators/math/math_function.cc b/paddle/fluid/operators/math/math_function.cc index 1efddc48186..ec21524b0b8 100644 --- a/paddle/fluid/operators/math/math_function.cc +++ b/paddle/fluid/operators/math/math_function.cc @@ -29,7 +29,7 @@ limitations under the License. */ #include "paddle/fluid/operators/math/math_function_impl.h" #include "paddle/fluid/platform/bfloat16.h" #include "paddle/fluid/platform/float16.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" +#include "paddle/pten/kernels/funcs/eigen/common.h" #include "unsupported/Eigen/CXX11/Tensor" namespace paddle { diff --git a/paddle/fluid/operators/math/math_function.cu b/paddle/fluid/operators/math/math_function.cu index a692246a06b..378f0426ddf 100644 --- a/paddle/fluid/operators/math/math_function.cu +++ b/paddle/fluid/operators/math/math_function.cu @@ -21,7 +21,7 @@ limitations under the License. */ #include "paddle/fluid/operators/math/math_function_impl.h" #include "paddle/fluid/platform/bfloat16.h" #include "paddle/fluid/platform/float16.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" +#include "paddle/pten/kernels/funcs/eigen/common.h" namespace paddle { namespace operators { diff --git a/paddle/pten/kernels/CMakeLists.txt b/paddle/pten/kernels/CMakeLists.txt index fc04cd797f4..45724e5d22a 100644 --- a/paddle/pten/kernels/CMakeLists.txt +++ b/paddle/pten/kernels/CMakeLists.txt @@ -6,8 +6,8 @@ file(WRITE ${kernel_declare_file} "// Generated by the paddle/pten/kernels/CMake # kernel primitive api add_subdirectory(primitive) -# pten hybird functors and functions called by kernels -add_subdirectory(hybird) +# pten functors and functions called by kernels +add_subdirectory(funcs) add_subdirectory(cpu) if(WITH_GPU OR WITH_ROCM) diff --git a/paddle/pten/kernels/cpu/elementwise.h b/paddle/pten/kernels/cpu/elementwise.h index 5a421de1173..97db997a164 100644 --- a/paddle/pten/kernels/cpu/elementwise.h +++ b/paddle/pten/kernels/cpu/elementwise.h @@ -19,7 +19,7 @@ limitations under the License. */ #include "paddle/pten/kernels/funcs/elementwise_base.h" #include "paddle/fluid/operators/math/blas.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" +#include "paddle/pten/kernels/funcs/eigen/common.h" namespace pten { diff --git a/paddle/pten/kernels/cpu/reduce.h b/paddle/pten/kernels/cpu/reduce.h index fa603b21630..1e9c1e885f4 100644 --- a/paddle/pten/kernels/cpu/reduce.h +++ b/paddle/pten/kernels/cpu/reduce.h @@ -22,8 +22,8 @@ #include "paddle/pten/api/lib/utils/storage.h" #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" -#include "paddle/pten/kernels/hybird/transpose.h" +#include "paddle/pten/kernels/funcs/eigen/common.h" +#include "paddle/pten/kernels/funcs/transpose.h" // See Note [ Why still include the fluid headers? ] #include "paddle/fluid/operators/eigen/eigen_function.h" namespace pten { diff --git a/paddle/pten/kernels/hybird/CMakeLists.txt b/paddle/pten/kernels/funcs/CMakeLists.txt similarity index 92% rename from paddle/pten/kernels/hybird/CMakeLists.txt rename to paddle/pten/kernels/funcs/CMakeLists.txt index 5d04bae2eae..32bdc94b95d 100644 --- a/paddle/pten/kernels/hybird/CMakeLists.txt +++ b/paddle/pten/kernels/funcs/CMakeLists.txt @@ -1,5 +1,4 @@ add_subdirectory(eigen) -add_subdirectory(general) cc_library(pten_transpose_cpu SRCS transpose.cc DEPS dense_tensor pten_context) if(WITH_GPU) diff --git a/paddle/pten/kernels/hybird/cuda/CMakeLists.txt b/paddle/pten/kernels/funcs/eigen/CMakeLists.txt similarity index 100% rename from paddle/pten/kernels/hybird/cuda/CMakeLists.txt rename to paddle/pten/kernels/funcs/eigen/CMakeLists.txt diff --git a/paddle/pten/kernels/hybird/eigen/common.h b/paddle/pten/kernels/funcs/eigen/common.h similarity index 100% rename from paddle/pten/kernels/hybird/eigen/common.h rename to paddle/pten/kernels/funcs/eigen/common.h diff --git a/paddle/pten/kernels/hybird/transpose.cc b/paddle/pten/kernels/funcs/transpose.cc similarity index 98% rename from paddle/pten/kernels/hybird/transpose.cc rename to paddle/pten/kernels/funcs/transpose.cc index d1d4350c931..5a40abbd1b7 100644 --- a/paddle/pten/kernels/hybird/transpose.cc +++ b/paddle/pten/kernels/funcs/transpose.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/pten/kernels/hybird/transpose.h" +#include "paddle/pten/kernels/funcs/transpose.h" #include "paddle/fluid/framework/ddim.h" #include "paddle/pten/backends/cpu/cpu_context.h" #include "paddle/pten/core/dense_tensor.h" diff --git a/paddle/pten/kernels/hybird/transpose.cu b/paddle/pten/kernels/funcs/transpose.cu similarity index 98% rename from paddle/pten/kernels/hybird/transpose.cu rename to paddle/pten/kernels/funcs/transpose.cu index 6ea5e36e106..e03c538e386 100644 --- a/paddle/pten/kernels/hybird/transpose.cu +++ b/paddle/pten/kernels/funcs/transpose.cu @@ -16,7 +16,7 @@ #include "paddle/fluid/memory/memcpy.h" #include "paddle/pten/backends/gpu/gpu_context.h" #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/hybird/transpose.h" +#include "paddle/pten/kernels/funcs/transpose.h" // See Note [ Why still include the fluid headers? ] #include "paddle/fluid/platform/bfloat16.h" diff --git a/paddle/pten/kernels/hybird/transpose.h b/paddle/pten/kernels/funcs/transpose.h similarity index 97% rename from paddle/pten/kernels/hybird/transpose.h rename to paddle/pten/kernels/funcs/transpose.h index 17f52c74a13..d0e4dafe2c3 100644 --- a/paddle/pten/kernels/hybird/transpose.h +++ b/paddle/pten/kernels/funcs/transpose.h @@ -18,7 +18,7 @@ #include "paddle/pten/core/dense_tensor.h" #include "paddle/fluid/operators/eigen/eigen_function.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" +#include "paddle/pten/kernels/funcs/eigen/common.h" namespace pten { diff --git a/paddle/pten/kernels/gpu/dot_kernel.cu b/paddle/pten/kernels/gpu/dot_kernel.cu index 1f9e7aa3f1c..08d8f83c408 100644 --- a/paddle/pten/kernels/gpu/dot_kernel.cu +++ b/paddle/pten/kernels/gpu/dot_kernel.cu @@ -16,7 +16,7 @@ #include "paddle/pten/backends/gpu/gpu_context.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" +#include "paddle/pten/kernels/funcs/eigen/common.h" // See Note [ Why still include the fluid headers? ] #include "paddle/fluid/operators/eigen/eigen_function.h" diff --git a/paddle/pten/kernels/hybird/eigen/CMakeLists.txt b/paddle/pten/kernels/hybird/eigen/CMakeLists.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/paddle/pten/kernels/hybird/eigen/sign.h b/paddle/pten/kernels/hybird/eigen/sign.h deleted file mode 100644 index 0beebda4f39..00000000000 --- a/paddle/pten/kernels/hybird/eigen/sign.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2021 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. */ - -#pragma once - -#include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" - -// See Note [ Why still include the fluid headers? ] -#include "paddle/fluid/operators/eigen/eigen_function.h" - -namespace pten { -namespace eigen { - -template -void Sign(const DevCtx& dev_ctx, const DenseTensor& x, DenseTensor* out) { - out->mutable_data(); - // TODO(chenweihang): if we design new tensor, we should support - // the low-level calc functor use new tensor as input, - // which may be a big project! - auto eigen_out = pten::EigenVector::Flatten(*out); - auto eigen_x = pten::EigenVector::Flatten(x); - - auto& dev = *dev_ctx.eigen_device(); - paddle::operators::EigenSign, T>::Eval( - dev, eigen_out, eigen_x); -} - -} // namespace eigen -} // namespace pten diff --git a/paddle/pten/kernels/hybird/general/CMakeLists.txt b/paddle/pten/kernels/hybird/general/CMakeLists.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/paddle/pten/kernels/impl/dot_grad_kernel_impl.h b/paddle/pten/kernels/impl/dot_grad_kernel_impl.h index 16c87bbab47..39cdbad5146 100644 --- a/paddle/pten/kernels/impl/dot_grad_kernel_impl.h +++ b/paddle/pten/kernels/impl/dot_grad_kernel_impl.h @@ -15,7 +15,7 @@ limitations under the License. */ #pragma once #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" +#include "paddle/pten/kernels/funcs/eigen/common.h" #include "paddle/pten/kernels/complex_kernel.h" diff --git a/paddle/pten/kernels/impl/full_kernel_impl.h b/paddle/pten/kernels/impl/full_kernel_impl.h index 9be40e22a03..79ca63c9b06 100644 --- a/paddle/pten/kernels/impl/full_kernel_impl.h +++ b/paddle/pten/kernels/impl/full_kernel_impl.h @@ -17,7 +17,7 @@ limitations under the License. */ #include "paddle/pten/common/scalar.h" #include "paddle/pten/common/scalar_array.h" #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" +#include "paddle/pten/kernels/funcs/eigen/common.h" // See Note [ Why still include the fluid headers? ] #include "paddle/fluid/operators/eigen/eigen_function.h" diff --git a/paddle/pten/kernels/impl/scale_kernel_impl.h b/paddle/pten/kernels/impl/scale_kernel_impl.h index 937b3115e63..2e0b158b36b 100644 --- a/paddle/pten/kernels/impl/scale_kernel_impl.h +++ b/paddle/pten/kernels/impl/scale_kernel_impl.h @@ -16,7 +16,7 @@ limitations under the License. */ #include "paddle/pten/common/scalar.h" #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" +#include "paddle/pten/kernels/funcs/eigen/common.h" // See Note [ Why still include the fluid headers? ] #include "paddle/fluid/operators/eigen/eigen_function.h" diff --git a/paddle/pten/kernels/impl/sign_kernel_impl.h b/paddle/pten/kernels/impl/sign_kernel_impl.h index 306206f1fc3..655cda762ee 100644 --- a/paddle/pten/kernels/impl/sign_kernel_impl.h +++ b/paddle/pten/kernels/impl/sign_kernel_impl.h @@ -15,7 +15,7 @@ limitations under the License. */ #pragma once #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/hybird/eigen/common.h" +#include "paddle/pten/kernels/funcs/eigen/common.h" // See Note [ Why still include the fluid headers? ] #include "paddle/fluid/operators/eigen/eigen_function.h" -- GitLab