Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
7e383885
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2305
Star
20932
Fork
5423
代码
文件
提交
分支
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看板
未验证
提交
7e383885
编写于
6月 30, 2023
作者:
A
Aurelius84
提交者:
GitHub
6月 30, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IR]Polish Construct function arugment (#55004)
上级
eef38db1
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
23 addition
and
23 deletion
+23
-23
paddle/fluid/ir/dialect/kernel_attribute_storage.h
paddle/fluid/ir/dialect/kernel_attribute_storage.h
+1
-1
paddle/fluid/ir/dialect/kernel_type_storage.h
paddle/fluid/ir/dialect/kernel_type_storage.h
+5
-5
paddle/fluid/ir/dialect/pd_attribute_storage.h
paddle/fluid/ir/dialect/pd_attribute_storage.h
+4
-4
paddle/fluid/ir/dialect/pd_type_storage.h
paddle/fluid/ir/dialect/pd_type_storage.h
+8
-8
paddle/ir/core/builtin_attribute_storage.h
paddle/ir/core/builtin_attribute_storage.h
+3
-3
paddle/ir/core/builtin_type_storage.h
paddle/ir/core/builtin_type_storage.h
+1
-1
test/cpp/ir/core/type_test.cc
test/cpp/ir/core/type_test.cc
+1
-1
未找到文件。
paddle/fluid/ir/dialect/kernel_attribute_storage.h
浏览文件 @
7e383885
...
...
@@ -28,7 +28,7 @@ struct KernelAttributeStorage : public ir::AttributeStorage {
explicit
KernelAttributeStorage
(
const
ParamKey
&
key
)
{
kernel_key_
=
key
;
}
static
KernelAttributeStorage
*
Construct
(
ParamKey
key
)
{
static
KernelAttributeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
KernelAttributeStorage
(
key
);
}
...
...
paddle/fluid/ir/dialect/kernel_type_storage.h
浏览文件 @
7e383885
...
...
@@ -37,15 +37,15 @@ struct AllocatedDenseTensorTypeStorage : public ir::TypeStorage {
///
using
ParamKey
=
std
::
tuple
<
phi
::
Place
,
dialect
::
DenseTensorType
>
;
AllocatedDenseTensorTypeStorage
(
phi
::
Place
place
,
dialect
::
DenseTensorType
type
)
AllocatedDenseTensorTypeStorage
(
const
phi
::
Place
&
place
,
const
dialect
::
DenseTensorType
&
type
)
:
place_
(
place
),
dense_tensor_type_
(
type
)
{}
///
/// \brief Each derived TypeStorage must define a Construct method, which
/// StorageManager uses to construct a derived TypeStorage.
///
static
AllocatedDenseTensorTypeStorage
*
Construct
(
ParamKey
key
)
{
static
AllocatedDenseTensorTypeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
AllocatedDenseTensorTypeStorage
(
std
::
get
<
0
>
(
key
),
std
::
get
<
1
>
(
key
));
}
...
...
@@ -53,7 +53,7 @@ struct AllocatedDenseTensorTypeStorage : public ir::TypeStorage {
///
/// \brief Each derived TypeStorage must provide a HashValue method.
///
static
std
::
size_t
HashValue
(
const
ParamKey
&
key
)
{
static
std
::
size_t
HashValue
(
const
ParamKey
&
key
)
{
std
::
size_t
hash_value
=
0
;
// hash place
hash_value
=
ir
::
hash_combine
(
hash_value
,
std
::
get
<
0
>
(
key
).
HashValue
());
...
...
@@ -74,7 +74,7 @@ struct AllocatedDenseTensorTypeStorage : public ir::TypeStorage {
///
/// \brief Each derived TypeStorage needs to overload operator==.
///
bool
operator
==
(
const
ParamKey
&
key
)
const
{
bool
operator
==
(
const
ParamKey
&
key
)
const
{
return
ParamKey
(
place_
,
dense_tensor_type_
)
==
key
;
}
...
...
paddle/fluid/ir/dialect/pd_attribute_storage.h
浏览文件 @
7e383885
...
...
@@ -29,7 +29,7 @@ struct IntArrayAttributeStorage : public ir::AttributeStorage {
explicit
IntArrayAttributeStorage
(
const
ParamKey
&
key
)
{
data_
=
key
;
}
static
IntArrayAttributeStorage
*
Construct
(
ParamKey
key
)
{
static
IntArrayAttributeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
IntArrayAttributeStorage
(
key
);
}
...
...
@@ -59,7 +59,7 @@ struct DataTypeAttributeStorage : public ir::AttributeStorage {
explicit
DataTypeAttributeStorage
(
const
ParamKey
&
key
)
{
data_
=
key
;
}
static
DataTypeAttributeStorage
*
Construct
(
ParamKey
key
)
{
static
DataTypeAttributeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
DataTypeAttributeStorage
(
key
);
}
...
...
@@ -80,7 +80,7 @@ struct PlaceAttributeStorage : public ir::AttributeStorage {
explicit
PlaceAttributeStorage
(
const
ParamKey
&
key
)
{
data_
=
key
;
}
static
PlaceAttributeStorage
*
Construct
(
ParamKey
key
)
{
static
PlaceAttributeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
PlaceAttributeStorage
(
key
);
}
...
...
@@ -99,7 +99,7 @@ struct DataLayoutAttributeStorage : public ir::AttributeStorage {
explicit
DataLayoutAttributeStorage
(
const
ParamKey
&
key
)
{
data_
=
key
;
}
static
DataLayoutAttributeStorage
*
Construct
(
ParamKey
key
)
{
static
DataLayoutAttributeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
DataLayoutAttributeStorage
(
key
);
}
...
...
paddle/fluid/ir/dialect/pd_type_storage.h
浏览文件 @
7e383885
...
...
@@ -27,7 +27,7 @@ namespace std {
///
template
<
typename
T
>
struct
hash
<
std
::
vector
<
T
>>
{
std
::
size_t
operator
()(
const
std
::
vector
<
T
>
&
dim
)
const
{
std
::
size_t
operator
()(
const
std
::
vector
<
T
>
&
dim
)
const
{
std
::
size_t
seed
=
0
;
for
(
size_t
i
=
0
;
i
<
dim
.
size
();
++
i
)
{
seed
^=
std
::
hash
<
T
>
()(
dim
[
i
])
+
0x9e3779b9
+
(
seed
<<
6
)
+
(
seed
>>
2
);
...
...
@@ -57,10 +57,10 @@ struct DenseTensorTypeStorage : public ir::TypeStorage {
using
ParamKey
=
std
::
tuple
<
ir
::
Type
,
phi
::
DDim
,
phi
::
DataLayout
,
phi
::
LoD
,
size_t
>
;
DenseTensorTypeStorage
(
ir
::
Type
dtype
,
phi
::
DDim
dims
,
phi
::
DataLayout
layout
,
phi
::
LoD
lod
,
DenseTensorTypeStorage
(
const
ir
::
Type
&
dtype
,
const
phi
::
DDim
&
dims
,
const
phi
::
DataLayout
&
layout
,
const
phi
::
LoD
&
lod
,
size_t
offset
)
:
dtype_
(
dtype
),
dims_
(
dims
),
...
...
@@ -72,7 +72,7 @@ struct DenseTensorTypeStorage : public ir::TypeStorage {
/// \brief Each derived TypeStorage must define a Construct method, which
/// StorageManager uses to construct a derived TypeStorage.
///
static
DenseTensorTypeStorage
*
Construct
(
ParamKey
key
)
{
static
DenseTensorTypeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
DenseTensorTypeStorage
(
std
::
get
<
0
>
(
key
),
std
::
get
<
1
>
(
key
),
std
::
get
<
2
>
(
key
),
...
...
@@ -83,7 +83,7 @@ struct DenseTensorTypeStorage : public ir::TypeStorage {
///
/// \brief Each derived TypeStorage must provide a HashValue method.
///
static
std
::
size_t
HashValue
(
const
ParamKey
&
key
)
{
static
std
::
size_t
HashValue
(
const
ParamKey
&
key
)
{
std
::
size_t
hash_value
=
0
;
// hash dtype
hash_value
=
...
...
@@ -109,7 +109,7 @@ struct DenseTensorTypeStorage : public ir::TypeStorage {
///
/// \brief Each derived TypeStorage needs to overload operator==.
///
bool
operator
==
(
const
ParamKey
&
key
)
const
{
bool
operator
==
(
const
ParamKey
&
key
)
const
{
return
ParamKey
(
dtype_
,
dims_
,
layout_
,
lod_
,
offset_
)
==
key
;
}
...
...
paddle/ir/core/builtin_attribute_storage.h
浏览文件 @
7e383885
...
...
@@ -30,7 +30,7 @@ namespace ir {
\
explicit concrete_storage(const ParamKey &key) { data_ = key; } \
\
static concrete_storage *Construct(
ParamKey key) {
\
static concrete_storage *Construct(
const ParamKey &key) {
\
return new concrete_storage(key); \
} \
\
...
...
@@ -60,7 +60,7 @@ struct StrAttributeStorage : public AttributeStorage {
~
StrAttributeStorage
()
{
free
(
data_
);
}
static
StrAttributeStorage
*
Construct
(
ParamKey
key
)
{
static
StrAttributeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
StrAttributeStorage
(
key
);
}
...
...
@@ -100,7 +100,7 @@ struct ArrayAttributeStorage : public AttributeStorage {
~
ArrayAttributeStorage
()
{
free
(
reinterpret_cast
<
void
*>
(
data_
));
}
static
ArrayAttributeStorage
*
Construct
(
ParamKey
key
)
{
static
ArrayAttributeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
ArrayAttributeStorage
(
key
);
}
...
...
paddle/ir/core/builtin_type_storage.h
浏览文件 @
7e383885
...
...
@@ -36,7 +36,7 @@ struct VectorTypeStorage : public TypeStorage {
/// \brief Each derived TypeStorage must define a Construc method, which
/// StorageManager uses to construct a derived TypeStorage.
///
static
VectorTypeStorage
*
Construct
(
ParamKey
key
)
{
static
VectorTypeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
VectorTypeStorage
(
key
);
}
...
...
test/cpp/ir/core/type_test.cc
浏览文件 @
7e383885
...
...
@@ -167,7 +167,7 @@ struct IntegerTypeStorage : public ir::TypeStorage {
return
ParamKey
(
width_
,
signedness_
)
==
key
;
}
static
IntegerTypeStorage
*
Construct
(
ParamKey
key
)
{
static
IntegerTypeStorage
*
Construct
(
const
ParamKey
&
key
)
{
return
new
IntegerTypeStorage
(
key
.
first
,
key
.
second
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录