Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
e916e80c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
未验证
提交
e916e80c
编写于
5月 18, 2023
作者:
C
co63oc
提交者:
GitHub
5月 18, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix typos, test=document_fix (#53927)
上级
d8407c51
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
19 addition
and
19 deletion
+19
-19
paddle/fluid/dialect/pd_type.h
paddle/fluid/dialect/pd_type.h
+1
-1
paddle/ir/attribute_base.h
paddle/ir/attribute_base.h
+5
-5
paddle/ir/storage_manager.cc
paddle/ir/storage_manager.cc
+4
-4
paddle/ir/storage_manager.h
paddle/ir/storage_manager.h
+2
-2
paddle/ir/type_base.h
paddle/ir/type_base.h
+6
-6
test/cpp/ir/ir_attribute_test.cc
test/cpp/ir/ir_attribute_test.cc
+1
-1
未找到文件。
paddle/fluid/dialect/pd_type.h
浏览文件 @
e916e80c
...
...
@@ -22,7 +22,7 @@ namespace dialect {
#define GET_PADDLE_TYPE_LIST paddle::dialect::DenseTensorType
///
/// \brief Define built-in paramet
e
ric types.
/// \brief Define built-in parametric types.
///
class
DenseTensorType
:
public
ir
::
Type
{
public:
...
...
paddle/ir/attribute_base.h
浏览文件 @
e916e80c
...
...
@@ -92,10 +92,10 @@ struct AttributeManager;
/// \brief AttributeStorage is used to store all information of a Attribute. A
/// Attribute object contains a AttributeStorage. For non-parameter attribute,
/// the information includes: TypeId, so AttributeStorage only needs to include
/// AbstractAttribute; For paramet
e
ric attribute, in addition to
/// AbstractAttribute/TypeId, paramet
e
ric information needs to be included. So
/// that, non-paramet
e
ric attribute can be constructed by AttributeStorage
/// directly but paramet
e
ric attribute should be constructed by Derived
/// AbstractAttribute; For parametric attribute, in addition to
/// AbstractAttribute/TypeId, parametric information needs to be included. So
/// that, non-parametric attribute can be constructed by AttributeStorage
/// directly but parametric attribute should be constructed by Derived
/// AttributeStorage.
///
class
AttributeStorage
:
public
StorageManager
::
StorageBase
{
...
...
@@ -144,7 +144,7 @@ class AttributeStorage : public StorageManager::StorageBase {
struct
AttributeManager
{
///
/// \brief Get a unique instance of Attribute T from IrContext. Note: For a
/// paramet
e
ric attribute, if not found in IrContext, it will try to create a
/// parametric attribute, if not found in IrContext, it will try to create a
/// new instance and register it to IrContext; for a parameterless attribute,
/// only search.
///
...
...
paddle/ir/storage_manager.cc
浏览文件 @
e916e80c
...
...
@@ -19,7 +19,7 @@
namespace
ir
{
// This is a structure for creating, caching, and looking up Storage of
// paramet
e
ric types.
// parametric types.
struct
ParametricStorageManager
{
using
StorageBase
=
StorageManager
::
StorageBase
;
...
...
@@ -41,7 +41,7 @@ struct ParametricStorageManager {
auto
pr
=
parametric_instances_
.
equal_range
(
hash_value
);
while
(
pr
.
first
!=
pr
.
second
)
{
if
(
equal_func
(
pr
.
first
->
second
))
{
VLOG
(
4
)
<<
"Found a cached paramet
e
ric storage of: [param_hash="
VLOG
(
4
)
<<
"Found a cached parametric storage of: [param_hash="
<<
hash_value
<<
", storage_ptr="
<<
pr
.
first
->
second
<<
"]."
;
return
pr
.
first
->
second
;
}
...
...
@@ -50,7 +50,7 @@ struct ParametricStorageManager {
}
StorageBase
*
storage
=
constructor
();
parametric_instances_
.
emplace
(
hash_value
,
storage
);
VLOG
(
4
)
<<
"No cache found, construct and cache a new paramet
e
ric storage "
VLOG
(
4
)
<<
"No cache found, construct and cache a new parametric storage "
"of: [param_hash="
<<
hash_value
<<
", storage_ptr="
<<
storage
<<
"]."
;
return
storage
;
...
...
@@ -94,7 +94,7 @@ StorageManager::StorageBase *StorageManager::GetParameterlessStorageImpl(
void
StorageManager
::
RegisterParametricStorageImpl
(
TypeId
type_id
)
{
std
::
lock_guard
<
ir
::
SpinLock
>
guard
(
parametric_instance_lock_
);
VLOG
(
4
)
<<
"Register a paramet
e
ric storage of: [TypeId_hash="
VLOG
(
4
)
<<
"Register a parametric storage of: [TypeId_hash="
<<
std
::
hash
<
ir
::
TypeId
>
()(
type_id
)
<<
"]."
;
parametric_instance_
.
emplace
(
type_id
,
std
::
make_unique
<
ParametricStorageManager
>
());
...
...
paddle/ir/storage_manager.h
浏览文件 @
e916e80c
...
...
@@ -33,7 +33,7 @@ struct ParametricStorageManager;
/// Storage class must be a derived class of StorageManager::StorageBase.
/// There are two types of Storage class:
/// One is a parameterless type, which can directly obtain an instance through
/// the get method; The other is a paramet
e
ric type, which needs to comply with
/// the get method; The other is a parametric type, which needs to comply with
/// the following conditions: (1) Need to define a type alias called ParamKey,
/// it serves as the unique identifier for the Storage class; (2) Need to
/// provide a hash method on the ParamKey for storage and access; (3) Need to
...
...
@@ -134,7 +134,7 @@ class StorageManager {
void
RegisterParameterlessStorageImpl
(
TypeId
type_id
,
std
::
function
<
StorageBase
*
()
>
constructor
);
// This map is a mapping between type id and paramet
e
ric type storage.
// This map is a mapping between type id and parametric type storage.
std
::
unordered_map
<
TypeId
,
std
::
unique_ptr
<
ParametricStorageManager
>>
parametric_instance_
;
...
...
paddle/ir/type_base.h
浏览文件 @
e916e80c
...
...
@@ -24,7 +24,7 @@ class Dialect;
///
/// \brief Abstract the properties and behaviors common to all Type classes into
/// an AbstractType class. There are two types in Type system:
/// non-parameter/parameterless type and paramet
e
ric-type. The common attributes
/// non-parameter/parameterless type and parametric-type. The common attributes
/// of all types is TypeId (and possibly others). Therefore, construct a class
/// with TypeId as its member.
///
...
...
@@ -95,10 +95,10 @@ struct TypeManager;
///
/// \brief TypeStorage is used to store all information of a Type. A Type object
/// contains a TypeStorage. For non-parameter type, the information includes:
/// TypeId, so TypeStorage only needs to include AbstractType; For paramet
e
ric
/// type, in addition to AbstractType/TypeId, paramet
e
ric information needs to
/// be included. So that, non-paramet
e
ric type can be constructed by TypeStorage
/// directly but paramet
e
ric type should be constructed by Derived TypeStorage.
/// TypeId, so TypeStorage only needs to include AbstractType; For parametric
/// type, in addition to AbstractType/TypeId, parametric information needs to
/// be included. So that, non-parametric type can be constructed by TypeStorage
/// directly but parametric type should be constructed by Derived TypeStorage.
///
class
TypeStorage
:
public
StorageManager
::
StorageBase
{
friend
StorageManager
;
...
...
@@ -144,7 +144,7 @@ class TypeStorage : public StorageManager::StorageBase {
struct
TypeManager
{
///
/// \brief Get a unique instance of Type T from IrContext. Note: For a
/// paramet
e
ric_type, if not found in IrContext, it will try to create a new
/// parametric_type, if not found in IrContext, it will try to create a new
/// instance and register it to IrContext; for a parameterless type, only
/// search.
///
...
...
test/cpp/ir/ir_attribute_test.cc
浏览文件 @
e916e80c
...
...
@@ -45,7 +45,7 @@ TEST(attribute_test, attribute_base) {
TEST
(
attribute_test
,
built_in_attribute
)
{
ir
::
IrContext
*
ctx
=
ir
::
IrContext
::
Instance
();
// Test 1: Test the paramet
e
ric built-in attribute of IrContext.
// Test 1: Test the parametric built-in attribute of IrContext.
std
::
string
str_tmp
=
"string_a"
;
ir
::
Attribute
string_attr_1
=
ir
::
StrAttribute
::
get
(
ctx
,
str_tmp
);
ir
::
Attribute
string_attr_2
=
ir
::
StrAttribute
::
get
(
ctx
,
str_tmp
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录