From d84934da23b533e1cb59095d16aa033471daa957 Mon Sep 17 00:00:00 2001 From: Aganlengzi Date: Wed, 13 Apr 2022 09:05:39 +0800 Subject: [PATCH] [CustomDevice] move member variable to dense_tensor.h (#41702) --- paddle/phi/core/dense_tensor.h | 19 +++++++++++++++++++ paddle/phi/core/dense_tensor.inl | 11 ----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/paddle/phi/core/dense_tensor.h b/paddle/phi/core/dense_tensor.h index a740a9a5725..ef91319e1c9 100644 --- a/paddle/phi/core/dense_tensor.h +++ b/paddle/phi/core/dense_tensor.h @@ -190,6 +190,25 @@ class DenseTensor : public TensorBase, std::shared_ptr inplace_version_counter_{ std::make_shared()}; +/* @jim19930609: This is a hack +In general, it is badly designed to fuse MKLDNN-specific objects into a +generic Tensor. +We temporarily leave them here to unblock Tensor Unification progress. +In the final state, we should come up with a MKLDNN_Tensor and move the +following codes there. +*/ +#ifdef PADDLE_WITH_MKLDNN + /** + * @brief the detail format of memory block which have layout as kMKLDNN + * + * @note MKLDNN lib support various memory format like nchw, nhwc, nChw8C, + * nChw16c, etc. For a MKLDNN memory block, layout will be set as + * DataLayout::kMKLDNN meanwhile detail memory format will be kept in + * this field. + */ + dnnl::memory::format_tag format_ = dnnl::memory::format_tag::undef; +#endif + #ifndef PADDLE_WITH_CUSTOM_KERNEL #include "paddle/phi/core/dense_tensor.inl" #endif diff --git a/paddle/phi/core/dense_tensor.inl b/paddle/phi/core/dense_tensor.inl index 804360ea941..c6ca3c00cb5 100644 --- a/paddle/phi/core/dense_tensor.inl +++ b/paddle/phi/core/dense_tensor.inl @@ -133,17 +133,6 @@ inline void set_format(const dnnl::memory::format_tag format) { format_ = format; } -protected: -/** - * @brief the detail format of memory block which have layout as kMKLDNN - * - * @note MKLDNN lib support various memory format like nchw, nhwc, nChw8C, - * nChw16c, etc. For a MKLDNN memory block, layout will be set as - * DataLayout::kMKLDNN meanwhile detail memory format will be kept in - * this field. - */ - -dnnl::memory::format_tag format_ = dnnl::memory::format_tag::undef; #endif /* ------------------------------ */ -- GitLab