Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
7ebbcbbc
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
7ebbcbbc
编写于
9月 22, 2021
作者:
W
wanghuancoder
提交者:
GitHub
9月 22, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add no need buffer check, test=develop (#35790)
上级
7ba69249
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
1 deletion
+29
-1
paddle/fluid/framework/new_executor/interpretercore.cc
paddle/fluid/framework/new_executor/interpretercore.cc
+27
-1
paddle/fluid/framework/new_executor/interpretercore.h
paddle/fluid/framework/new_executor/interpretercore.h
+2
-0
未找到文件。
paddle/fluid/framework/new_executor/interpretercore.cc
浏览文件 @
7ebbcbbc
...
@@ -209,6 +209,23 @@ void InterpreterCore::Convert() {
...
@@ -209,6 +209,23 @@ void InterpreterCore::Convert() {
}
}
}
}
bool
InterpreterCore
::
BuildInplaceCheckVarIsOnlyInput
(
size_t
var_index
)
{
if
(
!
global_scope_
->
vec_meta_info_
[
var_index
].
vardesc_
)
{
return
input_var2op_info_
[
var_index
].
size
()
==
1
;
}
else
{
int
is_input_cnt
=
0
;
for
(
auto
inst_id
:
input_var2op_info_
[
var_index
])
{
OpInOutInfo
info
;
info
.
Build
(
vec_instruction_
[
inst_id
].
kernel_func_
.
operator_base_
);
if
(
info
.
IsInArgBufferNeeded
(
global_scope_
->
vec_meta_info_
[
var_index
].
vardesc_
->
Name
()))
{
is_input_cnt
++
;
}
}
return
is_input_cnt
==
1
;
}
}
void
InterpreterCore
::
BuildInplace
()
{
void
InterpreterCore
::
BuildInplace
()
{
for
(
size_t
i
=
0
;
i
<
vec_instruction_
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
vec_instruction_
.
size
();
++
i
)
{
if
(
!
vec_instruction_
[
i
]
if
(
!
vec_instruction_
[
i
]
...
@@ -224,7 +241,7 @@ void InterpreterCore::BuildInplace() {
...
@@ -224,7 +241,7 @@ void InterpreterCore::BuildInplace() {
for
(
auto
&
pair
:
in_to_outs
)
{
for
(
auto
&
pair
:
in_to_outs
)
{
auto
iter
=
vec_instruction_
[
i
].
input_index_
.
find
(
pair
.
first
);
auto
iter
=
vec_instruction_
[
i
].
input_index_
.
find
(
pair
.
first
);
if
(
iter
!=
vec_instruction_
[
i
].
input_index_
.
end
())
{
if
(
iter
!=
vec_instruction_
[
i
].
input_index_
.
end
())
{
if
(
input_var2op_info_
[
iter
->
second
[
0
]].
size
()
==
1
)
{
if
(
BuildInplaceCheckVarIsOnlyInput
(
iter
->
second
[
0
])
)
{
auto
iterout
=
vec_instruction_
[
i
].
output_index_
.
find
(
pair
.
second
);
auto
iterout
=
vec_instruction_
[
i
].
output_index_
.
find
(
pair
.
second
);
if
(
iterout
!=
vec_instruction_
[
i
].
output_index_
.
end
())
{
if
(
iterout
!=
vec_instruction_
[
i
].
output_index_
.
end
())
{
auto
invar
=
global_scope_
->
var_list
[
iter
->
second
[
0
]];
auto
invar
=
global_scope_
->
var_list
[
iter
->
second
[
0
]];
...
@@ -232,6 +249,15 @@ void InterpreterCore::BuildInplace() {
...
@@ -232,6 +249,15 @@ void InterpreterCore::BuildInplace() {
if
(
invar
&&
outvar
)
{
if
(
invar
&&
outvar
)
{
vec_instruction_
[
i
].
vec_inplace_in_to_out_
.
emplace_back
(
invar
,
vec_instruction_
[
i
].
vec_inplace_in_to_out_
.
emplace_back
(
invar
,
outvar
);
outvar
);
VLOG
(
3
)
<<
"inplace "
<<
vec_instruction_
[
i
].
kernel_func_
.
operator_base_
->
Type
()
<<
" "
<<
global_scope_
->
vec_meta_info_
[
iter
->
second
[
0
]]
.
vardesc_
->
Name
()
<<
" -> "
<<
global_scope_
->
vec_meta_info_
[
iterout
->
second
[
0
]]
.
vardesc_
->
Name
()
<<
std
::
endl
;
}
}
}
}
}
}
...
...
paddle/fluid/framework/new_executor/interpretercore.h
浏览文件 @
7ebbcbbc
...
@@ -57,6 +57,8 @@ class InterpreterCore {
...
@@ -57,6 +57,8 @@ class InterpreterCore {
void
BuildInplace
();
void
BuildInplace
();
bool
BuildInplaceCheckVarIsOnlyInput
(
size_t
var_index
);
void
RunInstruction
(
const
Instruction
&
instr_node
);
void
RunInstruction
(
const
Instruction
&
instr_node
);
void
ExecuteInstructionList
(
const
std
::
vector
<
Instruction
>&
vec_instr
);
void
ExecuteInstructionList
(
const
std
::
vector
<
Instruction
>&
vec_instr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录