MCPcopy Create free account
hub / github.com/OAID/Tengine / RegisterOPImplementor

Method RegisterOPImplementor

executor/lib/node_ops.cpp:327–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327bool NodeOpsRegistryManager::RegisterOPImplementor(const std::string& registry_name, const std::string& op_name,
328 select_node_ops_t select_func, int priority)
329{
330 // TODO: Add Lock to protect find and register registry
331
332 auto registry = FindRegistry(registry_name);
333
334 if(registry == nullptr)
335 {
336 registry = new NodeOpsRegistry(registry_name);
337 NodeOpsRegistryManager::AddRegistry(registry->reg_name, registry);
338 }
339
340 PrioSelector* prio_selector = dynamic_cast<PrioSelector*>(registry->FindSelector(op_name));
341
342 if(prio_selector == nullptr)
343 {
344 prio_selector = new PrioSelector();
345 prio_selector->op_name = op_name;
346
347 registry->RegisterSelector(prio_selector);
348 }
349
350 if(!prio_selector->Register(priority, select_func))
351 return false;
352
353 return true;
354}
355
356NodeOps* NodeOpsRegistry::FindNodeOps(const CPUInfo* cpu_info, Node* node)
357{

Callers

nothing calls this directly

Calls 3

FindSelectorMethod · 0.80
RegisterSelectorMethod · 0.80
RegisterMethod · 0.45

Tested by

no test coverage detected