Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c595655b
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看板
未验证
提交
c595655b
编写于
6月 12, 2023
作者:
W
winter-wang
提交者:
GitHub
6月 12, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IR] add positon member in block. (#54565)
上级
7d688871
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
19 deletion
+27
-19
paddle/ir/core/block.cc
paddle/ir/core/block.cc
+6
-0
paddle/ir/core/block.h
paddle/ir/core/block.h
+7
-3
paddle/ir/core/operation.cc
paddle/ir/core/operation.cc
+5
-0
paddle/ir/core/operation.h
paddle/ir/core/operation.h
+2
-4
paddle/ir/core/region.cc
paddle/ir/core/region.cc
+7
-12
未找到文件。
paddle/ir/core/block.cc
浏览文件 @
c595655b
...
...
@@ -38,4 +38,10 @@ void Block::clear() {
ops_
.
pop_back
();
}
}
void
Block
::
SetParent
(
Region
*
parent
,
Region
::
iterator
position
)
{
parent_
=
parent
;
position_
=
position
;
}
}
// namespace ir
paddle/ir/core/block.h
浏览文件 @
c595655b
...
...
@@ -17,8 +17,9 @@
#include <cstddef>
#include <list>
#include "paddle/ir/core/region.h"
namespace
ir
{
class
Region
;
class
Operation
;
class
Block
{
...
...
@@ -47,16 +48,19 @@ class Block {
void
push_front
(
Operation
*
op
);
iterator
insert
(
const_iterator
iterator
,
Operation
*
op
);
void
clear
();
operator
Region
::
iterator
()
{
return
position_
;
}
private:
Block
(
Block
&
)
=
delete
;
Block
&
operator
=
(
const
Block
&
)
=
delete
;
// Allow access to 'SetParent'.
friend
class
Region
;
void
SetParent
(
Region
*
parent
)
{
parent_
=
parent
;
}
void
SetParent
(
Region
*
parent
,
Region
::
iterator
position
);
private:
Region
*
parent_
;
// not owned
Region
*
parent_
;
// not owned
Region
::
iterator
position_
;
std
::
list
<
Operation
*>
ops_
;
// owned
};
}
// namespace ir
paddle/ir/core/operation.cc
浏览文件 @
c595655b
...
...
@@ -236,4 +236,9 @@ Region &Operation::GetRegion(unsigned index) {
return
regions_
[
index
];
}
void
Operation
::
SetParent
(
Block
*
parent
,
const
Block
::
iterator
&
position
)
{
parent_
=
parent
;
position_
=
position
;
}
}
// namespace ir
paddle/ir/core/operation.h
浏览文件 @
c595655b
...
...
@@ -112,11 +112,9 @@ class alignas(8) Operation final {
}
};
// Allow access to 'SetParent'.
friend
class
Block
;
void
SetParent
(
Block
*
parent
,
const
Block
::
iterator
&
position
)
{
parent_
=
parent
;
position_
=
position
;
}
void
SetParent
(
Block
*
parent
,
const
Block
::
iterator
&
position
);
template
<
typename
T
>
struct
CastUtil
<
...
...
paddle/ir/core/region.cc
浏览文件 @
c595655b
...
...
@@ -18,27 +18,22 @@
namespace
ir
{
Region
::~
Region
()
{
clear
();
}
void
Region
::
push_back
(
Block
*
block
)
{
block
->
SetParent
(
this
);
blocks_
.
push_back
(
block
);
}
void
Region
::
push_back
(
Block
*
block
)
{
insert
(
blocks_
.
end
(),
block
);
}
void
Region
::
emplace_back
()
{
push_back
(
new
Block
);
}
void
Region
::
push_front
(
Block
*
block
)
{
block
->
SetParent
(
this
);
blocks_
.
push_front
(
block
);
}
void
Region
::
push_front
(
Block
*
block
)
{
insert
(
blocks_
.
begin
(),
block
);
}
Region
::
iterator
Region
::
insert
(
const_iterator
position
,
Block
*
block
)
{
block
->
SetParent
(
this
);
return
blocks_
.
insert
(
position
,
block
);
Region
::
iterator
iter
=
blocks_
.
insert
(
position
,
block
);
block
->
SetParent
(
this
,
iter
);
return
iter
;
}
void
Region
::
TakeBody
(
Region
&&
other
)
{
clear
();
blocks_
.
swap
(
other
.
blocks_
);
for
(
auto
&
block
:
blocks_
)
{
block
->
SetParent
(
this
);
for
(
auto
iter
=
blocks_
.
begin
();
iter
!=
blocks_
.
end
();
++
iter
)
{
(
*
iter
)
->
SetParent
(
this
,
iter
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录