Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c71198f8
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c71198f8
编写于
6月 02, 2023
作者:
A
Aurelius84
提交者:
GitHub
6月 02, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IR]Polish code in builtin type declaration (#54275)
* [IR]Polish code in builtin type declaration * fix typo
上级
5b4d786b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
63 deletion
+27
-63
paddle/ir/core/builtin_type.h
paddle/ir/core/builtin_type.h
+27
-63
未找到文件。
paddle/ir/core/builtin_type.h
浏览文件 @
c71198f8
...
@@ -34,6 +34,9 @@ namespace ir {
...
@@ -34,6 +34,9 @@ namespace ir {
/// Type fp32 = Float32Type::get(ctx);
/// Type fp32 = Float32Type::get(ctx);
/// \endcode
/// \endcode
///
///
// NOTE(dev): Currently BF16 and Int8 are not considered as a cached member
// in IrContextImpl because they are not widely used.
class
BFloat16Type
:
public
Type
{
class
BFloat16Type
:
public
Type
{
public:
public:
using
Type
::
Type
;
using
Type
::
Type
;
...
@@ -41,33 +44,6 @@ class BFloat16Type : public Type {
...
@@ -41,33 +44,6 @@ class BFloat16Type : public Type {
DECLARE_TYPE_UTILITY_FUNCTOR
(
BFloat16Type
,
TypeStorage
);
DECLARE_TYPE_UTILITY_FUNCTOR
(
BFloat16Type
,
TypeStorage
);
};
};
class
Float16Type
:
public
Type
{
public:
using
Type
::
Type
;
DECLARE_TYPE_UTILITY_FUNCTOR
(
Float16Type
,
TypeStorage
);
static
Float16Type
get
(
IrContext
*
context
);
};
class
Float32Type
:
public
Type
{
public:
using
Type
::
Type
;
DECLARE_TYPE_UTILITY_FUNCTOR
(
Float32Type
,
TypeStorage
);
static
Float32Type
get
(
IrContext
*
context
);
};
class
Float64Type
:
public
Type
{
public:
using
Type
::
Type
;
DECLARE_TYPE_UTILITY_FUNCTOR
(
Float64Type
,
TypeStorage
);
static
Float64Type
get
(
IrContext
*
context
);
};
class
Int8Type
:
public
Type
{
class
Int8Type
:
public
Type
{
public:
public:
using
Type
::
Type
;
using
Type
::
Type
;
...
@@ -75,42 +51,6 @@ class Int8Type : public Type {
...
@@ -75,42 +51,6 @@ class Int8Type : public Type {
DECLARE_TYPE_UTILITY_FUNCTOR
(
Int8Type
,
TypeStorage
);
DECLARE_TYPE_UTILITY_FUNCTOR
(
Int8Type
,
TypeStorage
);
};
};
class
Int16Type
:
public
Type
{
public:
using
Type
::
Type
;
DECLARE_TYPE_UTILITY_FUNCTOR
(
Int16Type
,
TypeStorage
);
static
Int16Type
get
(
IrContext
*
context
);
};
class
Int32Type
:
public
Type
{
public:
using
Type
::
Type
;
DECLARE_TYPE_UTILITY_FUNCTOR
(
Int32Type
,
TypeStorage
);
static
Int32Type
get
(
IrContext
*
context
);
};
class
Int64Type
:
public
Type
{
public:
using
Type
::
Type
;
DECLARE_TYPE_UTILITY_FUNCTOR
(
Int64Type
,
TypeStorage
);
static
Int64Type
get
(
IrContext
*
context
);
};
class
BoolType
:
public
Type
{
public:
using
Type
::
Type
;
DECLARE_TYPE_UTILITY_FUNCTOR
(
BoolType
,
TypeStorage
);
static
BoolType
get
(
IrContext
*
context
);
};
class
VectorType
:
public
Type
{
class
VectorType
:
public
Type
{
public:
public:
using
Type
::
Type
;
using
Type
::
Type
;
...
@@ -126,4 +66,28 @@ class VectorType : public Type {
...
@@ -126,4 +66,28 @@ class VectorType : public Type {
Type
operator
[](
size_t
index
)
const
{
return
data
()[
index
];
}
Type
operator
[](
size_t
index
)
const
{
return
data
()[
index
];
}
};
};
#define DECLARE_BUILTIN_TYPE(__name) \
class __name##Type : public Type { \
public: \
using Type::Type; \
\
DECLARE_TYPE_UTILITY_FUNCTOR(__name##Type, TypeStorage); \
\
static __name##Type get(IrContext *context); \
};
#define FOREACH_BUILTIN_TYPE(__macro) \
__macro(Float16); \
__macro(Float32); \
__macro(Float64); \
__macro(Int16); \
__macro(Int32); \
__macro(Int64); \
__macro(Bool);
FOREACH_BUILTIN_TYPE
(
DECLARE_BUILTIN_TYPE
)
#undef FOREACH_BUILTIN_TYPE
#undef DECLARE_BUILTIN_TYPE
}
// namespace ir
}
// namespace ir
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录