diff --git a/paddle/fluid/operators/elementwise/elementwise_op_function.h b/paddle/fluid/operators/elementwise/elementwise_op_function.h index ad5a55aede751ec0411a42dd52c85b8ebbbfa02b..2cdacfcf105aff4c87cfa96f1475a069c35cba57 100644 --- a/paddle/fluid/operators/elementwise/elementwise_op_function.h +++ b/paddle/fluid/operators/elementwise/elementwise_op_function.h @@ -31,8 +31,8 @@ limitations under the License. */ // only can include the headers in paddle/pten/include dirs #include "paddle/pten/api/lib/utils/tensor_utils.h" -#include "paddle/pten/kernels/functions/cpu/elementwise.h" -#include "paddle/pten/kernels/functions/general/elementwise_base.h" +#include "paddle/pten/kernels/hybird/cpu/elementwise.h" +#include "paddle/pten/kernels/hybird/general/elementwise_base.h" #if defined(__NVCC__) || defined(__HIPCC__) #ifdef __NVCC__ diff --git a/paddle/fluid/operators/elementwise/elementwise_op_impl.cu.h b/paddle/fluid/operators/elementwise/elementwise_op_impl.cu.h index 531a6ad224c6c713cb26ec95ffa602f3a3df0572..12fdcd40aa0b1dab1b9566d2074e60ab38a65943 100644 --- a/paddle/fluid/operators/elementwise/elementwise_op_impl.cu.h +++ b/paddle/fluid/operators/elementwise/elementwise_op_impl.cu.h @@ -23,7 +23,7 @@ limitations under the License. */ // only can include the headers in paddle/top/api dirs #include "paddle/pten/api/lib/utils/tensor_utils.h" #include "paddle/pten/include/core.h" -#include "paddle/pten/kernels/functions/cuda/elementwise/elementwise.h" +#include "paddle/pten/kernels/hybird/cuda/elementwise/elementwise.h" #ifdef __HIPCC__ #define ELEMENTWISE_BLOCK_SIZE 256 diff --git a/paddle/fluid/operators/math/math_function.cc b/paddle/fluid/operators/math/math_function.cc index cd919b18b83c80d8caa4bbf4e3334e7432dd18f9..4201af18ca7547172017c04d660d7bcfa5b668b1 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/functions/eigen/common.h" +#include "paddle/pten/kernels/hybird/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 144db9f5a2bb4be5d9383b3893a95f099c6ae00a..fa214c6389c5195e1eb0776fdedb521222a0943e 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/functions/eigen/common.h" +#include "paddle/pten/kernels/hybird/eigen/common.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/reduce_ops/reduce_op.h b/paddle/fluid/operators/reduce_ops/reduce_op.h index df27083edbed521399a4fa20a1d62ac62f1299ed..76a14f6b1b2546d83a3b93e621bb8798ee37e494 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_op.h +++ b/paddle/fluid/operators/reduce_ops/reduce_op.h @@ -28,7 +28,7 @@ limitations under the License. */ #include "paddle/pten/api/lib/utils/tensor_utils.h" #include "paddle/pten/include/core.h" #include "paddle/pten/include/math.h" -#include "paddle/pten/kernels/functions/general/reduce_impl.h" +#include "paddle/pten/kernels/hybird/general/reduce_impl.h" #if defined(__HIPCC__) || defined(__NVCC__) #include "paddle/fluid/operators/reduce_ops/reduce_op.cu.h" diff --git a/paddle/pten/CMakeLists.txt b/paddle/pten/CMakeLists.txt index 448bcb80aa678dc33a1bcc27d640b9417a79aae0..7f6a64a1bb2e79eed409f1b43b4cf32a80365863 100644 --- a/paddle/pten/CMakeLists.txt +++ b/paddle/pten/CMakeLists.txt @@ -11,10 +11,14 @@ add_subdirectory(common) add_subdirectory(api) # pten core components add_subdirectory(core) +# pten components of specific backends +add_subdirectory(backends) # pten kernels for diff device add_subdirectory(kernels) # pten infermeta add_subdirectory(infermeta) +# pten operator definitions +add_subdirectory(ops) # pten tests add_subdirectory(tests) diff --git a/paddle/pten/kernels/functions/blas/CMakeLists.txt b/paddle/pten/backends/CMakeLists.txt similarity index 100% rename from paddle/pten/kernels/functions/blas/CMakeLists.txt rename to paddle/pten/backends/CMakeLists.txt diff --git a/paddle/pten/infermeta/binary.cc b/paddle/pten/infermeta/binary.cc index a0d4cba90dae7b13b978a3d9c28d5968bde56cc4..5d3844a1dec3d51959f5cc81d2fd3358d782fa1d 100644 --- a/paddle/pten/infermeta/binary.cc +++ b/paddle/pten/infermeta/binary.cc @@ -14,7 +14,7 @@ limitations under the License. */ // See Note [ Why still include the fluid headers? ] #include "paddle/pten/infermeta/binary.h" -#include "paddle/pten/kernels/functions/general/elementwise_base.h" +#include "paddle/pten/kernels/hybird/general/elementwise_base.h" namespace pten { diff --git a/paddle/pten/kernels/CMakeLists.txt b/paddle/pten/kernels/CMakeLists.txt index ffc45a5cf23a4ad3aa39fb72f53f22b52fde579d..ebf659da4729864112a0ec949f048a3be3b9eb77 100644 --- a/paddle/pten/kernels/CMakeLists.txt +++ b/paddle/pten/kernels/CMakeLists.txt @@ -1,22 +1,28 @@ -# pten math functions called by kernels -add_subdirectory(math) -# pten basic functions called by kernels -add_subdirectory(functions) -# pten kernels for diff device +# kernel primitive api +add_subdirectory(primitive) +# pten hybird functors and functions called by kernels +add_subdirectory(hybird) + +# pten kernels for different backends +# NOTE(chenweihang): We need to increase the compilation option of WITH_EIGEN, +# which will support splitting eigen at compile time on demand in the future +add_subdirectory(eigen) +# NOTE(chenweihang): We need to increase the compilation option of WITH_BLAS, +# which will support splitting eigen at compile time on demand in the future, +# and if necessary, blas can be split into openblas and cublas +add_subdirectory(blas) add_subdirectory(cpu) if(WITH_GPU OR WITH_ROCM) - # TODO(chenweihang): if hip can split from cuda impl, we should add hip dir + # NOTE(chenweihang): if hip can split from cuda impl, we should add hip dir add_subdirectory(cuda) endif() -# TODO(chenweihang): migrate MKLDNN Kernel in the second phase of the project if(WITH_MKLDNN) - add_subdirectory(mkldnn) + # mkldnn will be deprecated and use the new name dnnl + add_subdirectory(dnnl) endif() -# TODO(chenweihang): migrate NPU Kernel in the second phase of the project if(WITH_ASCEND_CL) add_subdirectory(npu) endif() -# TODO(chenweihang): migrate XPU Kernel in the second phase of the project if(WITH_XPU) add_subdirectory(xpu) endif() diff --git a/paddle/pten/kernels/functions/cpu/CMakeLists.txt b/paddle/pten/kernels/blas/CMakeLists.txt similarity index 100% rename from paddle/pten/kernels/functions/cpu/CMakeLists.txt rename to paddle/pten/kernels/blas/CMakeLists.txt diff --git a/paddle/pten/kernels/cpu/creation.cc b/paddle/pten/kernels/cpu/creation.cc index db3d5c2bf4b1f8d2ab32813b14ce5df17a97910e..4f09fc489f8f67a8b2c53af7da16e716f4ad58fc 100644 --- a/paddle/pten/kernels/cpu/creation.cc +++ b/paddle/pten/kernels/cpu/creation.cc @@ -15,7 +15,7 @@ #include "paddle/pten/kernels/cpu/creation.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/kernels/functions/eigen/fill.h" +#include "paddle/pten/kernels/hybird/eigen/fill.h" namespace pten { diff --git a/paddle/pten/kernels/cpu/linalg.cc b/paddle/pten/kernels/cpu/linalg.cc index ced13dc41d1ae108455ee86b794dff1d40797770..32411560b55168cc1caa2b95253014aea03eb98a 100644 --- a/paddle/pten/kernels/cpu/linalg.cc +++ b/paddle/pten/kernels/cpu/linalg.cc @@ -21,7 +21,7 @@ #include "paddle/fluid/operators/math/blas.h" #include "paddle/fluid/platform/complex.h" -#include "paddle/pten/kernels/functions/math/matmul_func.h" +#include "paddle/pten/kernels/hybird/math/matmul_func.h" namespace pten { diff --git a/paddle/pten/kernels/cpu/manipulation.cc b/paddle/pten/kernels/cpu/manipulation.cc index bf94d00964d959dd6c0ae8c4d849a817641539f9..e0e9cefbf671bf07c375a4452453a8ebef8cd982 100644 --- a/paddle/pten/kernels/cpu/manipulation.cc +++ b/paddle/pten/kernels/cpu/manipulation.cc @@ -16,8 +16,8 @@ #include "paddle/pten/api/ext/dispatch.h" #include "paddle/pten/infermeta/unary.h" #include "paddle/pten/kernels/cpu/utils.h" -#include "paddle/pten/kernels/functions/general/manipulation.h" -#include "paddle/pten/kernels/functions/math/cast_func.h" +#include "paddle/pten/kernels/hybird/general/manipulation.h" +#include "paddle/pten/kernels/hybird/math/cast_func.h" namespace pten { diff --git a/paddle/pten/kernels/cpu/math.cc b/paddle/pten/kernels/cpu/math.cc index e768d4f1eff38bf05b227f3684e69573aeab6a7d..ddfb2f5f45854001c6d4d7000d64be23058153b5 100644 --- a/paddle/pten/kernels/cpu/math.cc +++ b/paddle/pten/kernels/cpu/math.cc @@ -15,12 +15,12 @@ #include "paddle/pten/kernels/cpu/math.h" #include "paddle/pten/api/ext/dispatch.h" -#include "paddle/pten/kernels/functions/cpu/elementwise.h" -#include "paddle/pten/kernels/functions/eigen/reduce.h" -#include "paddle/pten/kernels/functions/eigen/scale.h" -#include "paddle/pten/kernels/functions/eigen/sign.h" -#include "paddle/pten/kernels/functions/general/elementwise_functor.h" -#include "paddle/pten/kernels/functions/general/reduce_impl.h" +#include "paddle/pten/kernels/hybird/cpu/elementwise.h" +#include "paddle/pten/kernels/hybird/eigen/reduce.h" +#include "paddle/pten/kernels/hybird/eigen/scale.h" +#include "paddle/pten/kernels/hybird/eigen/sign.h" +#include "paddle/pten/kernels/hybird/general/elementwise_functor.h" +#include "paddle/pten/kernels/hybird/general/reduce_impl.h" // See Note [ Why still include the fluid headers? ] #include "paddle/fluid/framework/eigen.h" diff --git a/paddle/pten/kernels/cuda/creation.cu b/paddle/pten/kernels/cuda/creation.cu index 84d9fa255ce1f1294516928f4135b9a85e96ec51..8bc23fb6af056fa3f32b20ec021151b084d7c19d 100644 --- a/paddle/pten/kernels/cuda/creation.cu +++ b/paddle/pten/kernels/cuda/creation.cu @@ -15,7 +15,7 @@ #include "paddle/pten/kernels/cuda/creation.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/kernels/functions/eigen/fill.h" +#include "paddle/pten/kernels/hybird/eigen/fill.h" namespace pten { diff --git a/paddle/pten/kernels/cuda/linalg.cu b/paddle/pten/kernels/cuda/linalg.cu index 6811afa8a49ff5676d1cead3ea5d33fcc7a0a203..fe2ac6f184ff7353df5bb55b9b7ff18911d3bf1d 100644 --- a/paddle/pten/kernels/cuda/linalg.cu +++ b/paddle/pten/kernels/cuda/linalg.cu @@ -15,8 +15,8 @@ #include "paddle/pten/kernels/cuda/linalg.h" #include "paddle/pten/core/kernel_registry.h" -#include "paddle/pten/kernels/functions/eigen/dot.h" -#include "paddle/pten/kernels/functions/math/matmul_func.h" +#include "paddle/pten/kernels/hybird/eigen/dot.h" +#include "paddle/pten/kernels/hybird/math/matmul_func.h" // See Note [ Why still include the fluid headers? ] #include "paddle/fluid/platform/complex.h" diff --git a/paddle/pten/kernels/cuda/manipulation.cu b/paddle/pten/kernels/cuda/manipulation.cu index 9c7fded0910415bed2235823e391fa8e748ea3c8..acaf1ac2cc62b28002a6c15d564251cfe352f5dc 100644 --- a/paddle/pten/kernels/cuda/manipulation.cu +++ b/paddle/pten/kernels/cuda/manipulation.cu @@ -16,8 +16,8 @@ #include "paddle/pten/infermeta/unary.h" #include "paddle/pten/kernels/cuda/manipulation.h" #include "paddle/pten/kernels/cuda/utils.h" -#include "paddle/pten/kernels/functions/cuda/cast_kernel_impl.h" -#include "paddle/pten/kernels/functions/general/manipulation.h" +#include "paddle/pten/kernels/hybird/cuda/cast_kernel_impl.h" +#include "paddle/pten/kernels/hybird/general/manipulation.h" namespace pten { diff --git a/paddle/pten/kernels/cuda/math.cu b/paddle/pten/kernels/cuda/math.cu index e7fa599cb68b1ea0c41e875b77d899a3c3746f51..388d42942c10a4afbdca2b4dd5c8ed9a0b9c319d 100644 --- a/paddle/pten/kernels/cuda/math.cu +++ b/paddle/pten/kernels/cuda/math.cu @@ -15,12 +15,12 @@ limitations under the License. */ #include "paddle/pten/kernels/cuda/math.h" #include "paddle/fluid/operators/reduce_ops/reduce_functor_op.h" -#include "paddle/pten/kernels/functions/cuda/elementwise/elementwise.h" -#include "paddle/pten/kernels/functions/cuda/reduce/reduce.h" -#include "paddle/pten/kernels/functions/eigen/scale.h" -#include "paddle/pten/kernels/functions/eigen/sign.h" -#include "paddle/pten/kernels/functions/general/elementwise_functor.h" -#include "paddle/pten/kernels/functions/general/reduce_impl.h" +#include "paddle/pten/kernels/hybird/cuda/elementwise/elementwise.h" +#include "paddle/pten/kernels/hybird/cuda/reduce/reduce.h" +#include "paddle/pten/kernels/hybird/eigen/scale.h" +#include "paddle/pten/kernels/hybird/eigen/sign.h" +#include "paddle/pten/kernels/hybird/general/elementwise_functor.h" +#include "paddle/pten/kernels/hybird/general/reduce_impl.h" #ifdef __NVCC__ #include "cub/cub.cuh" diff --git a/paddle/pten/kernels/functions/cuda/CMakeLists.txt b/paddle/pten/kernels/dnnl/CMakeLists.txt similarity index 100% rename from paddle/pten/kernels/functions/cuda/CMakeLists.txt rename to paddle/pten/kernels/dnnl/CMakeLists.txt diff --git a/paddle/pten/kernels/functions/eigen/CMakeLists.txt b/paddle/pten/kernels/eigen/CMakeLists.txt similarity index 100% rename from paddle/pten/kernels/functions/eigen/CMakeLists.txt rename to paddle/pten/kernels/eigen/CMakeLists.txt diff --git a/paddle/pten/kernels/functions/CMakeLists.txt b/paddle/pten/kernels/functions/CMakeLists.txt deleted file mode 100644 index a5b4bb3e8bd9634e6bac19ffe37b19f518a470b9..0000000000000000000000000000000000000000 --- a/paddle/pten/kernels/functions/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(eigen) -add_subdirectory(blas) -add_subdirectory(general) diff --git a/paddle/pten/kernels/math/cuda/CMakeLists.txt b/paddle/pten/kernels/hybird/CMakeLists.txt similarity index 58% rename from paddle/pten/kernels/math/cuda/CMakeLists.txt rename to paddle/pten/kernels/hybird/CMakeLists.txt index b0be23bb092416db3601d17e9e1a5d9fdecd472d..c82cbd1ef9e21a6b71c1e8d2bda6c105391357d6 100644 --- a/paddle/pten/kernels/math/cuda/CMakeLists.txt +++ b/paddle/pten/kernels/hybird/CMakeLists.txt @@ -1,3 +1,8 @@ +add_subdirectory(eigen) +add_subdirectory(blas) +add_subdirectory(general) + +cc_library(pten_transpose_cpu SRCS transpose.cc DEPS dense_tensor device_context) if(WITH_GPU) nv_library(pten_transpose_cuda SRCS transpose.cu DEPS dense_tensor malloc device_context) elseif(WITH_ROCM) diff --git a/paddle/pten/kernels/functions/general/CMakeLists.txt b/paddle/pten/kernels/hybird/blas/CMakeLists.txt similarity index 100% rename from paddle/pten/kernels/functions/general/CMakeLists.txt rename to paddle/pten/kernels/hybird/blas/CMakeLists.txt diff --git a/paddle/pten/kernels/functions/blas/elementwise.h b/paddle/pten/kernels/hybird/blas/elementwise.h similarity index 100% rename from paddle/pten/kernels/functions/blas/elementwise.h rename to paddle/pten/kernels/hybird/blas/elementwise.h diff --git a/paddle/pten/kernels/mkldnn/CMakeLists.txt b/paddle/pten/kernels/hybird/cpu/CMakeLists.txt similarity index 100% rename from paddle/pten/kernels/mkldnn/CMakeLists.txt rename to paddle/pten/kernels/hybird/cpu/CMakeLists.txt diff --git a/paddle/pten/kernels/functions/cpu/elementwise.h b/paddle/pten/kernels/hybird/cpu/elementwise.h similarity index 99% rename from paddle/pten/kernels/functions/cpu/elementwise.h rename to paddle/pten/kernels/hybird/cpu/elementwise.h index 98600f29910be0f6fd08e98dc87dc59cbe856d8b..e8213c8b45ddb1964f6861040fb2ec480cde950c 100644 --- a/paddle/pten/kernels/functions/cpu/elementwise.h +++ b/paddle/pten/kernels/hybird/cpu/elementwise.h @@ -15,7 +15,7 @@ limitations under the License. */ #pragma once #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/general/elementwise_base.h" +#include "paddle/pten/kernels/hybird/general/elementwise_base.h" namespace pten { diff --git a/paddle/pten/kernels/hybird/cuda/CMakeLists.txt b/paddle/pten/kernels/hybird/cuda/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/paddle/pten/kernels/functions/cuda/cast_kernel_impl.h b/paddle/pten/kernels/hybird/cuda/cast_kernel_impl.h similarity index 100% rename from paddle/pten/kernels/functions/cuda/cast_kernel_impl.h rename to paddle/pten/kernels/hybird/cuda/cast_kernel_impl.h diff --git a/paddle/pten/kernels/functions/cuda/elementwise/elementwise.h b/paddle/pten/kernels/hybird/cuda/elementwise/elementwise.h similarity index 90% rename from paddle/pten/kernels/functions/cuda/elementwise/elementwise.h rename to paddle/pten/kernels/hybird/cuda/elementwise/elementwise.h index b769936089b2514612f0b4622373c063ed98242b..9bcfa1d857ba74ad255fa2fe99b9137d5d843c54 100644 --- a/paddle/pten/kernels/functions/cuda/elementwise/elementwise.h +++ b/paddle/pten/kernels/hybird/cuda/elementwise/elementwise.h @@ -14,8 +14,8 @@ limitations under the License. */ #pragma once -#include "paddle/pten/kernels/functions/cuda/elementwise/elementwise_broadcast.cu.h" -#include "paddle/pten/kernels/functions/cuda/elementwise/elementwise_no_broadcast.cu.h" +#include "paddle/pten/kernels/hybird/cuda/elementwise/elementwise_broadcast.cu.h" +#include "paddle/pten/kernels/hybird/cuda/elementwise/elementwise_no_broadcast.cu.h" namespace pten { diff --git a/paddle/pten/kernels/functions/cuda/elementwise/elementwise_broadcast.cu.h b/paddle/pten/kernels/hybird/cuda/elementwise/elementwise_broadcast.cu.h similarity index 99% rename from paddle/pten/kernels/functions/cuda/elementwise/elementwise_broadcast.cu.h rename to paddle/pten/kernels/hybird/cuda/elementwise/elementwise_broadcast.cu.h index 40d3cf60f092668a006b435b7c16d10c1f53a342..258e8f410ebf3f5bdc5557307712d18372a28a02 100644 --- a/paddle/pten/kernels/functions/cuda/elementwise/elementwise_broadcast.cu.h +++ b/paddle/pten/kernels/hybird/cuda/elementwise/elementwise_broadcast.cu.h @@ -15,7 +15,7 @@ limitations under the License. */ #pragma once #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/cuda/elementwise/elementwise_common.cu.h" +#include "paddle/pten/kernels/hybird/cuda/elementwise/elementwise_common.cu.h" namespace pten { diff --git a/paddle/pten/kernels/functions/cuda/elementwise/elementwise_common.cu.h b/paddle/pten/kernels/hybird/cuda/elementwise/elementwise_common.cu.h similarity index 97% rename from paddle/pten/kernels/functions/cuda/elementwise/elementwise_common.cu.h rename to paddle/pten/kernels/hybird/cuda/elementwise/elementwise_common.cu.h index 1c0dd56254ce178f717f85eccf8f418193c41843..053b53041d1658faf7ff3d8658390da331a77080 100644 --- a/paddle/pten/kernels/functions/cuda/elementwise/elementwise_common.cu.h +++ b/paddle/pten/kernels/hybird/cuda/elementwise/elementwise_common.cu.h @@ -18,7 +18,7 @@ limitations under the License. */ #include "paddle/fluid/platform/aligned_vector.h" #include "paddle/fluid/platform/function_traits.h" #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/general/elementwise_base.h" +#include "paddle/pten/kernels/hybird/general/elementwise_base.h" namespace pten { namespace kps = paddle::operators::kernel_primitives; diff --git a/paddle/pten/kernels/functions/cuda/elementwise/elementwise_no_broadcast.cu.h b/paddle/pten/kernels/hybird/cuda/elementwise/elementwise_no_broadcast.cu.h similarity index 98% rename from paddle/pten/kernels/functions/cuda/elementwise/elementwise_no_broadcast.cu.h rename to paddle/pten/kernels/hybird/cuda/elementwise/elementwise_no_broadcast.cu.h index 4eaf8867fd0c9fbb2e414c2b2325d5cae0cc80d5..e2659271bdcd9f873fdec524e47e51758c150e3c 100644 --- a/paddle/pten/kernels/functions/cuda/elementwise/elementwise_no_broadcast.cu.h +++ b/paddle/pten/kernels/hybird/cuda/elementwise/elementwise_no_broadcast.cu.h @@ -14,7 +14,7 @@ limitations under the License. */ #pragma once -#include "paddle/pten/kernels/functions/cuda/elementwise/elementwise_common.cu.h" +#include "paddle/pten/kernels/hybird/cuda/elementwise/elementwise_common.cu.h" #ifdef __HIPCC__ #define ELEMENTWISE_BLOCK_SIZE 256 diff --git a/paddle/pten/kernels/functions/cuda/reduce/reduce.h b/paddle/pten/kernels/hybird/cuda/reduce/reduce.h similarity index 97% rename from paddle/pten/kernels/functions/cuda/reduce/reduce.h rename to paddle/pten/kernels/hybird/cuda/reduce/reduce.h index 0f7917f79e70c0f4e5aad354886e04a724e71e3f..1e47726333bcd2e87007d63e274dee62be9c199a 100644 --- a/paddle/pten/kernels/functions/cuda/reduce/reduce.h +++ b/paddle/pten/kernels/hybird/cuda/reduce/reduce.h @@ -21,7 +21,7 @@ #include "paddle/pten/core/dense_tensor.h" #include "paddle/fluid/platform/device_context.h" -#include "paddle/pten/kernels/functions/cuda/reduce/reduce_cuda_impl.h" +#include "paddle/pten/kernels/hybird/cuda/reduce/reduce_cuda_impl.h" namespace pten { diff --git a/paddle/pten/kernels/functions/cuda/reduce/reduce_cuda_impl.h b/paddle/pten/kernels/hybird/cuda/reduce/reduce_cuda_impl.h similarity index 99% rename from paddle/pten/kernels/functions/cuda/reduce/reduce_cuda_impl.h rename to paddle/pten/kernels/hybird/cuda/reduce/reduce_cuda_impl.h index 21663ee0388c0b1561de2b06974aa8f4e3e2d8a9..94fab974aced173b4101f6b8cfc0812f011f92a7 100644 --- a/paddle/pten/kernels/functions/cuda/reduce/reduce_cuda_impl.h +++ b/paddle/pten/kernels/hybird/cuda/reduce/reduce_cuda_impl.h @@ -43,7 +43,7 @@ namespace cub = hipcub; #include "paddle/pten/api/ext/dispatch.h" #include "paddle/pten/api/include/tensor.h" #include "paddle/pten/kernels/cuda/utils.h" -#include "paddle/pten/kernels/functions/math/cast_func.h" +#include "paddle/pten/kernels/hybird/math/cast_func.h" // Reduce split or not, Whether to use ReduceHigherDim #define REDUCE_SPLIT_BOUNDARY 512 diff --git a/paddle/pten/kernels/hybird/eigen/CMakeLists.txt b/paddle/pten/kernels/hybird/eigen/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/paddle/pten/kernels/functions/eigen/common.h b/paddle/pten/kernels/hybird/eigen/common.h similarity index 100% rename from paddle/pten/kernels/functions/eigen/common.h rename to paddle/pten/kernels/hybird/eigen/common.h diff --git a/paddle/pten/kernels/functions/eigen/dot.h b/paddle/pten/kernels/hybird/eigen/dot.h similarity index 96% rename from paddle/pten/kernels/functions/eigen/dot.h rename to paddle/pten/kernels/hybird/eigen/dot.h index 27a0b8cf329535bd2dbca158cd3841947d10c18c..eb089037fa3f30efd566678e5e55f9e86666209d 100644 --- a/paddle/pten/kernels/functions/eigen/dot.h +++ b/paddle/pten/kernels/hybird/eigen/dot.h @@ -15,7 +15,7 @@ limitations under the License. */ #pragma once #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/eigen/common.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" diff --git a/paddle/pten/kernels/functions/eigen/elementwise.h b/paddle/pten/kernels/hybird/eigen/elementwise.h similarity index 97% rename from paddle/pten/kernels/functions/eigen/elementwise.h rename to paddle/pten/kernels/hybird/eigen/elementwise.h index 369ff36c46e7f6c5f66d9edda23721943e97cad5..e67cce63d461f461c98258ca770ce09600a5ddba 100644 --- a/paddle/pten/kernels/functions/eigen/elementwise.h +++ b/paddle/pten/kernels/hybird/eigen/elementwise.h @@ -15,7 +15,7 @@ limitations under the License. */ #pragma once #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/eigen/common.h" +#include "paddle/pten/kernels/hybird/eigen/common.h" namespace pten { namespace eigen { diff --git a/paddle/pten/kernels/functions/eigen/fill.h b/paddle/pten/kernels/hybird/eigen/fill.h similarity index 95% rename from paddle/pten/kernels/functions/eigen/fill.h rename to paddle/pten/kernels/hybird/eigen/fill.h index 122a6aef22dc625e05f85f631da1dffcf9e36f69..80e310847e1865627bcd3e349837acbc07f2c867 100644 --- a/paddle/pten/kernels/functions/eigen/fill.h +++ b/paddle/pten/kernels/hybird/eigen/fill.h @@ -15,7 +15,7 @@ limitations under the License. */ #pragma once #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/eigen/common.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" diff --git a/paddle/pten/kernels/functions/eigen/reduce.h b/paddle/pten/kernels/hybird/eigen/reduce.h similarity index 98% rename from paddle/pten/kernels/functions/eigen/reduce.h rename to paddle/pten/kernels/hybird/eigen/reduce.h index 1e1027852163a0a45285e1fb2e82a2bbcf1c3cc2..52ea1e68e12ae9b3e5ca34a2630b0bd88ff8ba73 100644 --- a/paddle/pten/kernels/functions/eigen/reduce.h +++ b/paddle/pten/kernels/hybird/eigen/reduce.h @@ -16,8 +16,8 @@ #include "paddle/pten/api/lib/utils/allocator.h" #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/eigen/common.h" -#include "paddle/pten/kernels/math/transpose.h" +#include "paddle/pten/kernels/hybird/eigen/common.h" +#include "paddle/pten/kernels/hybird/transpose.h" // See Note [ Why still include the fluid headers? ] #include "paddle/fluid/operators/eigen/eigen_function.h" diff --git a/paddle/pten/kernels/functions/eigen/scale.h b/paddle/pten/kernels/hybird/eigen/scale.h similarity index 96% rename from paddle/pten/kernels/functions/eigen/scale.h rename to paddle/pten/kernels/hybird/eigen/scale.h index 49ee561df50ecfa536bd44c87ecb6e1f4ebd813b..111f6c22cc35e951825efa707ec3bc8ebe8f9662 100644 --- a/paddle/pten/kernels/functions/eigen/scale.h +++ b/paddle/pten/kernels/hybird/eigen/scale.h @@ -15,7 +15,7 @@ limitations under the License. */ #pragma once #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/eigen/common.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" diff --git a/paddle/pten/kernels/functions/eigen/sign.h b/paddle/pten/kernels/hybird/eigen/sign.h similarity index 96% rename from paddle/pten/kernels/functions/eigen/sign.h rename to paddle/pten/kernels/hybird/eigen/sign.h index 5cd620815bf264295cc22ee8cf6781250083a893..0beebda4f39e81dd108568485014383747b580a6 100644 --- a/paddle/pten/kernels/functions/eigen/sign.h +++ b/paddle/pten/kernels/hybird/eigen/sign.h @@ -15,7 +15,7 @@ limitations under the License. */ #pragma once #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/eigen/common.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" diff --git a/paddle/pten/kernels/hybird/general/CMakeLists.txt b/paddle/pten/kernels/hybird/general/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/paddle/pten/kernels/functions/general/elementwise_base.h b/paddle/pten/kernels/hybird/general/elementwise_base.h similarity index 100% rename from paddle/pten/kernels/functions/general/elementwise_base.h rename to paddle/pten/kernels/hybird/general/elementwise_base.h diff --git a/paddle/pten/kernels/functions/general/elementwise_functor.h b/paddle/pten/kernels/hybird/general/elementwise_functor.h similarity index 98% rename from paddle/pten/kernels/functions/general/elementwise_functor.h rename to paddle/pten/kernels/hybird/general/elementwise_functor.h index 973389f14797e97d976e095538e028e4a65df08a..109f0907c6a1030ad7a2f9a24bd74946da6fbd35 100644 --- a/paddle/pten/kernels/functions/general/elementwise_functor.h +++ b/paddle/pten/kernels/hybird/general/elementwise_functor.h @@ -18,8 +18,8 @@ limitations under the License. */ #include "paddle/fluid/platform/float16.h" #include "paddle/fluid/platform/hostdevice.h" #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/blas/elementwise.h" -#include "paddle/pten/kernels/functions/eigen/elementwise.h" +#include "paddle/pten/kernels/hybird/blas/elementwise.h" +#include "paddle/pten/kernels/hybird/eigen/elementwise.h" namespace pten { namespace general { diff --git a/paddle/pten/kernels/functions/general/manipulation.h b/paddle/pten/kernels/hybird/general/manipulation.h similarity index 100% rename from paddle/pten/kernels/functions/general/manipulation.h rename to paddle/pten/kernels/hybird/general/manipulation.h diff --git a/paddle/pten/kernels/functions/general/reduce_impl.h b/paddle/pten/kernels/hybird/general/reduce_impl.h similarity index 95% rename from paddle/pten/kernels/functions/general/reduce_impl.h rename to paddle/pten/kernels/hybird/general/reduce_impl.h index a48eb7e44bdc124ef4755d2c43ccf674dee0ac8d..50f40c5f2ca12bca53aa42030cfc8890a7588bfe 100644 --- a/paddle/pten/kernels/functions/general/reduce_impl.h +++ b/paddle/pten/kernels/hybird/general/reduce_impl.h @@ -16,8 +16,8 @@ #include "paddle/fluid/platform/transform.h" #include "paddle/pten/api/ext/dispatch.h" #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/eigen/reduce.h" -#include "paddle/pten/kernels/functions/math/cast_func.h" +#include "paddle/pten/kernels/hybird/eigen/reduce.h" +#include "paddle/pten/kernels/hybird/math/cast_func.h" namespace pten { namespace general { diff --git a/paddle/pten/kernels/functions/math/cast_func.h b/paddle/pten/kernels/hybird/math/cast_func.h similarity index 100% rename from paddle/pten/kernels/functions/math/cast_func.h rename to paddle/pten/kernels/hybird/math/cast_func.h diff --git a/paddle/pten/kernels/functions/math/matmul_func.h b/paddle/pten/kernels/hybird/math/matmul_func.h similarity index 100% rename from paddle/pten/kernels/functions/math/matmul_func.h rename to paddle/pten/kernels/hybird/math/matmul_func.h diff --git a/paddle/pten/kernels/math/cpu/transpose.cc b/paddle/pten/kernels/hybird/transpose.cc similarity index 98% rename from paddle/pten/kernels/math/cpu/transpose.cc rename to paddle/pten/kernels/hybird/transpose.cc index c8580b8877d5548ddf5d3aa6a22687b765d300f9..73375a6a379fe9422620ac39879d27f5d8850bc1 100644 --- a/paddle/pten/kernels/math/cpu/transpose.cc +++ b/paddle/pten/kernels/hybird/transpose.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/pten/kernels/math/transpose.h" +#include "paddle/pten/kernels/hybird/transpose.h" #include "paddle/fluid/framework/ddim.h" #include "paddle/pten/core/dense_tensor.h" diff --git a/paddle/pten/kernels/math/cuda/transpose.cu b/paddle/pten/kernels/hybird/transpose.cu similarity index 97% rename from paddle/pten/kernels/math/cuda/transpose.cu rename to paddle/pten/kernels/hybird/transpose.cu index a18efde2c2e62c4c4c32745fd0573e7826735262..bf7a1409938a68963f9fefdc570e9da703c6fffa 100644 --- a/paddle/pten/kernels/math/cuda/transpose.cu +++ b/paddle/pten/kernels/hybird/transpose.cu @@ -15,8 +15,8 @@ #include "paddle/fluid/framework/ddim.h" #include "paddle/fluid/memory/memcpy.h" #include "paddle/pten/core/dense_tensor.h" -#include "paddle/pten/kernels/functions/math/cast_func.h" -#include "paddle/pten/kernels/math/transpose.h" +#include "paddle/pten/kernels/hybird/math/cast_func.h" +#include "paddle/pten/kernels/hybird/transpose.h" // See Note [ Why still include the fluid headers? ] #include "paddle/fluid/platform/bfloat16.h" diff --git a/paddle/pten/kernels/math/transpose.h b/paddle/pten/kernels/hybird/transpose.h similarity index 100% rename from paddle/pten/kernels/math/transpose.h rename to paddle/pten/kernels/hybird/transpose.h diff --git a/paddle/pten/kernels/math/CMakeLists.txt b/paddle/pten/kernels/math/CMakeLists.txt deleted file mode 100644 index 429a6df8e2cc71763131f3cd8e3368aa86065a9c..0000000000000000000000000000000000000000 --- a/paddle/pten/kernels/math/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -add_subdirectory(cpu) -if(WITH_GPU OR WITH_ROCM) - add_subdirectory(cuda) -endif() diff --git a/paddle/pten/kernels/math/cpu/CMakeLists.txt b/paddle/pten/kernels/math/cpu/CMakeLists.txt deleted file mode 100644 index 235a49a5e4af513b0536f2fbc909bb6188914a89..0000000000000000000000000000000000000000 --- a/paddle/pten/kernels/math/cpu/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -cc_library(pten_transpose_cpu SRCS transpose.cc DEPS dense_tensor device_context) diff --git a/paddle/pten/kernels/primitive/CMakeLists.txt b/paddle/pten/kernels/primitive/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/paddle/pten/kernels/xpu/manipulation.cc b/paddle/pten/kernels/xpu/manipulation.cc index 352d21e6e9bf94a96bca544e12a73dbaf8dfc14f..5f1c0d42eb5a8faf2d6b488ebded52684abfab3c 100644 --- a/paddle/pten/kernels/xpu/manipulation.cc +++ b/paddle/pten/kernels/xpu/manipulation.cc @@ -14,7 +14,7 @@ #include "paddle/pten/kernels/xpu/manipulation.h" #include "paddle/pten/infermeta/unary.h" -#include "paddle/pten/kernels/functions/general/manipulation.h" +#include "paddle/pten/kernels/hybird/general/manipulation.h" #include "paddle/pten/kernels/xpu/utils.h" namespace pten { diff --git a/paddle/pten/ops/CMakeLists.txt b/paddle/pten/ops/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391