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

Method produce_tensor

imperative/src/impl/interpreter/interpreter_impl.cpp:735–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733}
734
735void 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
762void ChannelImpl::release_tensor(TensorInfo* dest) {
763 MGB_RECORD_EVENT(TensorReleaseEvent, dest->id);

Callers

nothing calls this directly

Calls 10

update_used_timeMethod · 0.80
update_layoutMethod · 0.80
to_contiguous_inplaceMethod · 0.80
blobMethod · 0.80
size_exceeds_thdMethod · 0.80
insert_candidateMethod · 0.80
layoutMethod · 0.45
comp_nodeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected