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

Method do_device_wait_by

src/core/impl/comp_node/cambricon/comp_node.cpp:590–604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588}
589
590void CambriconCompNode::EventImpl::do_device_wait_by(Impl* cn_impl) {
591 if (cn_impl->dyn_typeinfo() == CambriconCompNodeImpl::typeinfo()) {
592 auto imp = static_cast<CambriconCompNodeImpl*>(cn_impl);
593 auto queue = imp->m_env.cnrt_env().queue;
594 imp->activate();
595 MGB_CNRT_CHECK(cnrtQueueWaitNotifier(m_cnrt_notifier, queue, 0));
596 return;
597 }
598 if (cn_impl->env().property().type == DeviceType::CPU) {
599 auto waiter = [this]() { MGB_CNRT_CHECK(cnrtWaitNotifier(m_cnrt_notifier)); };
600 cn_impl->add_callback(std::move(waiter));
601 return;
602 }
603 mgb_throw(MegBrainError, "unimplemented event device_wait_by config");
604}
605
606/* ================== CambriconCompNode static methods ================*/
607

Callers

nothing calls this directly

Calls 3

activateMethod · 0.45
propertyMethod · 0.45
add_callbackMethod · 0.45

Tested by

no test coverage detected