MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / start_exec

Method start_exec

src/core/impl/graph/normal_exec_env.cpp:122–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void NormalExecEnv::start_exec() {
123#if MGB_HAVE_THREAD
124 resume_exec();
125#endif
126
127 if (m_async_level) {
128 mgb_assert(!m_worker_task_queue.empty());
129 if (m_worker_task_queue.size() > 1 || (m_async_level & 0b100)) {
130 if (m_worker_set.empty()) {
131 // init async dispatch workers
132 for (auto&& i : m_worker_task_queue) {
133 auto runner = [this, cn = i.first]() {
134 run_task_seq<true>(m_worker_task_queue.at(cn));
135 };
136 m_worker_set.add_worker(
137 "comp_node_dispatch:" + i.first.to_string(), runner);
138 }
139 }
140 m_worker_set.start();
141 } else {
142 run_task_seq<false>(m_worker_task_queue.begin()->second);
143 }
144 } else {
145 run_task_seq<false>(m_sync_task_queue);
146 }
147}
148
149void NormalExecEnv::wait_all() {
150 if (!m_worker_task_queue.empty()) {

Callers 2

performMethod · 0.80

Calls 7

emptyMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45
add_workerMethod · 0.45
to_stringMethod · 0.45
startMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected