MCPcopy Create free account
hub / github.com/alibaba/MNN / _getOrCreateRuntime

Method _getOrCreateRuntime

express/Executor.cpp:61–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 return iter->second->onGetLastGpuTimeMs();
60}
61std::shared_ptr<Runtime> Executor::_getOrCreateRuntime(MNNForwardType type, const BackendConfig* config, int numberThread, bool reset) {
62 auto iter = mRuntimeInfo.first.find(type);
63 if (iter != mRuntimeInfo.first.end()) {
64 iter->second->onReset(numberThread, config, reset);
65 return iter->second;
66 }
67 // Create Backend
68 auto cre = MNNGetExtraRuntimeCreator(type);
69 if (nullptr == cre) {
70 return nullptr;
71 }
72 Backend::Info info;
73 info.type = type;
74 info.mode = Backend::Info::DIRECT;
75 info.numThread = numberThread;
76 info.user = (BackendConfig*)config;
77 std::shared_ptr<Runtime> rt(cre->onCreate(info));
78 if (nullptr != rt) {
79 mRuntimeInfo.first.insert(std::make_pair(type, rt));
80 }
81 return rt;
82}
83
84void Executor::gc(GCFlag flag) {
85 int level = flag == FULL ? 100 : 0;

Callers 1

createRuntimeManagerMethod · 0.80

Calls 6

findMethod · 0.45
endMethod · 0.45
onResetMethod · 0.45
onCreateMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected