未验证 提交 fe8acb67 编写于 作者: F From00 提交者: GitHub

Determine execution sequence of random OPs in new executor (#41012)

上级 5728dffb
...@@ -685,6 +685,22 @@ std::map<int, std::list<int>> build_op_downstream_map( ...@@ -685,6 +685,22 @@ std::map<int, std::list<int>> build_op_downstream_map(
} }
} }
} }
// add dependences for random op, make sure that the random op is scheduled
// sequentially
const std::set<std::string> random_op_set = {
"bernoulli", "poisson", "multinomial", "gaussian_random",
"uniform_random", "randint", "randperm", "exponential"};
int dependence_op_idx = -1;
for (size_t op_idx = 0; op_idx < vec_instruction.size(); ++op_idx) {
if (random_op_set.count(vec_instruction[op_idx].OpBase()->Type())) {
if (dependence_op_idx != -1) {
op2dependences[op_idx].insert(dependence_op_idx);
}
dependence_op_idx = op_idx;
}
}
return std::move(get_downstream_map(op2dependences)); return std::move(get_downstream_map(op2dependences));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册