From 3c557e2fdd1a42d46fa98faadbd1c1664e6c1ad8 Mon Sep 17 00:00:00 2001 From: YuanRisheng Date: Thu, 2 Feb 2023 10:55:23 +0800 Subject: [PATCH] [BugFix]Fix bugs when compile with OneDNN (#50096) * fix bugs * fix ci bugs --- paddle/fluid/framework/feed_fetch_type.h | 5 +++ paddle/fluid/framework/string_array.h | 12 ++++-- paddle/fluid/operators/controlflow/feed_op.cc | 38 ------------------- paddle/phi/kernels/funcs/CMakeLists.txt | 2 +- 4 files changed, 15 insertions(+), 42 deletions(-) diff --git a/paddle/fluid/framework/feed_fetch_type.h b/paddle/fluid/framework/feed_fetch_type.h index 571667bff4..e51f22a2c3 100644 --- a/paddle/fluid/framework/feed_fetch_type.h +++ b/paddle/fluid/framework/feed_fetch_type.h @@ -26,6 +26,11 @@ namespace framework { using FeedType = paddle::variant; +template <> +struct PhiVectorType { + const char *type_name = "PhiVectorFeedType"; +}; + using FeedList = paddle::framework::PhiVector; using FetchType = paddle::variant +struct PhiVectorType; + +template <> +struct PhiVectorType { + const char* type_name = "PhiVectorString"; +}; + template class PhiVector : public phi::ExtendedTensor, public phi::TypeInfoTraits> { @@ -129,9 +137,7 @@ class PhiVector : public phi::ExtendedTensor, public: /// \brief Returns the name of the class for type traits. /// \return The name of the class. - static const char* name() { - return (std::string("PhiVector_") + std::string(typeid(T).name())).c_str(); - } + static const char* name() { return PhiVectorType().type_name; } size_t size() const { return data_.size(); } diff --git a/paddle/fluid/operators/controlflow/feed_op.cc b/paddle/fluid/operators/controlflow/feed_op.cc index 09684b8d73..9d266b81d0 100644 --- a/paddle/fluid/operators/controlflow/feed_op.cc +++ b/paddle/fluid/operators/controlflow/feed_op.cc @@ -267,44 +267,6 @@ PD_REGISTER_GENERAL_KERNEL( ALL_LAYOUT, paddle::operators::FeedStringsKernel, ALL_DTYPE) {} -#elif defined(PADDLE_WITH_ASCEND_CL) -PD_REGISTER_GENERAL_KERNEL( - feed_dense_tensor, - npu, - ALL_LAYOUT, - paddle::operators::FeedDenseTensorKernel, - ALL_DTYPE) {} -PD_REGISTER_GENERAL_KERNEL( - feed_sparse_coo_tensor, - npu, - ALL_LAYOUT, - paddle::operators::FeedSparseCooTensorKernel, - ALL_DTYPE) {} -PD_REGISTER_GENERAL_KERNEL( - feed_strings, - npu, - ALL_LAYOUT, - paddle::operators::FeedStringsKernel, - ALL_DTYPE) {} -#elif defined(PADDLE_WITH_MLU) -PD_REGISTER_GENERAL_KERNEL( - feed_dense_tensor, - CustomMLU, - ALL_LAYOUT, - paddle::operators::FeedDenseTensorKernel, - ALL_DTYPE) {} -PD_REGISTER_GENERAL_KERNEL( - feed_sparse_coo_tensor, - CustomMLU, - ALL_LAYOUT, - paddle::operators::FeedSparseCooTensorKernel, - ALL_DTYPE) {} -PD_REGISTER_GENERAL_KERNEL( - feed_strings, - CustomMLU, - ALL_LAYOUT, - paddle::operators::FeedStringsKernel, - ALL_DTYPE) {} #endif #ifdef PADDLE_WITH_CUSTOM_DEVICE namespace paddle { diff --git a/paddle/phi/kernels/funcs/CMakeLists.txt b/paddle/phi/kernels/funcs/CMakeLists.txt index e4f779c807..da8f47c7bf 100644 --- a/paddle/phi/kernels/funcs/CMakeLists.txt +++ b/paddle/phi/kernels/funcs/CMakeLists.txt @@ -27,7 +27,7 @@ math_library(sequence_scale) cc_library( phi_data_layout_transform SRCS data_layout_transform.cc - DEPS tensor) + DEPS tensor blas) if(WITH_GPU OR WITH_ROCM) if(MKL_FOUND AND WITH_ONEMKL) -- GitLab