未验证 提交 127488ba 编写于 作者: A Aurelius84 提交者: GitHub

Add kQueueSync.synchronize_run_ logic (#36546)

上级 fe01ba6a
...@@ -410,13 +410,14 @@ void InterpreterCore::RunNextInstruction(const Instruction& instr) { ...@@ -410,13 +410,14 @@ void InterpreterCore::RunNextInstruction(const Instruction& instr) {
[&, next_id] { RunInstructionAsync(next_id); }); [&, next_id] { RunInstructionAsync(next_id); });
} }
} }
auto direct_run_ops = interpretercore::merge_vector(
for (size_t i = 0; i < next_instr.direct_run_.size(); ++i) { next_instr.synchronize_run_, next_instr.direct_run_);
auto next_id = next_instr.direct_run_[i]; size_t first_op = 0;
for (auto next_id : direct_run_ops) {
if (IsReady(next_id)) { if (IsReady(next_id)) {
// only keep one op running in current thread // only keep one op running in current thread
if (i == 0) { if (first_op == 0) {
RunInstructionAsync(next_id); first_op = next_id;
continue; continue;
} }
// move rest ops into other threads // move rest ops into other threads
...@@ -425,6 +426,7 @@ void InterpreterCore::RunNextInstruction(const Instruction& instr) { ...@@ -425,6 +426,7 @@ void InterpreterCore::RunNextInstruction(const Instruction& instr) {
[&, next_id] { RunInstructionAsync(next_id); }); [&, next_id] { RunInstructionAsync(next_id); });
} }
} }
if (first_op != 0) RunInstructionAsync(first_op);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册