Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
404a4a6a
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
404a4a6a
编写于
12月 28, 2021
作者:
L
Leo Chen
提交者:
GitHub
12月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[new-exec] add completion_nofifier (#38447)
* add completion_nofifier * fix bug * unregist event waiter
上级
1db61c3e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
11 deletion
+18
-11
paddle/fluid/framework/new_executor/interpretercore.cc
paddle/fluid/framework/new_executor/interpretercore.cc
+14
-8
paddle/fluid/framework/new_executor/interpretercore.h
paddle/fluid/framework/new_executor/interpretercore.h
+2
-1
paddle/fluid/framework/new_executor/interpretercore_util.h
paddle/fluid/framework/new_executor/interpretercore_util.h
+2
-2
未找到文件。
paddle/fluid/framework/new_executor/interpretercore.cc
浏览文件 @
404a4a6a
...
...
@@ -30,6 +30,7 @@ DECLARE_bool(check_nan_inf);
DECLARE_bool
(
benchmark
);
constexpr
const
char
*
kExceptionCaught
=
"ExceptionCaught"
;
constexpr
const
char
*
kTaskCompletion
=
"TaskCompletion"
;
namespace
paddle
{
namespace
framework
{
...
...
@@ -49,6 +50,7 @@ InterpreterCore::InterpreterCore(const platform::Place& place,
gc_
.
reset
(
new
InterpreterCoreGarbageCollector
());
exception_notifier_
=
main_thread_blocker_
.
RegisterEvent
(
kExceptionCaught
);
completion_notifier_
=
main_thread_blocker_
.
RegisterEvent
(
kTaskCompletion
);
create_local_scope_
=
FLAGS_new_executor_use_local_scope
;
if
(
FLAGS_new_executor_use_local_scope
)
{
...
...
@@ -69,6 +71,9 @@ InterpreterCore::~InterpreterCore() {
// cancle gc's thread
gc_
.
reset
(
nullptr
);
exception_notifier_
->
UnregisterEvent
();
completion_notifier_
->
UnregisterEvent
();
async_work_queue_
.
reset
(
nullptr
);
}
...
...
@@ -417,7 +422,7 @@ void InterpreterCore::ExecuteInstructionList(
const
std
::
vector
<
Instruction
>&
vec_instr
)
{
async_work_queue_
->
PrepareAtomicDeps
(
dependecy_count_
);
async_work_queue_
->
PrepareAtomicVarRef
(
global_scope_
->
VecMetaInfo
());
op_run_number_
=
0
;
unfinished_op_numer_
=
vec_instr
.
size
()
;
exception_holder_
.
Clear
();
...
...
@@ -436,12 +441,6 @@ void InterpreterCore::ExecuteInstructionList(
async_work_queue_
->
Cancel
();
exception_holder_
.
ReThrow
();
}
PADDLE_ENFORCE_EQ
(
op_run_number_
.
load
(),
vec_instr
.
size
(),
platform
::
errors
::
Fatal
(
"Required op_run_number == %d, but received op_run_number = %d."
,
vec_instr
.
size
(),
op_run_number_
.
load
()));
}
void
InterpreterCore
::
RunNextInstructions
(
...
...
@@ -539,8 +538,15 @@ void InterpreterCore::RunInstructionAsync(size_t instr_id) {
return
;
}
VLOG
(
4
)
<<
"unfinished_op_numer_: "
<<
unfinished_op_numer_
;
if
(
UNLIKELY
(
unfinished_op_numer_
.
fetch_sub
(
1
,
std
::
memory_order_relaxed
)
==
1
))
{
if
(
completion_notifier_
!=
nullptr
)
{
completion_notifier_
->
NotifyEvent
();
}
}
interpreter
::
RecordEvent
(
instr_node
,
place_
);
op_run_number_
.
fetch_add
(
1
,
std
::
memory_order_relaxed
);
RunNextInstructions
(
instr_node
,
&
ready_ops
);
}
...
...
paddle/fluid/framework/new_executor/interpretercore.h
浏览文件 @
404a4a6a
...
...
@@ -101,7 +101,7 @@ class InterpreterCore {
std
::
vector
<
Instruction
>
vec_instruction_
;
// deconstruct before OpFuncNode
std
::
vector
<
size_t
>
dependecy_count_
;
std
::
atomic
<
size_t
>
op_run_numb
er_
{
0
};
std
::
atomic
<
size_t
>
unfinished_op_num
er_
{
0
};
std
::
vector
<
std
::
vector
<
size_t
>>
input_var2op_info_
;
StreamAnalyzer
stream_analyzer_
;
...
...
@@ -109,6 +109,7 @@ class InterpreterCore {
std
::
unique_ptr
<
interpreter
::
AsyncWorkQueue
>
async_work_queue_
;
details
::
ExceptionHolder
exception_holder_
;
std
::
shared_ptr
<
EventsWaiter
::
EventNotifier
>
exception_notifier_
{
nullptr
};
std
::
shared_ptr
<
EventsWaiter
::
EventNotifier
>
completion_notifier_
{
nullptr
};
std
::
unique_ptr
<
InterpreterCoreGarbageCollector
>
gc_
;
std
::
vector
<
paddle
::
platform
::
DeviceEvent
>
gc_event_
;
...
...
paddle/fluid/framework/new_executor/interpretercore_util.h
浏览文件 @
404a4a6a
...
...
@@ -60,13 +60,13 @@ class AsyncWorkQueue {
// for execute host Kernel
group_options
.
emplace_back
(
/*num_threads*/
host_num_threads
,
/*allow_spinning*/
true
,
/*track_task*/
tru
e
,
/*track_task*/
fals
e
,
/*detached*/
true
,
/*events_waiter*/
waiter
);
// for launch device Kernel
group_options
.
emplace_back
(
/*num_threads*/
1
,
/*allow_spinning*/
true
,
/*track_task*/
tru
e
,
/*track_task*/
fals
e
,
/*detached*/
true
,
/*events_waiter*/
waiter
);
queue_group_
=
CreateWorkQueueGroup
(
group_options
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录