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

Method cleanup

src/core/impl/graph/cg_impl_seq.cpp:415–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415void ComputingGraphImpl::ComputingSequence::cleanup() {
416#if !__DEPLOY_ON_XP_SP2__
417 m_var_sanity_check.reset();
418#endif
419 if (has_uncaught_exception()) {
420 mgb_log_warn(
421 "fallback to simple graph waiting in dtor due to uncaught "
422 "exceptions");
423 if (!m_wait_finished) {
424 MGB_TRY {
425 for (auto&& i : m_used_comp_node) {
426 i.sync();
427 }
428 }
429 MGB_CATCH(..., {})
430 }
431 } else {
432 wait();
433 }
434 if (m_owner_graph->m_current_comp_seq == this) {
435 m_owner_graph->m_current_comp_seq = nullptr;
436 MGB_TRY { m_owner_graph->clear_device_memory(); }
437 MGB_CATCH(std::exception & exc, {
438 mgb_log_error("failed to clear device memory: %s", exc.what());
439 });
440 }
441
442 // ensure clear user data before destructing m_owner_graph
443 user_data().clear_all_user_data();

Callers 1

attach_to_graphMethod · 0.45

Calls 5

MGB_CATCHFunction · 0.70
resetMethod · 0.45
syncMethod · 0.45
clear_device_memoryMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected