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

Method prealloc_static_storage

src/core/impl/graph/cg_impl.cpp:123–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121
122#if !MGB_THREAD_SAFE
123size_t ComputingGraph::prealloc_static_storage(size_t size) {
124 // note that in single-threaded mode, all cpus map to the same comp node
125 static int version = 0;
126 auto cn = CompNode::load("cpu0");
127 mgb_assert(cn == CompNode::load("cpu1"));
128 auto inst = StaticDeviceMemoryManager::make_default_impl();
129 auto ret = inst->get_size(cn);
130 inst->alloc(nullptr, cn, size, version).ptr();
131 version = inst->version(nullptr);
132 return ret;
133}
134#endif
135
136/* ========================== JITConfig ========================== */

Callers

nothing calls this directly

Calls 5

loadFunction · 0.50
get_sizeMethod · 0.45
ptrMethod · 0.45
allocMethod · 0.45
versionMethod · 0.45

Tested by

no test coverage detected