| 34 | } |
| 35 | |
| 36 | void VarDevMemDefragmenter::alloc_with_defrag( |
| 37 | VarNode* var, DeviceTensorStorage& storage, size_t size) { |
| 38 | CompNodeInfo* cninfo_ptr; |
| 39 | { |
| 40 | MGB_LOCK_GUARD(m_mtx); |
| 41 | cninfo_ptr = &m_cninfo_map[var->comp_node()]; |
| 42 | } |
| 43 | MGB_LOCK_GUARD(cninfo_ptr->mtx); |
| 44 | |
| 45 | if (!storage.comp_node_valid()) { |
| 46 | storage.comp_node(var->comp_node()); |
| 47 | cninfo_ptr->vars.insert(var); |
| 48 | } |
| 49 | |
| 50 | MGB_TRY { alloc_direct(var, storage, size); } |
| 51 | MGB_CATCH(MemAllocError&, { |
| 52 | mgb_log_warn( |
| 53 | "memory allocation failed for var %s; try defragmenting", var->cname()); |
nothing calls this directly
no test coverage detected