| 121 | |
| 122 | #if !MGB_THREAD_SAFE |
| 123 | size_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 ========================== */ |