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

Method do_device_wait_by

src/core/impl/comp_node/rocm/comp_node.cpp:527–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525}
526
527void ROCmCompNode::EventImpl::do_device_wait_by(Impl* cn_impl) {
528 if (cn_impl->dyn_typeinfo() == ROCmCompNodeImpl::typeinfo()) {
529 auto imp = static_cast<ROCmCompNodeImpl*>(cn_impl);
530 auto stream = imp->m_env.rocm_env().stream;
531 imp->activate();
532 MGB_ROCM_CHECK(hipStreamWaitEvent(stream, m_hip_event, 0));
533 return;
534 }
535 if (cn_impl->env().property().type == DeviceType::CPU) {
536 auto waiter = [this]() { MGB_ROCM_CHECK(hipEventSynchronize(m_hip_event)); };
537 cn_impl->add_callback(std::move(waiter));
538 return;
539 }
540 mgb_throw(MegBrainError, "unimplemented event device_wait_by config");
541}
542
543/* ===================== ROCmCompNode static methods ===================== */
544

Callers

nothing calls this directly

Calls 3

activateMethod · 0.45
propertyMethod · 0.45
add_callbackMethod · 0.45

Tested by

no test coverage detected