| 59 | return iter->second->onGetLastGpuTimeMs(); |
| 60 | } |
| 61 | std::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 | |
| 84 | void Executor::gc(GCFlag flag) { |
| 85 | int level = flag == FULL ? 100 : 0; |
no test coverage detected