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

Method alloc_direct

src/core/impl/graph/var_node_mem_mgr/defrag.cpp:8–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6using namespace cg;
7
8void VarDevMemDefragmenter::alloc_direct(
9 VarNode* var, DeviceTensorStorage& storage, size_t size) {
10 if (!storage.comp_node_valid())
11 storage.comp_node(var->comp_node());
12 if (size > storage.size()) {
13 m_mem_mgr->static_device_memory_manager()->allocator().alloc_dynamic(
14 var, storage, size);
15 storage.ptr(); // apply lazy alloc
16 }
17 mgb_assert(storage.size() >= size);
18}
19
20#if MGB_ENABLE_VAR_DEV_MEM_DEFRAGMENTER
21

Callers

nothing calls this directly

Calls 6

comp_node_validMethod · 0.80
comp_nodeMethod · 0.45
sizeMethod · 0.45
alloc_dynamicMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected