| 464 | } |
| 465 | |
| 466 | void ComputingGraphImpl::ComputingSequence::on_first_exec() { |
| 467 | mgb_assert(m_first_exec); |
| 468 | for (auto i : *m_opr_seq) { |
| 469 | for (auto j : i->output()) |
| 470 | m_used_comp_node.insert(j->comp_node()); |
| 471 | } |
| 472 | |
| 473 | // we maintain a recorder because events may depend on whether recorder |
| 474 | // is enabled |
| 475 | auto recorder = check_enable_comp_node_seq_recorder(); |
| 476 | auto&& options = m_owner_graph->options(); |
| 477 | //! The recorder in comp_node is thread_local, so the create thread should |
| 478 | //! the same as the execute thread, so set the Synchronize mode |
| 479 | if (m_enable_comp_node_seq_recorder) { |
| 480 | m_exec_env.set_async_level(0); |
| 481 | } else { |
| 482 | m_exec_env.set_async_level(options.async_exec_level); |
| 483 | } |
| 484 | if (options.async_exec_level) { |
| 485 | for (auto i : m_used_comp_node) |
| 486 | m_exec_env.add_comp_node(i); |
| 487 | } |
| 488 | |
| 489 | // create events for timing and sync |
| 490 | for (auto&& i : m_used_comp_node) { |
| 491 | size_t flag = 0; |
| 492 | if (!m_have_parent_graph) { |
| 493 | flag = CompNode::Event::NEED_TIMER; |
| 494 | m_event_start[i] = i.create_event(flag); |
| 495 | } |
| 496 | m_event_end[i] = i.create_event(flag); |
| 497 | } |
| 498 | m_first_exec = false; |
| 499 | } |
| 500 | |
| 501 | AsyncExecutable& ComputingGraphImpl::ComputingSequence::execute() { |
| 502 | check_not_finalized(); |
nothing calls this directly
no test coverage detected