未验证 提交 35839aee 编写于 作者: C Chen Weihang 提交者: GitHub

polish backend and layout details (#45029)

上级 083b4eb6
...@@ -48,6 +48,7 @@ enum class Backend : uint8_t { ...@@ -48,6 +48,7 @@ enum class Backend : uint8_t {
XPU, // XPU currently does not exist at the same time as CUDA XPU, // XPU currently does not exist at the same time as CUDA
NPU, // NPU currently does not exist at the same time as CUDA NPU, // NPU currently does not exist at the same time as CUDA
MLU, // MLU currently does not exist at the same time as CUDA MLU, // MLU currently does not exist at the same time as CUDA
IPU,
// the third library backend // the third library backend
ONEDNN, ONEDNN,
...@@ -56,8 +57,6 @@ enum class Backend : uint8_t { ...@@ -56,8 +57,6 @@ enum class Backend : uint8_t {
// paddle kernel primitives backend // paddle kernel primitives backend
KPS, KPS,
IPU,
// end of backend types // end of backend types
NUM_BACKENDS, NUM_BACKENDS,
......
...@@ -18,8 +18,20 @@ limitations under the License. */ ...@@ -18,8 +18,20 @@ limitations under the License. */
namespace paddle { namespace paddle {
namespace experimental { namespace experimental {
// Note: The original design of paddle DataLayout is confusing.
// It contains two levels of "layout", one is the data layout
// at the Tensor level, including Dense, Sparse, etc., and the other
// is the format at the data level, including NHWC, NCHW, etc.,
// these should belong to the concept of "data format".
// The concepts of these two levels are mixed into an enumeration class,
// which leads to some strange execution scheduling logic.
// It needs to be refactored in the future.
// In order to maintain compatibility, we still use the design of the
// original framework here.
// Note: Here the DataLayout is public api for external users, the prefix `k` // Note: Here the DataLayout is public api for external users, the prefix `k`
// maybe confuse users, so we use all uppercase names // maybe confuse users, so we use all uppercase names
enum class DataLayout { enum class DataLayout {
UNDEFINED = 0, UNDEFINED = 0,
// TODO(chenweihang): keep ANY for compatibility, remove it later // TODO(chenweihang): keep ANY for compatibility, remove it later
...@@ -32,16 +44,21 @@ enum class DataLayout { ...@@ -32,16 +44,21 @@ enum class DataLayout {
SPARSE_COO, SPARSE_COO,
SPARSE_CSR, SPARSE_CSR,
PSTRING_UNION, PSTRING_UNION,
NUM_DATA_LAYOUTS, NUM_DATA_LAYOUTS,
// See Note [ Why we need ALL in basic kernel key member? ] // See Note [ Why we need ALL in basic kernel key member? ]
ALL_LAYOUT = UNDEFINED, ALL_LAYOUT = UNDEFINED,
// Note: Unify phi DataLayout and fluid::framework::DataLayout, // Note: Unify phi DataLayout and fluid::framework::DataLayout,
// for compatible with fluid DataLayout, here need prefix `k` // for compatible with fluid DataLayout, here need prefix `k`
// Note: The original `kAnyLayout (enum value 2)` is a strange design. // Note: The original `kAnyLayout (enum value 2)` is a strange design.
// `kAnyLayout` originally cannot represent any kind of Layout, // `kAnyLayout` originally cannot represent any kind of Layout,
// at the same time, it can also represent any Layout. // at the same time, it can also represent any Layout.
// Strictly, it means "default" or "undefined" layout, // Strictly, it means "default" or "undefined" layout,
// and should not be mixed with other meaningful layouts. // and should not be mixed with other meaningful layouts
kAnyLayout = ANY, kAnyLayout = ANY,
kNHWC = NHWC, kNHWC = NHWC,
kNCHW = NCHW, kNCHW = NCHW,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册