| 625 | } |
| 626 | |
| 627 | TensorInfo* 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 | |
| 642 | void ChannelImpl::init(TensorInfo* info, LogicalTensorDesc&& desc) { |
| 643 | m_valid_handle.insert(reinterpret_cast<Handle>(info)); |
no test coverage detected