Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
210130133
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2021
210130133
Commits
7ee0d54c
Commit
7ee0d54c
authored
5 years ago
by
Juncheng
Committed by
Niu Chong
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Dev kernel launch synchronized (#2230)
* IsKernelLaunchSynchronized * virtual * refine * refine
parent
2d813ffb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
oneflow/core/actor/actor.cpp
+8
-2
8 additions, 2 deletions
oneflow/core/actor/actor.cpp
oneflow/core/actor/actor.h
+1
-0
1 addition, 0 deletions
oneflow/core/actor/actor.h
oneflow/core/kernel/kernel.h
+6
-0
6 additions, 0 deletions
oneflow/core/kernel/kernel.h
with
15 additions
and
2 deletions
oneflow/core/actor/actor.cpp
+
8
−
2
View file @
7ee0d54c
...
...
@@ -46,6 +46,11 @@ void Actor::Init(const JobDesc* job_desc, const TaskProto& task_proto,
exec_kernel_vec_
.
push_back
(
std
::
move
(
ek
));
}
is_kernel_launch_synchronized_
=
std
::
all_of
(
exec_kernel_vec_
.
cbegin
(),
exec_kernel_vec_
.
cend
(),
[](
const
ExecKernel
&
ek
)
{
return
ek
.
kernel
->
IsKernelLaunchSynchronized
();
});
if
(
!
is_kernel_launch_synchronized_
)
{
CHECK_EQ
(
exec_kernel_vec_
.
size
(),
1
);
}
remaining_eord_cnt_
=
0
;
msg_handler_
=
nullptr
;
eord_regst_desc_ids_
.
clear
();
...
...
@@ -618,8 +623,9 @@ int Actor::TryUpdtStateAsProducedRegst(Regst* regst) {
}
void
Actor
::
EnqueueAsyncMsg
(
const
ActorMsg
&
msg
)
{
if
(
GetGlobalWorkStreamId
()
==
Global
<
IDMgr
>::
Get
()
->
GlobalWorkStreamId4ActorId
(
msg
.
dst_actor_id
()))
{
if
(
is_kernel_launch_synchronized_
&&
GetGlobalWorkStreamId
()
==
Global
<
IDMgr
>::
Get
()
->
GlobalWorkStreamId4ActorId
(
msg
.
dst_actor_id
()))
{
Global
<
ActorMsgBus
>::
Get
()
->
SendMsg
(
msg
);
}
else
{
async_msg_queue_
.
push_back
(
msg
);
...
...
This diff is collapsed.
Click to expand it.
oneflow/core/actor/actor.h
+
1
−
0
View file @
7ee0d54c
...
...
@@ -230,6 +230,7 @@ class Actor {
HashMap
<
int64_t
,
int64_t
>
inplace_regst_desc_id_out2in_
;
std
::
deque
<
ActorMsg
>
async_msg_queue_
;
bool
is_kernel_launch_synchronized_
;
};
std
::
unique_ptr
<
Actor
>
NewActor
(
const
TaskProto
&
,
const
ThreadCtx
&
);
...
...
This diff is collapsed.
Click to expand it.
oneflow/core/kernel/kernel.h
+
6
−
0
View file @
7ee0d54c
...
...
@@ -31,6 +31,12 @@ class Kernel {
const
LogicalBlobId
&
BnInOp2Lbi
(
const
std
::
string
&
bn_in_op
)
const
;
const
OperatorConf
&
op_conf
()
const
{
return
op_attribute
().
op_conf
();
}
const
OpAttribute
&
op_attribute
()
const
{
return
kernel_conf
().
op_attribute
();
}
/*
* return true means all below must be guaranteed when `Launch` function return:
* 1) all out blob header has been set (e.g. SyncSetHeadKernel)
* 2) all asynchronous task has been queued (e.g. NCCL related kernel)
*/
virtual
bool
IsKernelLaunchSynchronized
()
const
{
return
true
;
}
protected
:
Kernel
()
=
default
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment