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

polish backend and layout details (#45029)

上级 083b4eb6
......@@ -48,6 +48,7 @@ enum class Backend : uint8_t {
XPU, // XPU 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
IPU,
// the third library backend
ONEDNN,
......@@ -56,8 +57,6 @@ enum class Backend : uint8_t {
// paddle kernel primitives backend
KPS,
IPU,
// end of backend types
NUM_BACKENDS,
......
......@@ -18,8 +18,20 @@ limitations under the License. */
namespace paddle {
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`
// maybe confuse users, so we use all uppercase names
enum class DataLayout {
UNDEFINED = 0,
// TODO(chenweihang): keep ANY for compatibility, remove it later
......@@ -32,16 +44,21 @@ enum class DataLayout {
SPARSE_COO,
SPARSE_CSR,
PSTRING_UNION,
NUM_DATA_LAYOUTS,
// See Note [ Why we need ALL in basic kernel key member? ]
ALL_LAYOUT = UNDEFINED,
// Note: Unify phi DataLayout and fluid::framework::DataLayout,
// for compatible with fluid DataLayout, here need prefix `k`
// Note: The original `kAnyLayout (enum value 2)` is a strange design.
// `kAnyLayout` originally cannot represent any kind of Layout,
// at the same time, it can also represent any 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,
kNHWC = NHWC,
kNCHW = NCHW,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册