| 733 | } |
| 734 | |
| 735 | void ChannelImpl::produce_tensor(TensorInfo* dest, TensorPtr ptr) { |
| 736 | auto& state = get_worker_state(); |
| 737 | MGB_LOCK_GUARD(m_mutex); |
| 738 | MGB_LOCK_GUARD(m_info_spin); |
| 739 | m_dtr.update_used_time(dest); |
| 740 | MGB_RECORD_EVENT( |
| 741 | TensorProduceEvent, dest->id, ptr->layout(), ptr->comp_node(), |
| 742 | ptr->raw_ptr_not_for_readwrite()); |
| 743 | // update tensor desc for static infer |
| 744 | dest->update_layout(ptr->layout()); |
| 745 | // in order to avoid performance impact, |
| 746 | // memory forwarding is disabled when DTR is enabled |
| 747 | if (state.options.enable_dtr_auto_drop || state.options.disable_memory_forwarding) { |
| 748 | ptr->to_contiguous_inplace(); |
| 749 | } |
| 750 | dest->desc.comp_node = ptr->comp_node(); |
| 751 | dest->memory = ptr->blob()->size(); |
| 752 | dest->ptr = std::move(ptr); |
| 753 | dest->evict_type = EvictType::NONE; |
| 754 | dest->status = TensorInfo::Produced; |
| 755 | if (dest->pinned == 0 && |
| 756 | dest->size_exceeds_thd(state.options.dtr_evictee_minimum_size)) { |
| 757 | m_dtr.insert_candidate(dest); |
| 758 | } |
| 759 | notify_tensor_unsafe(dest); |
| 760 | } |
| 761 | |
| 762 | void ChannelImpl::release_tensor(TensorInfo* dest) { |
| 763 | MGB_RECORD_EVENT(TensorReleaseEvent, dest->id); |
nothing calls this directly
no test coverage detected