|
|
@@ -125,7 +125,7 @@ StaticDeviceMemoryManager::make_default_impl() { |
|
|
|
#endif // MGB_THREAD_SAFE |
|
|
|
|
|
|
|
/* ==================== AsyncVarReleaser ==================== */ |
|
|
|
#if MGB_CUDA || MGB_ATLAS || MGB_CAMBRICON || MGB_ROCM |
|
|
|
#if MGB_COMMON_ASYNC_COMPNODE |
|
|
|
class VarNodeMemManager::AsyncVarReleaser { |
|
|
|
struct WaiterParam { |
|
|
|
CompNode cn; |
|
|
@@ -248,7 +248,7 @@ bool VarNodeMemManager::ImpureMemPlanManager::check_need_realloc() { |
|
|
|
VarNodeMemManager::VarNodeMemManager(ComputingGraphImpl* graph) |
|
|
|
: m_owner_graph(graph), |
|
|
|
m_seq_mem_opt(graph) |
|
|
|
#if MGB_CUDA || MGB_ATLAS || MGB_CAMBRICON || MGB_ROCM |
|
|
|
#if MGB_COMMON_ASYNC_COMPNODE |
|
|
|
,m_asyn_var_releaser(new AsyncVarReleaser) |
|
|
|
#endif |
|
|
|
{ |
|
|
@@ -256,7 +256,7 @@ VarNodeMemManager::VarNodeMemManager(ComputingGraphImpl* graph) |
|
|
|
MGB_MARK_USED_VAR(ev); |
|
|
|
// async release is only used for sync between multiple comp nodes, and |
|
|
|
// does not wait for device to finish |
|
|
|
#if MGB_CUDA || MGB_ATLAS || MGB_CAMBRICON || MGB_ROCM |
|
|
|
#if MGB_COMMON_ASYNC_COMPNODE |
|
|
|
m_asyn_var_releaser->wait_release_finish(); |
|
|
|
#endif |
|
|
|
m_cpu_async_release_barrier.wait_zero(); |
|
|
@@ -297,8 +297,7 @@ VarNodeMemManager::VarNodeMemManager(ComputingGraphImpl* graph) |
|
|
|
graph->event().register_receiver_permanent<event::CompSeqExecError>( |
|
|
|
on_comp_seq_error); |
|
|
|
|
|
|
|
#if MGB_ENABLE_VAR_DEV_MEM_DEFRAGMENTER && \ |
|
|
|
(MGB_CUDA || MGB_ATLAS || MGB_CAMBRICON || MGB_ROCM) |
|
|
|
#if MGB_ENABLE_VAR_DEV_MEM_DEFRAGMENTER && MGB_COMMON_ASYNC_COMPNODE |
|
|
|
auto on_mem_defrag_start = [this](const event::BeforeMemDefrag&) { |
|
|
|
m_asyn_var_releaser->wait_release_finish(); |
|
|
|
}; |
|
|
|