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

Method alloc

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

Source from the content-addressed store, hash-verified

625}
626
627TensorInfo* ChannelImpl::alloc() {
628 auto& state = get_channel_state();
629 auto info = [this] {
630 MGB_LOCK_GUARD(m_pool_spin);
631 return m_pool.alloc();
632 }();
633 info->id = Profiler::next_id();
634 if (Profiler::is_profiling()) {
635 size_t tensor_id = state.stack_manager.current()->next_id("tensor");
636 info->name =
637 state.stack_manager.dump().to_string() + ssprintf(":%zu", tensor_id);
638 }
639 return info;
640}
641
642void ChannelImpl::init(TensorInfo* info, LogicalTensorDesc&& desc) {
643 m_valid_handle.insert(reinterpret_cast<Handle>(info));

Callers 1

do_new_handleMethod · 0.45

Calls 5

is_profilingFunction · 0.85
currentMethod · 0.80
next_idMethod · 0.45
to_stringMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected