Skip to content

[BugFix]Fix bugs when compile with OneDNN #50096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions paddle/fluid/framework/feed_fetch_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ namespace framework {
using FeedType =
paddle::variant<phi::DenseTensor, Strings, phi::SparseCooTensor>;

template <>
struct PhiVectorType<FeedType> {
const char *type_name = "PhiVectorFeedType";
};

using FeedList = paddle::framework::PhiVector<FeedType>;

using FetchType = paddle::variant<phi::DenseTensor,
Expand Down
12 changes: 9 additions & 3 deletions paddle/fluid/framework/string_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ class Vocab : public phi::ExtendedTensor,
// Kernel. It can be used when you define a non-tensor type that needs to be
// stored in a vector as PHI kernel argument.

template <typename T>
struct PhiVectorType;

template <>
struct PhiVectorType<std::string> {
const char* type_name = "PhiVectorString";
};

template <typename T>
class PhiVector : public phi::ExtendedTensor,
public phi::TypeInfoTraits<phi::TensorBase, PhiVector<T>> {
Expand Down Expand Up @@ -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<T>().type_name; }

size_t size() const { return data_.size(); }

Expand Down
38 changes: 0 additions & 38 deletions paddle/fluid/operators/controlflow/feed_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,44 +267,6 @@ PD_REGISTER_GENERAL_KERNEL(
ALL_LAYOUT,
paddle::operators::FeedStringsKernel<phi::XPUContext>,
ALL_DTYPE) {}
#elif defined(PADDLE_WITH_ASCEND_CL)
PD_REGISTER_GENERAL_KERNEL(
feed_dense_tensor,
npu,
ALL_LAYOUT,
paddle::operators::FeedDenseTensorKernel<phi::CustomContext>,
ALL_DTYPE) {}
PD_REGISTER_GENERAL_KERNEL(
feed_sparse_coo_tensor,
npu,
ALL_LAYOUT,
paddle::operators::FeedSparseCooTensorKernel<phi::CustomContext>,
ALL_DTYPE) {}
PD_REGISTER_GENERAL_KERNEL(
feed_strings,
npu,
ALL_LAYOUT,
paddle::operators::FeedStringsKernel<phi::CustomContext>,
ALL_DTYPE) {}
#elif defined(PADDLE_WITH_MLU)
PD_REGISTER_GENERAL_KERNEL(
feed_dense_tensor,
CustomMLU,
ALL_LAYOUT,
paddle::operators::FeedDenseTensorKernel<phi::CustomContext>,
ALL_DTYPE) {}
PD_REGISTER_GENERAL_KERNEL(
feed_sparse_coo_tensor,
CustomMLU,
ALL_LAYOUT,
paddle::operators::FeedSparseCooTensorKernel<phi::CustomContext>,
ALL_DTYPE) {}
PD_REGISTER_GENERAL_KERNEL(
feed_strings,
CustomMLU,
ALL_LAYOUT,
paddle::operators::FeedStringsKernel<phi::CustomContext>,
ALL_DTYPE) {}
#endif
#ifdef PADDLE_WITH_CUSTOM_DEVICE
namespace paddle {
Expand Down
2 changes: 1 addition & 1 deletion paddle/phi/kernels/funcs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down