| 139 | } |
| 140 | |
| 141 | Allocator* AllocatorFactoryRegistry::GetEVAllocator() { |
| 142 | mutex_lock l(mu_); |
| 143 | first_alloc_made_ = true; |
| 144 | FactoryEntry* best_entry = nullptr; |
| 145 | for (auto& entry : factories_) { |
| 146 | if (best_entry == nullptr) { |
| 147 | best_entry = &entry; |
| 148 | } else if (entry.name == "EVAllocator") { |
| 149 | best_entry = &entry; |
| 150 | break; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | if (best_entry) { |
| 155 | if (!best_entry->allocator) { |
| 156 | best_entry->allocator.reset(best_entry->factory->CreateEVAllocator()); |
| 157 | } |
| 158 | return best_entry->allocator.get(); |
| 159 | } else { |
| 160 | LOG(FATAL) << "No registered EV AllocatorFactory"; |
| 161 | return nullptr; |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | Allocator* AllocatorFactoryRegistry::GetGPUEVAllocator() { |
| 166 | mutex_lock l(mu_); |
no test coverage detected