Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sequantial callback instruction #4503

Merged
merged 8 commits into from
Mar 25, 2021
Merged

Conversation

lixinqi
Copy link
Contributor

@lixinqi lixinqi commented Mar 24, 2021

本pr提供顺序化回调指令。
原本的设计里,由于虚拟机是数据驱动的,指令之间只有简单的数据依赖关系,并没有谁先来谁后来的关系。现在加入了诸如RankSequantialInferCallback/RankSequantialComputeCallback专门用于同步推导和计算。

@daquexian

This comment has been minimized.

@daquexian
Copy link
Contributor

哦哦,看到了 441 行的 break 处理了这个顺序依赖关系

@daquexian
Copy link
Contributor

如果指令序列是 A B C,B 是 sequential 指令,C 应该等待 B 的 callback 执行结束再执行吗

@@ -219,6 +221,8 @@ OBJECT_MSG_BEGIN(Instruction);
// links
OBJECT_MSG_DEFINE_LIST_LINK(instruction_link);
OBJECT_MSG_DEFINE_LIST_LINK(pending_instruction_link);
OBJECT_MSG_DEFINE_LIST_LINK(sequantial_infer_instr_link);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里有个 typo,sequential

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@lixinqi
Copy link
Contributor Author

lixinqi commented Mar 25, 2021

如果指令序列是 A B C,B 是 sequential 指令,C 应该等待 B 的 callback 执行结束再执行吗

不等待,所以才叫回调,否则应该叫barrier。

@@ -72,7 +84,8 @@ void VirtualMachine::FilterAndRunSourceInstructions(TmpPendingInstrMsgList* inst
OBJECT_MSG_LIST_FOR_EACH_PTR(instr_msg_list, instr_msg) {
const auto& instr_type_id = instr_msg->instr_type_id();
const StreamType& stream_type = instr_type_id.stream_type_id().stream_type();
if (stream_type.SharingVirtualMachineThread() && IsSourceInstruction(*instr_msg)) {
if (stream_type.SharingVirtualMachineThread()
&& !instr_type_id.instruction_type().IsSequential() && IsSourceInstruction(*instr_msg)) {
Copy link
Contributor Author

@lixinqi lixinqi Mar 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sequential指令基本都是source instruction。但是此处的source instruction执行一定要排除它,否则就是失去了sequential的意义。

@oneflow-ci-bot oneflow-ci-bot removed their request for review March 25, 2021 11:38
@oneflow-ci-bot oneflow-ci-bot merged commit a6d0307 into master Mar 25, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the sequantial_instruction branch March 25, 2021 11:39
liujuncheng pushed a commit that referenced this pull request Jun 3, 2021
* add sequantial callback instruction

* add a test_case for sequential instruction type

* refactor RunLogicalInstruction/RunPhysicalInstruction

* refactor RunLogicalInstruction/RunPhysicalInstruction

Former-commit-id: a6d0307
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants